Skip to content

Commit

Permalink
1.2.0 版本
Browse files Browse the repository at this point in the history
  • Loading branch information
wenjing-xin committed Jun 17, 2024
1 parent ca19e28 commit c22f68f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=1.1.0
version=1.2.0
14 changes: 10 additions & 4 deletions src/main/java/xin/wenjing/halo/artalk/ArtalkStaticInject.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package xin.wenjing.halo.artalk;

import lombok.RequiredArgsConstructor;
import org.pf4j.PluginWrapper;
import org.springframework.stereotype.Component;
import org.thymeleaf.context.ITemplateContext;
import org.thymeleaf.model.IModel;
Expand All @@ -23,9 +24,12 @@ public class ArtalkStaticInject implements TemplateHeadProcessor {

private final SettingFetcher settingFetcher;

private final PluginWrapper pluginWrapper;

@Override
public Mono<Void> process(ITemplateContext context, IModel model, IElementModelStructureHandler structureHandler) {
Settings baseConf = settingFetcher.fetch(Settings.GROUP, Settings.class).orElse(new Settings());

String injectContent = "";

// 开启明暗模式后自定义css加入
Expand All @@ -51,23 +55,25 @@ public Mono<Void> process(ITemplateContext context, IModel model, IElementModelS
*/
private String pubScriptInject(boolean enableLatex, String cssUrl, String jsUrl){
if(jsUrl != null && cssUrl !=null) {

String version = pluginWrapper.getDescriptor().getVersion();
if (enableLatex) {
return
"""
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/katex.min.css" />
<link rel="stylesheet" href="/plugins/plugin-artalk/assets/static/artalkBeautify.css" />
<link rel="stylesheet" href="/plugins/plugin-artalk/assets/static/artalkBeautify.css?version=%s" />
<script data-pjax src="/plugins/plugin-artalk/assets/static/katex.min.js"></script>
<link rel="stylesheet" href="%s" />
<script data-pjax src="%s"></script>
<script defer src="/plugins/plugin-artalk/assets/static/artalk-plugin-katex.js"></script>
""".formatted(cssUrl, jsUrl);
""".formatted(version, cssUrl, jsUrl);
} else {
return
"""
<link rel="stylesheet" href="/plugins/plugin-artalk/assets/static/artalkBeautify.css" />
<link rel="stylesheet" href="/plugins/plugin-artalk/assets/static/artalkBeautify.css?version=%s" />
<link rel="stylesheet" href="%s">
<script data-pjax src="%s"></script>
""".formatted(cssUrl, jsUrl);
""".formatted(version, cssUrl, jsUrl);
}
}else{
return null;
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/static/artalkBeautify.css
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ div#post-comment {
#post-comment .comment-head .comment-headline .switchColor{
display: inline-block;
padding: 5px;
font-size: 15px;
}
#post-comment .comment-head .comment-headline .active-artalk-btn{
color: #499EFF;
Expand Down

0 comments on commit c22f68f

Please sign in to comment.