mirror of https://github.com/halo-dev/halo
Fixed #290
parent
ff134941c2
commit
b27123adf5
Binary file not shown.
|
@ -1,6 +1,5 @@
|
|||
#Tue Apr 23 17:12:17 CST 2019
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
|
||||
|
|
|
@ -28,7 +28,7 @@ APP_NAME="Gradle"
|
|||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
|
|
@ -14,7 +14,7 @@ set APP_BASE_NAME=%~n0
|
|||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
|
|
@ -29,14 +29,9 @@ public class BackupController {
|
|||
this.backupService = backupService;
|
||||
}
|
||||
|
||||
@PostMapping("import/markdowns")
|
||||
@ApiOperation("Import markdowns")
|
||||
public List<BasePostDetailDTO> backupMarkdowns(@RequestPart("files") MultipartFile[] files) throws IOException {
|
||||
List<BasePostDetailDTO> result = new LinkedList<>();
|
||||
for (MultipartFile file : files) {
|
||||
BasePostDetailDTO post = backupService.importMarkdowns(file);
|
||||
result.add(post);
|
||||
}
|
||||
return result;
|
||||
@PostMapping("import/markdown")
|
||||
@ApiOperation("Import markdown")
|
||||
public BasePostDetailDTO backupMarkdowns(@RequestPart("file") MultipartFile file) throws IOException {
|
||||
return backupService.importMarkdown(file);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,9 +21,7 @@ import run.halo.app.model.vo.PostListVO;
|
|||
import run.halo.app.service.OptionService;
|
||||
import run.halo.app.service.PostService;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
@ -140,8 +138,7 @@ public class PostController {
|
|||
}
|
||||
|
||||
@GetMapping("preview/{postId:\\d+}")
|
||||
public void preview(@PathVariable("postId") Integer postId,
|
||||
HttpServletResponse response) throws IOException {
|
||||
public String preview(@PathVariable("postId") Integer postId) {
|
||||
Post post = postService.getById(postId);
|
||||
|
||||
String token = IdUtil.simpleUUID();
|
||||
|
@ -149,10 +146,7 @@ public class PostController {
|
|||
// cache preview token
|
||||
cacheStore.putAny("preview-post-token-" + postId, token, 10, TimeUnit.MINUTES);
|
||||
|
||||
// build preview post url
|
||||
String redirect = String.format("%s/archives/%s?preview=true&token=%s", optionService.getBlogBaseUrl(), post.getUrl(), token);
|
||||
|
||||
// redirect to preview url
|
||||
response.sendRedirect(redirect);
|
||||
// build preview post url and return
|
||||
return String.format("%s/archives/%s?preview=true&token=%s", optionService.getBlogBaseUrl(), post.getUrl(), token);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,9 +16,7 @@ import run.halo.app.model.vo.SheetListVO;
|
|||
import run.halo.app.service.OptionService;
|
||||
import run.halo.app.service.SheetService;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
@ -113,8 +111,7 @@ public class SheetController {
|
|||
}
|
||||
|
||||
@GetMapping("preview/{sheetId:\\d+}")
|
||||
public void preview(@PathVariable("sheetId") Integer sheetId,
|
||||
HttpServletResponse response) throws IOException {
|
||||
public String preview(@PathVariable("sheetId") Integer sheetId) {
|
||||
Sheet sheet = sheetService.getById(sheetId);
|
||||
|
||||
String token = IdUtil.simpleUUID();
|
||||
|
@ -122,10 +119,7 @@ public class SheetController {
|
|||
// cache preview token
|
||||
cacheStore.putAny("preview-sheet-token-" + sheetId, token, 10, TimeUnit.MINUTES);
|
||||
|
||||
// build preview sheet url
|
||||
String redirect = String.format("%s/s/%s?preview=true&token=%s", optionService.getBlogBaseUrl(), sheet.getUrl(), token);
|
||||
|
||||
// redirect to preview url
|
||||
response.sendRedirect(redirect);
|
||||
// build preview post url and return
|
||||
return String.format("%s/s/%s?preview=true&token=%s", optionService.getBlogBaseUrl(), sheet.getUrl(), token);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,21 @@ import run.halo.app.model.enums.AttachmentType;
|
|||
*/
|
||||
public enum AttachmentProperties implements PropertyEnum {
|
||||
|
||||
/**
|
||||
* Upload image preview enable
|
||||
*/
|
||||
UPLOAD_IMAGE_PREVIEW_ENABLE("attachment_upload_image_preview_enable", Boolean.class, "true"),
|
||||
|
||||
/**
|
||||
* Upload max parallel uploads
|
||||
*/
|
||||
UPLOAD_MAX_PARALLEL_UPLOADS("attachment_upload_max_parallel_uploads", Integer.class, "3"),
|
||||
|
||||
/**
|
||||
* Upload max files
|
||||
*/
|
||||
UPLOAD_MAX_FILES("attachment_upload_max_files", Integer.class, "50"),
|
||||
|
||||
/**
|
||||
* attachment_type
|
||||
*/
|
||||
|
|
|
@ -19,5 +19,5 @@ public interface BackupService {
|
|||
* @param file file
|
||||
* @return post info
|
||||
*/
|
||||
BasePostDetailDTO importMarkdowns(MultipartFile file) throws IOException;
|
||||
BasePostDetailDTO importMarkdown(MultipartFile file) throws IOException;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public class BackupServiceImpl implements BackupService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BasePostDetailDTO importMarkdowns(MultipartFile file) throws IOException {
|
||||
public BasePostDetailDTO importMarkdown(MultipartFile file) throws IOException {
|
||||
|
||||
// Read markdown content.
|
||||
String markdown = IoUtil.read(file.getInputStream(), StandardCharsets.UTF_8);
|
||||
|
|
Loading…
Reference in New Issue