diff --git a/CHANGELOG.md b/CHANGELOG.md index f2e1754c..f60007c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 540b9b1f..03e64c27 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -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 解析文档的配置 diff --git a/exampleSite/content/posts/theme-documentation-basics/index.en.md b/exampleSite/content/posts/theme-documentation-basics/index.en.md index f0f23aa9..7293e73c 100644 --- a/exampleSite/content/posts/theme-documentation-basics/index.en.md +++ b/exampleSite/content/posts/theme-documentation-basics/index.en.md @@ -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] diff --git a/exampleSite/content/posts/theme-documentation-basics/index.zh-cn.md b/exampleSite/content/posts/theme-documentation-basics/index.zh-cn.md index 26a36d2c..f81c16ba 100644 --- a/exampleSite/content/posts/theme-documentation-basics/index.zh-cn.md +++ b/exampleSite/content/posts/theme-documentation-basics/index.zh-cn.md @@ -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] diff --git a/i18n/de.toml b/i18n/de.toml index a520f725..8f51a231 100644 --- a/i18n/de.toml +++ b/i18n/de.toml @@ -14,6 +14,9 @@ other = "" # waitting for translation [devEnvWarn] other = "" # waitting for translation + +[quicklyUpgrade] +other = "" # waitting for translation # === init === # === baseof === diff --git a/i18n/en.toml b/i18n/en.toml index 753dea8e..064b6acd 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -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 === diff --git a/i18n/es.toml b/i18n/es.toml index 7160c4de..a336abc2 100644 --- a/i18n/es.toml +++ b/i18n/es.toml @@ -14,6 +14,9 @@ other = "" # waitting for translation [devEnvWarn] other = "" # waitting for translation + +[quicklyUpgrade] +other = "" # waitting for translation # === init === # === baseof === diff --git a/i18n/fr.toml b/i18n/fr.toml index 70b3bc58..61bbe670 100644 --- a/i18n/fr.toml +++ b/i18n/fr.toml @@ -14,6 +14,9 @@ other = "" # waitting for translation [devEnvWarn] other = "" # waitting for translation + +[quicklyUpgrade] +other = "" # waitting for translation # === init === # === baseof === diff --git a/i18n/it.toml b/i18n/it.toml index 10f82afe..2c3b1a65 100644 --- a/i18n/it.toml +++ b/i18n/it.toml @@ -14,6 +14,9 @@ other = "" # waitting for translation [devEnvWarn] other = "" # waitting for translation + +[quicklyUpgrade] +other = "" # waitting for translation # === init === # === baseof === diff --git a/i18n/pl.toml b/i18n/pl.toml index 69879f7e..97194519 100644 --- a/i18n/pl.toml +++ b/i18n/pl.toml @@ -14,6 +14,9 @@ other = "" # waitting for translation [devEnvWarn] other = "" # waitting for translation + +[quicklyUpgrade] +other = "" # waitting for translation # === init === # === baseof === diff --git a/i18n/pt-BR.toml b/i18n/pt-BR.toml index da828cc4..2750c313 100644 --- a/i18n/pt-BR.toml +++ b/i18n/pt-BR.toml @@ -14,6 +14,9 @@ other = "" # waitting for translation [devEnvWarn] other = "" # waitting for translation + +[quicklyUpgrade] +other = "" # waitting for translation # === init === # === baseof === diff --git a/i18n/ro.toml b/i18n/ro.toml index 1f346c5e..c311959d 100644 --- a/i18n/ro.toml +++ b/i18n/ro.toml @@ -14,6 +14,9 @@ other = "" # waitting for translation [devEnvWarn] other = "" # waitting for translation + +[quicklyUpgrade] +other = "" # waitting for translation # === init === # === baseof === diff --git a/i18n/ru.toml b/i18n/ru.toml index d75b4d9f..0dcf93ef 100644 --- a/i18n/ru.toml +++ b/i18n/ru.toml @@ -14,6 +14,9 @@ other = "" # waitting for translation [devEnvWarn] other = "" # waitting for translation + +[quicklyUpgrade] +other = "" # waitting for translation # === init === # === baseof === diff --git a/i18n/sr.toml b/i18n/sr.toml index 2b2a7f89..38283829 100644 --- a/i18n/sr.toml +++ b/i18n/sr.toml @@ -14,6 +14,9 @@ other = "" # waitting for translation [devEnvWarn] other = "" # waitting for translation + +[quicklyUpgrade] +other = "" # waitting for translation # === init === # === baseof === diff --git a/i18n/vi.toml b/i18n/vi.toml index e7a4c6aa..ceadfb7b 100644 --- a/i18n/vi.toml +++ b/i18n/vi.toml @@ -13,6 +13,9 @@ other = "" # waitting for translation [devEnvWarn] other = "" # waitting for translation + +[quicklyUpgrade] +other = "" # waitting for translation # === init === # === baseof === diff --git a/i18n/zh-CN.toml b/i18n/zh-CN.toml index cf772403..a98718d6 100644 --- a/i18n/zh-CN.toml +++ b/i18n/zh-CN.toml @@ -14,6 +14,9 @@ other = "您正在使用开发版的 FixIt,请考虑使用稳定版。\n见 ht [devEnvWarn] other = "当前运行环境是“development”。“评论系统”,“CDN”和“fingerprint”不会启用。" + +[quicklyUpgrade] +other = "使用命令快速升级:cd themes/FixIt && sh fixit_checker.sh" # === init === # === baseof === diff --git a/i18n/zh-TW.toml b/i18n/zh-TW.toml index 4d7156fc..e22cc1f0 100644 --- a/i18n/zh-TW.toml +++ b/i18n/zh-TW.toml @@ -14,6 +14,9 @@ other = "您正在使用開發版的 FixIt,請考慮使用穩定版。\n見 ht [devEnvWarn] other = "當前運行環境是“development”。“評論系統”,“CDN”和“fingerprint”不會啟用。" + +[quicklyUpgrade] +other = "使用命令快速升級:cd themes/FixIt && sh fixit_checker.sh" # === init === # === baseof === diff --git a/layouts/partials/init/detection-deprecated.html b/layouts/partials/init/detection-deprecated.html index 5368c536..5796e6c4 100644 --- a/layouts/partials/init/detection-deprecated.html +++ b/layouts/partials/init/detection-deprecated.html @@ -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 -}} \ No newline at end of file diff --git a/layouts/partials/init/detection-env.html b/layouts/partials/init/detection-env.html index 0eddabd3..2ace279f 100644 --- a/layouts/partials/init/detection-env.html +++ b/layouts/partials/init/detection-env.html @@ -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 -}} \ No newline at end of file diff --git a/layouts/partials/init/detection-version.html b/layouts/partials/init/detection-version.html index 9758aee5..db4826a9 100644 --- a/layouts/partials/init/detection-version.html +++ b/layouts/partials/init/detection-version.html @@ -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 -}} diff --git a/layouts/partials/init/index.html b/layouts/partials/init/index.html index f4558de0..39293383 100644 --- a/layouts/partials/init/index.html +++ b/layouts/partials/init/index.html @@ -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" . -}}