mirror of https://github.com/halo-dev/halo
Support stick post.
parent
62975bfd6a
commit
91797c1801
|
@ -1,5 +1,7 @@
|
|||
package run.halo.app.controller.admin.api;
|
||||
|
||||
import cn.hutool.core.text.StrBuilder;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
|
@ -196,11 +198,15 @@ public class InstallController {
|
|||
installParam.update(user);
|
||||
// Set password manually
|
||||
userService.setPassword(user, installParam.getPassword());
|
||||
// Set default avatar
|
||||
userService.setDefaultAvatar(user);
|
||||
// Update user
|
||||
return userService.update(user);
|
||||
}).orElseGet(() -> userService.createBy(installParam));
|
||||
}).orElseGet(() -> {
|
||||
StrBuilder gravatar = new StrBuilder("//cn.gravatar.com/avatar/");
|
||||
gravatar.append(SecureUtil.md5(installParam.getEmail()));
|
||||
gravatar.append("?s=256&d=mm");
|
||||
installParam.setAvatar(gravatar.toString());
|
||||
return userService.createBy(installParam);
|
||||
});
|
||||
}
|
||||
|
||||
private void initSettings(InstallParam installParam) {
|
||||
|
|
|
@ -2,8 +2,11 @@ package run.halo.app.controller.admin.api;
|
|||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.data.web.SortDefault;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import run.halo.app.model.dto.post.BasePostMinimalDTO;
|
||||
import run.halo.app.model.dto.post.BasePostSimpleDTO;
|
||||
|
@ -24,6 +27,7 @@ import static org.springframework.data.domain.Sort.Direction.DESC;
|
|||
* Post controller.
|
||||
*
|
||||
* @author johnniang
|
||||
* @author ryanwang
|
||||
* @date 3/19/19
|
||||
*/
|
||||
@RestController
|
||||
|
@ -38,8 +42,13 @@ public class PostController {
|
|||
|
||||
@GetMapping
|
||||
@ApiOperation("Lists posts")
|
||||
public Page<PostListVO> pageBy(@PageableDefault(sort = "createTime", direction = DESC) Pageable pageable,
|
||||
public Page<PostListVO> pageBy(Integer page, Integer size,
|
||||
@SortDefault.SortDefaults({
|
||||
@SortDefault(sort = "topPriority", direction = DESC),
|
||||
@SortDefault(sort = "createTime", direction = DESC)
|
||||
}) Sort sort,
|
||||
PostQuery postQuery) {
|
||||
Pageable pageable = PageRequest.of(page, size, sort);
|
||||
Page<Post> postPage = postService.pageBy(postQuery, pageable);
|
||||
return postService.convertToListVo(postPage);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public class ThemeController {
|
|||
return themeService.getThemes();
|
||||
}
|
||||
|
||||
@GetMapping("files")
|
||||
@GetMapping("activation/files")
|
||||
public List<ThemeFile> listFiles() {
|
||||
return themeService.listThemeFolderBy(themeService.getActivatedThemeId());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue