mirror of https://github.com/halo-dev/halo
Update halo-comment.js path.
parent
c563137577
commit
8a1b9ccffe
|
@ -113,7 +113,8 @@ public class HaloConfiguration {
|
|||
ApiAuthenticationFilter apiFilter = new ApiAuthenticationFilter(haloProperties, optionService);
|
||||
apiFilter.addExcludeUrlPatterns(
|
||||
"/api/content/*/comments",
|
||||
"/api/content/**/comments/**"
|
||||
"/api/content/**/comments/**",
|
||||
"/api/content/options/comment"
|
||||
);
|
||||
|
||||
DefaultAuthenticationFailureHandler failureHandler = new DefaultAuthenticationFailureHandler();
|
||||
|
|
|
@ -8,6 +8,7 @@ import run.halo.app.model.dto.OptionDTO;
|
|||
import run.halo.app.model.support.BaseResponse;
|
||||
import run.halo.app.service.OptionService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -48,4 +49,14 @@ public class OptionController {
|
|||
public BaseResponse<Object> getBy(@PathVariable("key") String key) {
|
||||
return BaseResponse.ok(HttpStatus.OK.getReasonPhrase(), optionService.getByKey(key).orElse(null));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("comment")
|
||||
@ApiOperation("Options for comment")
|
||||
public Map<String, Object> comment() {
|
||||
List<String> keys = new ArrayList<>();
|
||||
keys.add("comment_gavatar_default");
|
||||
keys.add("comment_content_placeholder");
|
||||
return optionService.listOptions(keys);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package run.halo.app.service.impl;
|
|||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.text.StrBuilder;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -355,7 +356,7 @@ public class PostServiceImpl extends BasePostServiceImpl<Post> implements PostSe
|
|||
}
|
||||
|
||||
if (StrUtil.isEmpty(post.getUrl())) {
|
||||
post.setUrl(DateUtil.format(new Date(), "yyyyMMddHHmmss"));
|
||||
post.setUrl(DateUtil.format(new Date(), "yyyyMMddHHmmss" + RandomUtil.randomNumbers(5)));
|
||||
}
|
||||
|
||||
post.setOriginalContent(markdown);
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,7 +1,7 @@
|
|||
<#macro comment post,type>
|
||||
<#if !post.disallowComment!false>
|
||||
<script src="//cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.min.js"></script>
|
||||
<script src="//cdn.jsdelivr.net/gh/halo-dev/halo-comment@1.0.0-beta.6/dist/halo-comment.min.js"></script>
|
||||
<script src="//cdn.jsdelivr.net/gh/halo-dev/halo-comment@1.0.0/dist/halo-comment.min.js"></script>
|
||||
<halo-comment id="${post.id}" type="${type}"/>
|
||||
</#if>
|
||||
</#macro>
|
Loading…
Reference in New Issue