Skip to content

Commit

Permalink
Fixed save theme content error.
Browse files Browse the repository at this point in the history
  • Loading branch information
ruibaby committed Sep 1, 2019
1 parent 91797c1 commit 6c1a11d
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 34 deletions.
75 changes: 46 additions & 29 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,43 +41,60 @@ 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 {
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-undertow'
implementation 'org.springframework.boot:spring-boot-starter-freemarker'

implementation 'io.github.biezhi:oh-my-email:0.0.4'
implementation 'cn.hutool:hutool-core:4.5.0'
implementation 'cn.hutool:hutool-crypto:4.5.0'
implementation 'cn.hutool:hutool-extra:4.5.0'
implementation 'com.upyun:java-sdk:4.0.1'
implementation 'com.qiniu:qiniu-java-sdk:7.2.18'
implementation 'com.aliyun.oss:aliyun-sdk-oss:3.4.2'
implementation 'com.baidubce:bce-java-sdk:0.10.36'
implementation 'com.qcloud:cos_api:5.5.7'
implementation 'net.coobird:thumbnailator:0.4.8'
implementation 'io.springfox:springfox-swagger2:2.9.2'
implementation 'io.springfox:springfox-swagger-ui:2.9.2'
implementation 'org.apache.commons:commons-lang3:3.8.1'
implementation 'org.apache.httpcomponents:httpclient:4.5.7'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.9.2'
implementation 'org.eclipse.jgit:org.eclipse.jgit:5.3.0.201903130848-r'
implementation "io.github.biezhi:oh-my-email:$ohMyEmailVersion"
implementation "cn.hutool:hutool-core:$hutoolVersion"
implementation "cn.hutool:hutool-crypto:$hutoolVersion"
implementation "cn.hutool:hutool-extra:$hutoolVersion"
implementation "com.upyun:java-sdk:$upyunSdkVersion"
implementation "com.qiniu:qiniu-java-sdk:$qiniuSdkVersion"
implementation "com.aliyun.oss:aliyun-sdk-oss:$aliyunSdkVersion"
implementation "com.baidubce:bce-java-sdk:$baiduSdkVersion"
implementation "com.qcloud:cos_api:$qcloudSdkVersion"
implementation "net.coobird:thumbnailator:$thumbnailatorVersion"
implementation "io.springfox:springfox-swagger2:$swaggerVersion"
implementation "io.springfox:springfox-swagger-ui:$swaggerVersion"
implementation "org.apache.commons:commons-lang3:$commonsLangVersion"
implementation "org.apache.httpcomponents:httpclient:$httpclientVersion"
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$dataformatYamlVersion"
implementation "org.eclipse.jgit:org.eclipse.jgit:$jgitVersion"

implementation 'com.vladsch.flexmark:flexmark:0.42.12'
implementation 'com.vladsch.flexmark:flexmark-ext-attributes:0.42.12'
implementation 'com.vladsch.flexmark:flexmark-ext-autolink:0.42.12'
implementation 'com.vladsch.flexmark:flexmark-ext-emoji:0.42.12'
implementation 'com.vladsch.flexmark:flexmark-ext-escaped-character:0.42.12'
implementation 'com.vladsch.flexmark:flexmark-ext-gfm-strikethrough:0.42.12'
implementation 'com.vladsch.flexmark:flexmark-ext-gfm-tasklist:0.42.12'
implementation 'com.vladsch.flexmark:flexmark-ext-ins:0.42.12'
implementation 'com.vladsch.flexmark:flexmark-ext-media-tags:0.42.12'
implementation 'com.vladsch.flexmark:flexmark-ext-tables:0.42.12'
implementation 'com.vladsch.flexmark:flexmark-ext-toc:0.42.12'
implementation 'com.vladsch.flexmark:flexmark-ext-yaml-front-matter:0.42.12'
implementation 'com.vladsch.flexmark:flexmark-html-parser:0.42.12'
implementation "com.vladsch.flexmark:flexmark:$flexmarkVersion"
implementation "com.vladsch.flexmark:flexmark-ext-attributes:$flexmarkVersion"
implementation "com.vladsch.flexmark:flexmark-ext-autolink:$flexmarkVersion"
implementation "com.vladsch.flexmark:flexmark-ext-emoji:$flexmarkVersion"
implementation "com.vladsch.flexmark:flexmark-ext-escaped-character:$flexmarkVersion"
implementation "com.vladsch.flexmark:flexmark-ext-gfm-strikethrough:$flexmarkVersion"
implementation "com.vladsch.flexmark:flexmark-ext-gfm-tasklist:$flexmarkVersion"
implementation "com.vladsch.flexmark:flexmark-ext-ins:$flexmarkVersion"
implementation "com.vladsch.flexmark:flexmark-ext-media-tags:$flexmarkVersion"
implementation "com.vladsch.flexmark:flexmark-ext-tables:$flexmarkVersion"
implementation "com.vladsch.flexmark:flexmark-ext-toc:$flexmarkVersion"
implementation "com.vladsch.flexmark:flexmark-ext-yaml-front-matter:$flexmarkVersion"
implementation "com.vladsch.flexmark:flexmark-html-parser:$flexmarkVersion"

runtimeOnly 'com.h2database:h2'
runtimeOnly 'mysql:mysql-connector-java'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.springframework.web.multipart.MultipartFile;
import run.halo.app.handler.theme.config.support.Group;
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.ThemeFile;
import run.halo.app.service.ThemeService;
Expand Down Expand Up @@ -63,9 +64,8 @@ public BaseResponse<String> getContentBy(@RequestParam(name = "path") String pat
}

@PutMapping("files/content")
public void updateContentBy(@RequestParam(name = "path") String path,
@RequestBody String content) {
themeService.saveTemplateContent(path, content);
public void updateContentBy(@RequestBody ThemeContentParam param) {
themeService.saveTemplateContent(param.getPath(), param.getContent());
}

@GetMapping("files/custom")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import lombok.EqualsAndHashCode;
import lombok.ToString;
import run.halo.app.model.enums.PostCreateFrom;
import run.halo.app.model.enums.PostType;

/**
* Base page simple output dto.
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/run/halo/app/model/params/PostParam.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import run.halo.app.model.entity.Post;
import run.halo.app.model.enums.PostCreateFrom;
import run.halo.app.model.enums.PostStatus;
import run.halo.app.utils.HaloUtils;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
Expand All @@ -19,6 +18,7 @@
* Post param.
*
* @author johnniang
* @author ryanwang
* @date 3/21/19
*/
@Data
Expand Down Expand Up @@ -64,6 +64,9 @@ public Post convertTo() {
if (StringUtils.isBlank(url)) {
url = title;
}
if (null == thumbnail) {
thumbnail = "";
}

Post post = InputConverter.super.convertTo();
// Crypt password
Expand All @@ -79,6 +82,9 @@ public void update(Post post) {
if (StringUtils.isBlank(url)) {
url = title;
}
if (null == thumbnail) {
thumbnail = "";
}

InputConverter.super.update(post);

Expand Down
11 changes: 11 additions & 0 deletions src/main/java/run/halo/app/model/params/SheetParam.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
import java.util.Date;

/**
* Sheet param.
*
* @author johnniang
* @author ryanwang
* @date 19-4-24
*/
@Data
Expand Down Expand Up @@ -57,6 +60,10 @@ public Sheet convertTo() {

url = HaloUtils.initializeUrlIfBlank(url);

if (null == thumbnail) {
thumbnail = "";
}

Sheet sheet = InputConverter.super.convertTo();
// Crypt password
if (StringUtils.isNotBlank(password)) {
Expand All @@ -76,6 +83,10 @@ public void update(Sheet sheet) {

url = HaloUtils.initializeUrlIfBlank(url);

if (null == thumbnail) {
thumbnail = "";
}

InputConverter.super.update(sheet);

// Crypt password
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/run/halo/app/model/params/ThemeContentParam.java
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit 6c1a11d

Please sign in to comment.