Change options.yaml to settings.yaml.

pull/146/head
ruibaby 2019-04-24 14:36:20 +08:00
parent 819c999dcf
commit 02b6878aec
23 changed files with 35 additions and 238 deletions

View File

@ -38,7 +38,7 @@ public class OptionController {
@GetMapping("map_view")
@ApiOperation("Lists all options with map view")
public Map<String, String> listAllWithMapView() {
public Map<String, Object> listAllWithMapView() {
return optionService.listOptions();
}

View File

@ -15,7 +15,7 @@ import java.util.List;
* @author johnniang
* @date 4/2/19
*/
@RestController("PortalArchiveController")
@RestController("ApiContentArchiveController")
@RequestMapping("/api/archives")
public class ArchiveController {

View File

@ -15,7 +15,7 @@ import run.halo.app.service.CommentService;
* @author johnniang
* @date 4/3/19
*/
@RestController("PortalCommentController")
@RestController("ApiContentCommentController")
@RequestMapping("/api/comments")
public class CommentController {

View File

@ -17,7 +17,7 @@ import java.util.List;
* @author johnniang
* @date 4/3/19
*/
@RestController("PortalLinkController")
@RestController("ApiContentLinkController")
@RequestMapping("/api/links")
public class LinkController {

View File

@ -19,7 +19,7 @@ import static org.springframework.data.domain.Sort.Direction.DESC;
* @author johnniang
* @date 4/3/19
*/
@RestController("PortalMenuController")
@RestController("ApiContentMenuController")
@RequestMapping("/api/menus")
public class MenuController {

View File

@ -19,7 +19,7 @@ import java.util.Map;
* @author johnniang
* @date 4/3/19
*/
@RestController("PortalOptionController")
@RestController("ApiContentOptionController")
@RequestMapping("/api/options")
public class OptionController {
@ -37,7 +37,7 @@ public class OptionController {
@GetMapping("map_view")
@ApiOperation("Lists all options with map view")
public Map<String, String> listAllWithMapView() {
public Map<String, Object> listAllWithMapView() {
return optionService.listOptions();
}

View File

@ -33,7 +33,7 @@ import static org.springframework.data.domain.Sort.Direction.DESC;
* @author johnniang
* @date 4/2/19
*/
@RestController("PortalPostController")
@RestController("ApiContentPostController")
@RequestMapping("/api/posts")
public class PostController {

View File

@ -24,7 +24,7 @@ import static org.springframework.data.domain.Sort.Direction.DESC;
* @author johnniang
* @date 4/2/19
*/
@RestController("PortalTagController")
@RestController("ApiContentTagController")
@RequestMapping("/api/tags")
public class TagController {

View File

@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
* @author johnniang
* @date 4/3/19
*/
@RestController("PortalUserController")
@RestController("ApiContentUserController")
@RequestMapping("/api/users")
public class UserController {

View File

@ -61,11 +61,11 @@ public class FreemarkerConfigAwareListener {
ThemeProperty activatedTheme = themeActivatedEvent.getThemeProperty();
log.debug("Set shared variable theme: [{}]", activatedTheme);
configuration.setSharedVariable("theme", activatedTheme);
Map<String, String> options = optionService.listOptions();
Map<String, Object> options = optionService.listOptions();
log.debug("Set shared variable options: [{}]", options);
configuration.setSharedVariable("options", options);
log.debug("Set shared variable theme settings: [{}]", options);
configuration.setSharedVariable("setting",themeSettingService.listAsMapBy(themeService.getActivatedThemeId()));
configuration.setSharedVariable("settings",themeSettingService.listAsMapBy(themeService.getActivatedThemeId()));
} catch (TemplateModelException e) {
log.warn("Failed to configure freemarker", e);
}

View File

@ -44,7 +44,7 @@ public class Gallery extends BaseEntity {
/**
* Shooting time / creation time.
*/
@Column(name = "take_time", columnDefinition = "timestamp not null")
@Column(name = "take_time", columnDefinition = "timestamp default CURRENT_TIMESTAMP")
@Temporal(TemporalType.TIMESTAMP)
private Date takeTime;

View File

@ -78,7 +78,7 @@ public interface OptionService extends CrudService<Option, Integer> {
* @return Map
*/
@NonNull
Map<String, String> listOptions();
Map<String, Object> listOptions();
/**
* Lists all option dtos.

View File

@ -33,7 +33,7 @@ public interface ThemeService {
/**
* Configuration file name.
*/
String[] OPTIONS_NAMES = {"options.yaml", "options.yml"};
String[] SETTINGS_NAMES = {"settings.yaml", "settings.yml"};
/**
* The type of file that can be modified.
@ -43,7 +43,7 @@ public interface ThemeService {
/**
* These file names cannot be displayed.
*/
String[] FILTER_FILES = {".git", ".DS_Store", "theme.yaml", "theme.yml", "options.yaml", "option.yml"};
String[] FILTER_FILES = {".git", ".DS_Store", "theme.yaml", "theme.yml", "settings.yaml", "settings.yml"};
/**
* Theme folder location.

View File

@ -124,7 +124,7 @@ public class OptionServiceImpl extends AbstractCrudService<Option, Integer> impl
}
@Override
public Map<String, String> listOptions() {
public Map<String, Object> listOptions() {
return ServiceUtils.convertToMap(listAll(), Option::getKey, Option::getValue);
}

View File

@ -258,7 +258,7 @@ public class ThemeServiceImpl implements ThemeService {
}
try {
for (String optionsName : OPTIONS_NAMES) {
for (String optionsName : SETTINGS_NAMES) {
// Resolve the options path
Path optionsPath = Paths.get(themeProperty.getThemePath(), optionsName);
@ -707,7 +707,7 @@ public class ThemeServiceImpl implements ThemeService {
private boolean hasOptions(@NonNull Path themePath) {
Assert.notNull(themePath, "Path must not be null");
for (String optionsName : OPTIONS_NAMES) {
for (String optionsName : SETTINGS_NAMES) {
// Resolve the options path
Path optionsPath = themePath.resolve(optionsName);

View File

@ -5,8 +5,8 @@
<title>图库 · ${options.blog_title!}</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="anatole/source/plugins/gallery/css/main.css" />
<noscript><link rel="stylesheet" href="/source/plugins/gallery/css/noscript.css" /></noscript>
<link rel="stylesheet" href="${theme.folderName}/source/plugins/gallery/css/main.css" />
<noscript><link rel="stylesheet" href="/${theme.folderName}/plugins/gallery/css/noscript.css" /></noscript>
</head>
<body class="is-loading-0 is-loading-1 is-loading-2">
<div id="main">
@ -41,9 +41,9 @@
</ul>
</footer>
</div>
<script src="anatole/source/plugins/gallery/js/jquery.min.js"></script>
<script src="anatole/source/plugins/gallery/js/skel.min.js"></script>
<script src="anatole/source/plugins/gallery/js/main.js"></script>
<script src="${theme.folderName}/source/plugins/gallery/js/jquery.min.js"></script>
<script src="${theme.folderName}/source/plugins/gallery/js/skel.min.js"></script>
<script src="${theme.folderName}/source/plugins/gallery/js/main.js"></script>
<@statistics></@statistics>
</body>
</html>

View File

@ -10,15 +10,15 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="format-detection" content="telephone=no" />
<meta name="renderer" content="webkit">
<meta name="theme-color" content="${options.anatole_style_google_color!'#fff'}">
<meta name="theme-color" content="${settings.google_color!'#fff'}">
<meta name="author" content="${user.nickName!}" />
<meta name="keywords" content="${keywords!}"/>
<meta name="description" content="${description!}" />
<@verification></@verification>
<@favicon></@favicon>
<link href="/anatole/source/css/font-awesome.min.css" type="text/css" rel="stylesheet"/>
<link rel="stylesheet" href="/anatole/source/css/blog_basic.min.css?version=88107691fe">
<link href="/anatole/source/css/style.min.css" type="text/css" rel="stylesheet" />
<link href="/${theme.folderName}/source/css/font-awesome.min.css" type="text/css" rel="stylesheet"/>
<link rel="stylesheet" href="/${theme.folderName}/source/css/blog_basic.min.css?version=88107691fe">
<link href="/${theme.folderName}/source/css/style.min.css" type="text/css" rel="stylesheet" />
<link rel="alternate" type="application/rss+xml" title="atom 1.0" href="/feed.xml">
<style>
<#if !(settings.post_title_uppper!true)>
@ -48,7 +48,7 @@
<body>
</#macro>
<#macro footer>
<script type="text/javascript" src="/anatole/source/js/jquery.min.js"></script>
<script type="text/javascript" src="/${theme.folderName}/source/js/jquery.min.js"></script>
<script type="text/javascript">
var url = location.href;
var urlstatus = false;

View File

@ -1,203 +0,0 @@
<#import "/common/macro/theme_option_marco.ftl" as option>
<@option.head />
<div class="container-fluid">
<div class="row">
<div class="col-lg-6 themeImg">
<img src="/${themeDir}/screenshot.png" style="width: 100%;">
</div>
<div class="col-md-6 themeSetting">
<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<li class="active">
<a href="#sns" data-toggle="tab">社交资料</a>
</li>
<li>
<a href="#style" data-toggle="tab">样式设置</a>
</li>
<li>
<a href="#about" data-toggle="tab">关于</a>
</li>
</ul>
<div class="tab-content">
<!-- 社交资料 -->
<div class="tab-pane active" id="sns">
<form method="post" class="form-horizontal" id="anatoleSnsOptions">
<div class="box-body">
<div class="form-group">
<label for="anatoleSnsRss" class="col-sm-4 control-label">RSS</label>
<div class="col-sm-8">
<label class="radio-inline">
<input type="radio" name="theme_anatole_sns_rss" id="anatoleSnsRss" value="true" ${((options.theme_anatole_sns_rss!'true')=='true')?string('checked','')}> 显示
</label>
<label class="radio-inline">
<input type="radio" name="theme_anatole_sns_rss" id="anatoleSnsRss" value="false" ${((options.theme_anatole_sns_rss!)=='false')?string('checked','')}> 隐藏
</label>
</div>
</div>
<div class="form-group">
<label for="anatoleSnsTwitter" class="col-sm-4 control-label">Twitter</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="anatoleSnsTwitter" name="theme_anatole_sns_twitter" value="${options.theme_anatole_sns_twitter!}" >
</div>
</div>
<div class="form-group">
<label for="anatoleSnsFacebook" class="col-sm-4 control-label">Facebook</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="anatoleSnsFacebook" name="theme_anatole_sns_facebook" value="${options.theme_anatole_sns_facebook!}" >
</div>
</div>
<div class="form-group">
<label for="anatoleSnsInstagram" class="col-sm-4 control-label">Instagram</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="anatoleSnsInstagram" name="theme_anatole_sns_instagram" value="${options.theme_anatole_sns_instagram!}" >
</div>
</div>
<div class="form-group">
<label for="anatoleSnsDribbble" class="col-sm-4 control-label">Dribbble</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="anatoleSnsDribbble" name="theme_anatole_sns_dribbble" value="${options.theme_anatole_sns_dribbble!}" >
</div>
</div>
<div class="form-group">
<label for="anatoleSnsWeibo" class="col-sm-4 control-label">Weibo</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="anatoleSnsWeibo" name="theme_anatole_sns_weibo" value="${options.theme_anatole_sns_weibo!}" >
</div>
</div>
<div class="form-group">
<label for="anatoleSnsEmail" class="col-sm-4 control-label">Email</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="anatoleSnsEmail" name="theme_anatole_sns_email" value="${options.theme_anatole_sns_email!}" >
</div>
</div>
<div class="form-group">
<label for="anatoleSnsGithub" class="col-sm-4 control-label">Github</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="anatoleSnsGithub" name="theme_anatole_sns_github" value="${options.theme_anatole_sns_github!}" >
</div>
</div>
<div class="form-group">
<label for="anatoleSnsQQ" class="col-sm-4 control-label">QQ</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="anatoleSnsQQ" name="theme_anatole_sns_qq" value="${options.theme_anatole_sns_qq!}" >
</div>
</div>
<div class="form-group">
<label for="anatoleSnsTelegram" class="col-sm-4 control-label">Telegram</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="anatoleSnsTelegram" name="theme_anatole_sns_telegram" value="${options.theme_anatole_sns_telegram!}" >
</div>
</div>
</div>
<div class="box-footer">
<button type="button" class="btn btn-primary btn-sm pull-right" onclick="saveThemeOptions('anatoleSnsOptions')">保存设置</button>
</div>
</form>
</div>
<!--样式设置-->
<div class="tab-pane" id="style">
<form method="post" class="form-horizontal" id="anatoleStyleOptions">
<div class="box-body">
<div class="form-group">
<label for="anatoleStyleRightIcon" class="col-sm-4 control-label">右上角图标:</label>
<div class="col-sm-8">
<div class="input-group">
<input type="text" class="form-control" id="anatoleStyleRightIcon" name="anatole_style_right_icon" value="${options.anatole_style_right_icon!'/anatole/source/images/logo.png'}" >
<span class="input-group-btn">
<button class="btn btn-default btn-flat" type="button" onclick="openAttach('anatoleStyleRightIcon')">选择</button>
</span>
</div>
</div>
</div>
<div class="form-group">
<label for="anatoleStylePostTitleLower" class="col-sm-4 control-label">文章标题大写:</label>
<div class="col-sm-8">
<label class="radio-inline">
<input type="radio" name="anatole_style_post_title_lower" id="anatoleStylePostTitleLower" value="true" ${((options.anatole_style_post_title_lower!'true')=='true')?string('checked','')}> 开启
</label>
<label class="radio-inline">
<input type="radio" name="anatole_style_post_title_lower" id="anatoleStylePostTitleLower" value="false" ${((options.anatole_style_post_title_lower!)=='false')?string('checked','')}> 关闭
</label>
</div>
</div>
<div class="form-group">
<label for="anatoleStyleBlogTitleLower" class="col-sm-4 control-label">博客标题大写:</label>
<div class="col-sm-8">
<label class="radio-inline">
<input type="radio" name="anatole_style_blog_title_lower" id="anatoleStyleBlogTitleLower" value="true" ${((options.anatole_style_blog_title_lower!'true')=='true')?string('checked','')}> 开启
</label>
<label class="radio-inline">
<input type="radio" name="anatole_style_blog_title_lower" id="anatoleStyleBlogTitleLower" value="false" ${((options.anatole_style_blog_title_lower!)=='false')?string('checked','')}> 关闭
</label>
</div>
</div>
<div class="form-group">
<label for="anatoleStyleAvatarCircle" class="col-sm-4 control-label">圆形头像:</label>
<div class="col-sm-8">
<label class="radio-inline">
<input type="radio" name="anatole_style_avatar_circle" id="anatoleStyleAvatarCircle" value="true" ${((options.anatole_style_avatar_circle!)=='true')?string('checked','')}> 开启
</label>
<label class="radio-inline">
<input type="radio" name="anatole_style_avatar_circle" id="anatoleStyleAvatarCircle" value="false" ${((options.anatole_style_avatar_circle!'false')=='false')?string('checked','')}> 关闭
</label>
</div>
</div>
<div class="form-group">
<label for="anatoleStyleHitokoto" class="col-sm-4 control-label">博客描述开启一言:</label>
<div class="col-sm-8">
<label class="radio-inline">
<input type="radio" name="anatole_style_hitokoto" id="anatoleStyleHitokoto" value="true" ${((options.anatole_style_hitokoto!)=='true')?string('checked','')}> 开启
</label>
<label class="radio-inline">
<input type="radio" name="anatole_style_hitokoto" id="anatoleStyleHitokoto" value="false" ${((options.anatole_style_hitokoto!'false')=='false')?string('checked','')}> 关闭
</label>
</div>
</div>
<div class="form-group">
<label for="anatoleStyleGoogleColor" class="col-sm-4 control-label">浏览器沉浸颜色:</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="anatoleStyleGoogleColor" name="anatole_style_google_color" value="${options.anatole_style_google_color!'#fff'}" >
</div>
</div>
<div class="form-group">
<label for="anatoleStyleScrollbar" class="col-sm-4 control-label">全局滚动条颜色:</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="anatoleStyleScrollbar" name="anatole_style_scrollbar" value="${options.anatole_style_scrollbar!'#3798e8'}" >
</div>
</div>
<div class="form-group">
<label for="anatoleStyleSelf" class="col-sm-4 control-label">自定义样式:</label>
<div class="col-sm-8">
<textarea class="form-control" rows="3" id="anatoleStyleSelf" name="anatole_style_self" style="resize: none">${options.anatole_style_self!}</textarea>
</div>
</div>
</div>
<div class="box-footer">
<button type="button" class="btn btn-primary btn-sm pull-right" onclick="saveThemeOptions('anatoleStyleOptions')">保存设置</button>
</div>
</form>
</div>
<!-- 关于该主题 -->
<div class="tab-pane" id="about">
<div class="box box-widget widget-user-2">
<div class="widget-user-header bg-blue">
<div class="widget-user-image">
<img class="img-circle" src="/anatole/source/images/logo@2x.png" alt="User Avatar">
</div>
<h3 class="widget-user-username">CAICAI</h3>
<h5 class="widget-user-desc">A other farbox theme</h5>
</div>
<div class="box-footer no-padding">
<ul class="nav nav-stacked">
<li><a target="_blank" href="https://www.caicai.me/">作者主页</a></li>
<li><a target="_blank" href="https://github.com/hi-caicai/farbox-theme-Anatole">原主题地址</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<@option.import_js />

View File

@ -15,7 +15,7 @@
</li>
</div>
<div class="avatar">
<img src="${settings.icon!'/anatole/source/images/logo.png'}" />
<img src="${settings.icon!'/${theme.folderName}/source/images/logo.png'}" />
</div>
</div>
</div>

View File

@ -1,7 +1,7 @@
<div class="sidebar animated fadeInDown">
<div class="logo-title">
<div class="title">
<img src="${options.blog_logo!'/anatole/source/images/logo@2x.png'}" style="width:127px;<#if settings.avatar_circle!false>border-radius:50%</#if>" />
<img src="${options.blog_logo!'/${theme.folderName}/source/images/logo@2x.png'}" style="width:127px;<#if settings.avatar_circle!false>border-radius:50%</#if>" />
<h3 title="">
<a href="${options.blog_url!}">${options.blog_title!'Anatole'}</a>
</h3>

View File

@ -2,7 +2,7 @@
<@head title="${post.title!} · ${options.blog_title!'Halo'}" keywords="${post.title!},${options.seo_keywords!'Halo'},${tagWords!}" description="${post.summary!'Halo'}"></@head>
<#include "module/sidebar.ftl">
<div class="main">
<link href="/anatole/source/plugins/prism/prism.css" type="text/css" rel="stylesheet" />
<link href="/${theme.folderName}/source/plugins/prism/prism.css" type="text/css" rel="stylesheet" />
<style>
code, tt {
font-size: 1.2em;
@ -98,5 +98,5 @@
</div>
</div>
</div>
<script type="text/javascript" src="/anatole/source/plugins/prism/prism.js"></script>
<script type="text/javascript" src="/${theme.folderName}/source/plugins/prism/prism.js"></script>
<@footer></@footer>

View File

@ -2,7 +2,7 @@
<@head title="${post.title!} · ${options.blog_title!'Halo'}" keywords="${post.title!},${options.seo_keywords!'Halo'}" description="${post.summary!'Halo'}"></@head>
<#include "module/sidebar.ftl">
<div class="main">
<link href="/anatole/source/plugins/prism/prism.css" type="text/css" rel="stylesheet" />
<link href="/${theme.folderName}/source/plugins/prism/prism.css" type="text/css" rel="stylesheet" />
<style>
code, tt {
font-size: 1.2em;
@ -78,5 +78,5 @@
</div>
</div>
</div>
<script type="text/javascript" src="/anatole/source/plugins/prism/prism.js"></script>
<script type="text/javascript" src="/${theme.folderName}/source/plugins/prism/prism.js"></script>
<@footer></@footer>