mirror of https://github.com/halo-dev/halo
Fixed save theme content error.
parent
91797c1801
commit
6c1a11dac9
75
build.gradle
75
build.gradle
|
@ -41,6 +41,23 @@ bootJar {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ext {
|
||||||
|
ohMyEmailVersion = '0.0.4'
|
||||||
|
hutoolVersion = '4.5.0'
|
||||||
|
upyunSdkVersion = '4.0.1'
|
||||||
|
qiniuSdkVersion = '7.2.18'
|
||||||
|
aliyunSdkVersion = '3.4.2'
|
||||||
|
baiduSdkVersion = '0.10.36'
|
||||||
|
qcloudSdkVersion = '5.5.7'
|
||||||
|
thumbnailatorVersion = '0.4.8'
|
||||||
|
swaggerVersion = '2.9.2'
|
||||||
|
commonsLangVersion = '3.8.1'
|
||||||
|
httpclientVersion = '4.5.7'
|
||||||
|
dataformatYamlVersion = '2.9.2'
|
||||||
|
jgitVersion = '5.3.0.201903130848-r'
|
||||||
|
flexmarkVersion = '0.42.12'
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-actuator'
|
implementation 'org.springframework.boot:spring-boot-starter-actuator'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
||||||
|
@ -48,36 +65,36 @@ dependencies {
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-undertow'
|
implementation 'org.springframework.boot:spring-boot-starter-undertow'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-freemarker'
|
implementation 'org.springframework.boot:spring-boot-starter-freemarker'
|
||||||
|
|
||||||
implementation 'io.github.biezhi:oh-my-email:0.0.4'
|
implementation "io.github.biezhi:oh-my-email:$ohMyEmailVersion"
|
||||||
implementation 'cn.hutool:hutool-core:4.5.0'
|
implementation "cn.hutool:hutool-core:$hutoolVersion"
|
||||||
implementation 'cn.hutool:hutool-crypto:4.5.0'
|
implementation "cn.hutool:hutool-crypto:$hutoolVersion"
|
||||||
implementation 'cn.hutool:hutool-extra:4.5.0'
|
implementation "cn.hutool:hutool-extra:$hutoolVersion"
|
||||||
implementation 'com.upyun:java-sdk:4.0.1'
|
implementation "com.upyun:java-sdk:$upyunSdkVersion"
|
||||||
implementation 'com.qiniu:qiniu-java-sdk:7.2.18'
|
implementation "com.qiniu:qiniu-java-sdk:$qiniuSdkVersion"
|
||||||
implementation 'com.aliyun.oss:aliyun-sdk-oss:3.4.2'
|
implementation "com.aliyun.oss:aliyun-sdk-oss:$aliyunSdkVersion"
|
||||||
implementation 'com.baidubce:bce-java-sdk:0.10.36'
|
implementation "com.baidubce:bce-java-sdk:$baiduSdkVersion"
|
||||||
implementation 'com.qcloud:cos_api:5.5.7'
|
implementation "com.qcloud:cos_api:$qcloudSdkVersion"
|
||||||
implementation 'net.coobird:thumbnailator:0.4.8'
|
implementation "net.coobird:thumbnailator:$thumbnailatorVersion"
|
||||||
implementation 'io.springfox:springfox-swagger2:2.9.2'
|
implementation "io.springfox:springfox-swagger2:$swaggerVersion"
|
||||||
implementation 'io.springfox:springfox-swagger-ui:2.9.2'
|
implementation "io.springfox:springfox-swagger-ui:$swaggerVersion"
|
||||||
implementation 'org.apache.commons:commons-lang3:3.8.1'
|
implementation "org.apache.commons:commons-lang3:$commonsLangVersion"
|
||||||
implementation 'org.apache.httpcomponents:httpclient:4.5.7'
|
implementation "org.apache.httpcomponents:httpclient:$httpclientVersion"
|
||||||
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.9.2'
|
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$dataformatYamlVersion"
|
||||||
implementation 'org.eclipse.jgit:org.eclipse.jgit:5.3.0.201903130848-r'
|
implementation "org.eclipse.jgit:org.eclipse.jgit:$jgitVersion"
|
||||||
|
|
||||||
implementation 'com.vladsch.flexmark:flexmark:0.42.12'
|
implementation "com.vladsch.flexmark:flexmark:$flexmarkVersion"
|
||||||
implementation 'com.vladsch.flexmark:flexmark-ext-attributes:0.42.12'
|
implementation "com.vladsch.flexmark:flexmark-ext-attributes:$flexmarkVersion"
|
||||||
implementation 'com.vladsch.flexmark:flexmark-ext-autolink:0.42.12'
|
implementation "com.vladsch.flexmark:flexmark-ext-autolink:$flexmarkVersion"
|
||||||
implementation 'com.vladsch.flexmark:flexmark-ext-emoji:0.42.12'
|
implementation "com.vladsch.flexmark:flexmark-ext-emoji:$flexmarkVersion"
|
||||||
implementation 'com.vladsch.flexmark:flexmark-ext-escaped-character:0.42.12'
|
implementation "com.vladsch.flexmark:flexmark-ext-escaped-character:$flexmarkVersion"
|
||||||
implementation 'com.vladsch.flexmark:flexmark-ext-gfm-strikethrough:0.42.12'
|
implementation "com.vladsch.flexmark:flexmark-ext-gfm-strikethrough:$flexmarkVersion"
|
||||||
implementation 'com.vladsch.flexmark:flexmark-ext-gfm-tasklist:0.42.12'
|
implementation "com.vladsch.flexmark:flexmark-ext-gfm-tasklist:$flexmarkVersion"
|
||||||
implementation 'com.vladsch.flexmark:flexmark-ext-ins:0.42.12'
|
implementation "com.vladsch.flexmark:flexmark-ext-ins:$flexmarkVersion"
|
||||||
implementation 'com.vladsch.flexmark:flexmark-ext-media-tags:0.42.12'
|
implementation "com.vladsch.flexmark:flexmark-ext-media-tags:$flexmarkVersion"
|
||||||
implementation 'com.vladsch.flexmark:flexmark-ext-tables:0.42.12'
|
implementation "com.vladsch.flexmark:flexmark-ext-tables:$flexmarkVersion"
|
||||||
implementation 'com.vladsch.flexmark:flexmark-ext-toc:0.42.12'
|
implementation "com.vladsch.flexmark:flexmark-ext-toc:$flexmarkVersion"
|
||||||
implementation 'com.vladsch.flexmark:flexmark-ext-yaml-front-matter:0.42.12'
|
implementation "com.vladsch.flexmark:flexmark-ext-yaml-front-matter:$flexmarkVersion"
|
||||||
implementation 'com.vladsch.flexmark:flexmark-html-parser:0.42.12'
|
implementation "com.vladsch.flexmark:flexmark-html-parser:$flexmarkVersion"
|
||||||
|
|
||||||
runtimeOnly 'com.h2database:h2'
|
runtimeOnly 'com.h2database:h2'
|
||||||
runtimeOnly 'mysql:mysql-connector-java'
|
runtimeOnly 'mysql:mysql-connector-java'
|
||||||
|
|
|
@ -6,6 +6,7 @@ import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import run.halo.app.handler.theme.config.support.Group;
|
import run.halo.app.handler.theme.config.support.Group;
|
||||||
import run.halo.app.handler.theme.config.support.ThemeProperty;
|
import run.halo.app.handler.theme.config.support.ThemeProperty;
|
||||||
|
import run.halo.app.model.params.ThemeContentParam;
|
||||||
import run.halo.app.model.support.BaseResponse;
|
import run.halo.app.model.support.BaseResponse;
|
||||||
import run.halo.app.model.support.ThemeFile;
|
import run.halo.app.model.support.ThemeFile;
|
||||||
import run.halo.app.service.ThemeService;
|
import run.halo.app.service.ThemeService;
|
||||||
|
@ -63,9 +64,8 @@ public class ThemeController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("files/content")
|
@PutMapping("files/content")
|
||||||
public void updateContentBy(@RequestParam(name = "path") String path,
|
public void updateContentBy(@RequestBody ThemeContentParam param) {
|
||||||
@RequestBody String content) {
|
themeService.saveTemplateContent(param.getPath(), param.getContent());
|
||||||
themeService.saveTemplateContent(path, content);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("files/custom")
|
@GetMapping("files/custom")
|
||||||
|
|
|
@ -4,7 +4,6 @@ import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import run.halo.app.model.enums.PostCreateFrom;
|
import run.halo.app.model.enums.PostCreateFrom;
|
||||||
import run.halo.app.model.enums.PostType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base page simple output dto.
|
* Base page simple output dto.
|
||||||
|
|
|
@ -7,7 +7,6 @@ import run.halo.app.model.dto.base.InputConverter;
|
||||||
import run.halo.app.model.entity.Post;
|
import run.halo.app.model.entity.Post;
|
||||||
import run.halo.app.model.enums.PostCreateFrom;
|
import run.halo.app.model.enums.PostCreateFrom;
|
||||||
import run.halo.app.model.enums.PostStatus;
|
import run.halo.app.model.enums.PostStatus;
|
||||||
import run.halo.app.utils.HaloUtils;
|
|
||||||
|
|
||||||
import javax.validation.constraints.Min;
|
import javax.validation.constraints.Min;
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
|
@ -19,6 +18,7 @@ import java.util.Set;
|
||||||
* Post param.
|
* Post param.
|
||||||
*
|
*
|
||||||
* @author johnniang
|
* @author johnniang
|
||||||
|
* @author ryanwang
|
||||||
* @date 3/21/19
|
* @date 3/21/19
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@ -64,6 +64,9 @@ public class PostParam implements InputConverter<Post> {
|
||||||
if (StringUtils.isBlank(url)) {
|
if (StringUtils.isBlank(url)) {
|
||||||
url = title;
|
url = title;
|
||||||
}
|
}
|
||||||
|
if (null == thumbnail) {
|
||||||
|
thumbnail = "";
|
||||||
|
}
|
||||||
|
|
||||||
Post post = InputConverter.super.convertTo();
|
Post post = InputConverter.super.convertTo();
|
||||||
// Crypt password
|
// Crypt password
|
||||||
|
@ -79,6 +82,9 @@ public class PostParam implements InputConverter<Post> {
|
||||||
if (StringUtils.isBlank(url)) {
|
if (StringUtils.isBlank(url)) {
|
||||||
url = title;
|
url = title;
|
||||||
}
|
}
|
||||||
|
if (null == thumbnail) {
|
||||||
|
thumbnail = "";
|
||||||
|
}
|
||||||
|
|
||||||
InputConverter.super.update(post);
|
InputConverter.super.update(post);
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,10 @@ import javax.validation.constraints.Size;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sheet param.
|
||||||
|
*
|
||||||
* @author johnniang
|
* @author johnniang
|
||||||
|
* @author ryanwang
|
||||||
* @date 19-4-24
|
* @date 19-4-24
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@ -57,6 +60,10 @@ public class SheetParam implements InputConverter<Sheet> {
|
||||||
|
|
||||||
url = HaloUtils.initializeUrlIfBlank(url);
|
url = HaloUtils.initializeUrlIfBlank(url);
|
||||||
|
|
||||||
|
if (null == thumbnail) {
|
||||||
|
thumbnail = "";
|
||||||
|
}
|
||||||
|
|
||||||
Sheet sheet = InputConverter.super.convertTo();
|
Sheet sheet = InputConverter.super.convertTo();
|
||||||
// Crypt password
|
// Crypt password
|
||||||
if (StringUtils.isNotBlank(password)) {
|
if (StringUtils.isNotBlank(password)) {
|
||||||
|
@ -76,6 +83,10 @@ public class SheetParam implements InputConverter<Sheet> {
|
||||||
|
|
||||||
url = HaloUtils.initializeUrlIfBlank(url);
|
url = HaloUtils.initializeUrlIfBlank(url);
|
||||||
|
|
||||||
|
if (null == thumbnail) {
|
||||||
|
thumbnail = "";
|
||||||
|
}
|
||||||
|
|
||||||
InputConverter.super.update(sheet);
|
InputConverter.super.update(sheet);
|
||||||
|
|
||||||
// Crypt password
|
// Crypt password
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package run.halo.app.model.params;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Theme content param.
|
||||||
|
*
|
||||||
|
* @author ryanwang
|
||||||
|
* @date 2019-09-01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ThemeContentParam {
|
||||||
|
private String path;
|
||||||
|
private String content;
|
||||||
|
}
|
Loading…
Reference in New Issue