Feat: add developer options

This commit is contained in:
Cell
2022-07-17 15:03:23 +08:00
parent c0346d18a7
commit 624585267a
21 changed files with 92 additions and 15 deletions
+1
View File
@@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file.
- :sparkles: Feat: enhance auto toc feature ([#104](https://github.com/Lruihao/FixIt/issues/104) [#136](https://github.com/Lruihao/FixIt/issues/136))
- :sparkles: Feat(SEO): add options to make output baidu_urls.txt file ([#138](https://github.com/Lruihao/FixIt/issues/138))
- :sparkles: Feat: add repost feature ([#156](https://github.com/Lruihao/FixIt/issues/156))
- :sparkles: Feat: add developer options
- :bug: Fix: unable to show search bar of header at mobile mode ([#143](https://github.com/Lruihao/FixIt/issues/143))
- :bug: Fix: Giscus comments invalid config `inputPosition`
- :bug: Fix: busuanzi logic error
+10
View File
@@ -1163,6 +1163,16 @@ enableEmoji = true
# Gravatar 主机,默认:“www.gravatar.com”
host = "www.gravatar.com" # "cn.gravatar.com", "gravatar.loli.net"
style = "mp" # "", mp, identicon, monsterid, wavatar, retro, blank, robohash
# Developer options since v0.2.15
# 开发者选项 since v0.2.15
[params.developerOptions]
enable = false
# Check for updates
# 检查更新
c4u = false
# Please do not expose to public!
# 请勿公开展示!
githubToken = ""
# Markup related configuration in Hugo
# Hugo 解析文档的配置
@@ -202,8 +202,8 @@ Please open the code block below to view the complete sample configuration :(fa-
```toml
[params]
# {{< version 0.2.0 changed >}} FixIt theme version
version = "0.2.X"
# {{< version 0.2.15 changed >}} FixIt theme version
version = "0.2.X" # e.g. "0.2.X", "0.2.15", "v0.2.15"
# site description
description = "This is My New Hugo Site"
# site keywords
@@ -839,6 +839,13 @@ Please open the code block below to view the complete sample configuration :(fa-
# Gravatar host, default: "www.gravatar.com"
host = "www.gravatar.com" # "cn.gravatar.com", "gravatar.loli.net"
style = "" # "", mp, identicon, monsterid, wavatar, retro, blank, robohash
# {{< version 0.2.15 >}} Developer options
[params.developerOptions]
enable = false
# Check for updates
c4u = false
# Please do not expose to public!
githubToken = ""
# Markup related configuration in Hugo
[markup]
@@ -204,8 +204,8 @@ hugo
```toml
[params]
# {{< version 0.2.0 changed >}} FixIt 主题版本
version = "0.2.X"
# {{< version 0.2.15 changed >}} FixIt 主题版本
version = "0.2.X" # e.g. "0.2.X", "0.2.15", "v0.2.15"
# 网站描述
description = "这是我的全新 Hugo 网站"
# 网站关键词
@@ -840,6 +840,13 @@ hugo
# Gravatar 主机,默认:“www.gravatar.com”
host = "www.gravatar.com" # "cn.gravatar.com", "gravatar.loli.net"
style = "" # "", mp, identicon, monsterid, wavatar, retro, blank, robohash
# {{< version 0.2.15 >}} 开发者选项
[params.developerOptions]
enable = false
# 检查更新
c4u = false
# 请勿公开展示!
githubToken = ""
# Hugo 解析文档的配置
[markup]
+3
View File
@@ -14,6 +14,9 @@ other = "" # waitting for translation
[devEnvWarn]
other = "" # waitting for translation
[quicklyUpgrade]
other = "" # waitting for translation
# === init ===
# === baseof ===
+3
View File
@@ -13,6 +13,9 @@ other = "You are using a development version of FixIt. Please consider using a s
[devEnvWarn]
other = "Current environment is \"development\". The \"comment system\", \"CDN\" and \"fingerprint\" will be disabled."
[quicklyUpgrade]
other = "Quickly upgrade use bash: cd themes/FixIt && sh fixit_checker.sh"
# === init ===
# === baseof ===
+3
View File
@@ -14,6 +14,9 @@ other = "" # waitting for translation
[devEnvWarn]
other = "" # waitting for translation
[quicklyUpgrade]
other = "" # waitting for translation
# === init ===
# === baseof ===
+3
View File
@@ -14,6 +14,9 @@ other = "" # waitting for translation
[devEnvWarn]
other = "" # waitting for translation
[quicklyUpgrade]
other = "" # waitting for translation
# === init ===
# === baseof ===
+3
View File
@@ -14,6 +14,9 @@ other = "" # waitting for translation
[devEnvWarn]
other = "" # waitting for translation
[quicklyUpgrade]
other = "" # waitting for translation
# === init ===
# === baseof ===
+3
View File
@@ -14,6 +14,9 @@ other = "" # waitting for translation
[devEnvWarn]
other = "" # waitting for translation
[quicklyUpgrade]
other = "" # waitting for translation
# === init ===
# === baseof ===
+3
View File
@@ -14,6 +14,9 @@ other = "" # waitting for translation
[devEnvWarn]
other = "" # waitting for translation
[quicklyUpgrade]
other = "" # waitting for translation
# === init ===
# === baseof ===
+3
View File
@@ -14,6 +14,9 @@ other = "" # waitting for translation
[devEnvWarn]
other = "" # waitting for translation
[quicklyUpgrade]
other = "" # waitting for translation
# === init ===
# === baseof ===
+3
View File
@@ -14,6 +14,9 @@ other = "" # waitting for translation
[devEnvWarn]
other = "" # waitting for translation
[quicklyUpgrade]
other = "" # waitting for translation
# === init ===
# === baseof ===
+3
View File
@@ -14,6 +14,9 @@ other = "" # waitting for translation
[devEnvWarn]
other = "" # waitting for translation
[quicklyUpgrade]
other = "" # waitting for translation
# === init ===
# === baseof ===
+3
View File
@@ -13,6 +13,9 @@ other = "" # waitting for translation
[devEnvWarn]
other = "" # waitting for translation
[quicklyUpgrade]
other = "" # waitting for translation
# === init ===
# === baseof ===
+3
View File
@@ -14,6 +14,9 @@ other = "您正在使用开发版的 FixIt,请考虑使用稳定版。\n见 ht
[devEnvWarn]
other = "当前运行环境是“development”。“评论系统”,“CDN”和“fingerprint”不会启用。"
[quicklyUpgrade]
other = "使用命令快速升级:cd themes/FixIt && sh fixit_checker.sh"
# === init ===
# === baseof ===
+3
View File
@@ -14,6 +14,9 @@ other = "您正在使用開發版的 FixIt,請考慮使用穩定版。\n見 ht
[devEnvWarn]
other = "當前運行環境是“development”。“評論系統”,“CDN”和“fingerprint”不會啟用。"
[quicklyUpgrade]
other = "使用命令快速升級:cd themes/FixIt && sh fixit_checker.sh"
# === init ===
# === baseof ===
@@ -8,5 +8,5 @@
{{- $warnErrors = $warnErrors | append "The parameter `ibruce.siteTime` is deprecated since v0.2.14, use `footer.siteTime` instead." -}}
{{- end -}}
{{- if len $warnErrors -}}
{{- warnf "Deprecated parameter detection until %v\n - %v" (.Scratch.Get "version") (delimit $warnErrors "\n - ") -}}
{{- warnf "Deprecated parameter detection until %v\n - %v\n\n" (.Scratch.Get "version") (delimit $warnErrors "\n - ") -}}
{{- end -}}
+1 -1
View File
@@ -22,5 +22,5 @@
{{- .Scratch.Set "comment" dict -}}
{{- end -}}
{{- else if eq .Site .Sites.First -}}
{{- warnf "FixIt %v\n%v" (.Scratch.Get "version") (T "devEnvWarn") -}}
{{- warnf "FixIt %v\n%v\n\n" (.Scratch.Get "version") (T "devEnvWarn") -}}
{{- end -}}
+21 -9
View File
@@ -1,17 +1,29 @@
{{- /* FixIt theme version detection */ -}}
{{- $version := "v0.2.15-RC" -}}
{{ $header := dict "Authorization" "token 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" }}
{{ $latest := (getJSON "https://api.github.com/repos/Lruihao/FixIt/releases/latest" $header).tag_name }}
{{- $latest := $version -}}
{{- $developerOptions := .Scratch.Get "developerOptions" -}}
{{- if eq .Site .Sites.First -}}
{{- if (strings.HasSuffix $version "RC") -}}
{{- warnf "FixIt %v\n%v" $version (T "RCVersionWarn") -}}
{{- /* Check for updates */ -}}
{{- if $developerOptions.enable | and $developerOptions.c4u -}}
{{- /* Select the scope named "public_repo" to generate personal access token */ -}}
{{- $header := dict "Authorization" "" -}}
{{- with $developerOptions.githubtoken -}}
{{- $header = dict "Authorization" (printf "token %v" .) -}}
{{- end -}}
{{- $latest = (getJSON "https://api.github.com/repos/Lruihao/FixIt/releases/latest" $header).tag_name -}}
{{- end -}}
{{- /* FixIt theme version detection */ -}}
{{- if eq .Site .Sites.First -}}
{{- if not .Site.Params.version -}}
{{- errorf "FixIt %v\n%v" $version (T "configurationError") -}}
{{- errorf "FixIt %v\n%v\n\n" $version (T "configurationError") -}}
{{- else if gt "0.2.0" (strings.TrimPrefix "v" .Site.Params.version) -}}
{{- errorf "FixIt %v\n%v" $version (dict "From" .Site.Params.version "To" $version | T "compatibilityError") -}}
{{- errorf "FixIt %v\n%v\n\n" $version (dict "From" .Site.Params.version "To" $version | T "compatibilityError") -}}
{{- end -}}
{{- if (strings.HasSuffix $version "RC") -}}
{{- warnf "FixIt %v\n%v\n\n" $version (T "RCVersionWarn") -}}
{{- end -}}
{{- if (gt $latest $version) -}}
{{- warnf "FixIt %v (⬆️ %v)\n%v\n\n" $version $latest (T "quicklyUpgrade") -}}
{{- end -}}
{{- end -}}
+1
View File
@@ -1,4 +1,5 @@
{{- .Scratch.Set "params" (.Params | merge .Site.Params.page) -}}
{{- .Scratch.Set "developerOptions" (.Site.Params.developerOptions | default dict) -}}
{{- .Scratch.Set "this" dict -}}
{{- partial "init/detection-version.html" . -}}