From bb8d05bbed81ba4b12a53b56e68c6994701a5056 Mon Sep 17 00:00:00 2001 From: ppoffice Date: Tue, 24 Dec 2019 18:05:37 -0500 Subject: [PATCH] refactor(schema): specs to schema --- .eslintrc.json | 1 + include/helper/cdn.js | 6 ++ include/schema/comment/changyan.json | 4 +- include/schema/comment/disqusjs.json | 6 +- include/schema/comment/gitalk.json | 20 +++--- include/schema/comment/gitment.json | 12 ++-- include/schema/comment/livere.json | 4 +- include/schema/comment/valine.json | 14 ++--- include/schema/donate/alipay.json | 20 ++++++ include/schema/donate/buymeacoffee.json | 20 ++++++ include/schema/donate/patreon.json | 20 ++++++ include/schema/donate/paypal.json | 25 ++++++++ include/schema/donate/wechat.json | 20 ++++++ include/schema/misc/meta.json | 10 +++ include/schema/misc/open_graph.json | 63 +++++++++++++++++++ include/schema/misc/poly_links.json | 40 ++++++++++++ include/schema/plugin/animejs.json | 7 +++ include/schema/plugin/back_to_top.json | 7 +++ include/schema/plugin/baidu_analytics.json | 15 +++++ include/schema/plugin/busuanzi.json | 7 +++ include/schema/plugin/gallery.json | 7 +++ include/schema/plugin/google_analytics.json | 15 +++++ include/schema/plugin/hotjar.json | 15 +++++ include/schema/plugin/katex.json | 7 +++ include/schema/plugin/mathjax.json | 7 +++ include/schema/plugin/outdated_browser.json | 7 +++ include/schema/plugin/progressbar.json | 7 +++ include/schema/search/baidu.json | 15 +++++ include/schema/search/google_cse.json | 20 ++++++ include/schema/search/insight.json | 15 +++++ include/schema/share/addthis.json | 20 ++++++ include/schema/share/addtoany.json | 15 +++++ include/schema/share/bdshare.json | 15 +++++ include/schema/share/sharejs.json | 15 +++++ include/schema/share/sharethis.json | 20 ++++++ include/schema/widget/archives.json | 15 +++++ include/schema/widget/categories.json | 15 +++++ include/schema/widget/links.json | 25 ++++++++ include/schema/widget/profile.json | 43 +++++++++++++ include/schema/widget/recent_posts.json | 15 +++++ include/schema/widget/subscribe_email.json | 24 +++++++ include/schema/widget/tags.json | 15 +++++ include/schema/widget/toc.json | 15 +++++ languages/en.yml | 1 + languages/zh-CN.yml | 1 + layout/comment/changyan.jsx | 4 +- layout/comment/disqusjs.jsx | 6 +- layout/comment/gitalk.jsx | 16 ++--- layout/comment/gitment.jsx | 8 +-- layout/comment/valine.jsx | 16 ++--- layout/common/article.jsx | 2 +- layout/common/head.jsx | 16 ++--- layout/donate/buymeacoffee.jsx | 34 ++++++++++ layout/donate/patreon.jsx | 2 +- layout/plugin/busuanzi.jsx | 2 +- layout/plugin/katex.jsx | 33 ++++++++++ layout/plugin/mathjax.jsx | 2 +- .../search/{google-cse.jsx => google_cse.jsx} | 0 layout/share/addthis.jsx | 2 +- layout/share/addtoany.jsx | 2 +- layout/share/sharethis.jsx | 2 +- 61 files changed, 769 insertions(+), 68 deletions(-) create mode 100644 include/schema/donate/alipay.json create mode 100644 include/schema/donate/buymeacoffee.json create mode 100644 include/schema/donate/patreon.json create mode 100644 include/schema/donate/paypal.json create mode 100644 include/schema/donate/wechat.json create mode 100644 include/schema/misc/meta.json create mode 100644 include/schema/misc/open_graph.json create mode 100644 include/schema/misc/poly_links.json create mode 100644 include/schema/plugin/animejs.json create mode 100644 include/schema/plugin/back_to_top.json create mode 100644 include/schema/plugin/baidu_analytics.json create mode 100644 include/schema/plugin/busuanzi.json create mode 100644 include/schema/plugin/gallery.json create mode 100644 include/schema/plugin/google_analytics.json create mode 100644 include/schema/plugin/hotjar.json create mode 100644 include/schema/plugin/katex.json create mode 100644 include/schema/plugin/mathjax.json create mode 100644 include/schema/plugin/outdated_browser.json create mode 100644 include/schema/plugin/progressbar.json create mode 100644 include/schema/search/baidu.json create mode 100644 include/schema/search/google_cse.json create mode 100644 include/schema/search/insight.json create mode 100644 include/schema/share/addthis.json create mode 100644 include/schema/share/addtoany.json create mode 100644 include/schema/share/bdshare.json create mode 100644 include/schema/share/sharejs.json create mode 100644 include/schema/share/sharethis.json create mode 100644 include/schema/widget/archives.json create mode 100644 include/schema/widget/categories.json create mode 100644 include/schema/widget/links.json create mode 100644 include/schema/widget/profile.json create mode 100644 include/schema/widget/recent_posts.json create mode 100644 include/schema/widget/subscribe_email.json create mode 100644 include/schema/widget/tags.json create mode 100644 include/schema/widget/toc.json create mode 100644 layout/donate/buymeacoffee.jsx create mode 100644 layout/plugin/katex.jsx rename layout/search/{google-cse.jsx => google_cse.jsx} (100%) diff --git a/.eslintrc.json b/.eslintrc.json index f14130b..a554032 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -40,6 +40,7 @@ "ignore": [ "class", "onclick", + "onload", "onsubmit" ] } diff --git a/include/helper/cdn.js b/include/helper/cdn.js index 242573c..7d06346 100644 --- a/include/helper/cdn.js +++ b/include/helper/cdn.js @@ -53,6 +53,12 @@ module.exports = function(hexo) { if (_package === 'clipboard') { _package = 'clipboard.js'; } + if (_package === 'disqusjs') { + provider = 'jsdelivr'; + } + if (_package === 'katex') { + _package = 'KaTeX.js'; + } } if (provider !== null && provider in cdn_providers) { provider = cdn_providers[provider]; diff --git a/include/schema/comment/changyan.json b/include/schema/comment/changyan.json index 0e9a439..a10ee29 100644 --- a/include/schema/comment/changyan.json +++ b/include/schema/comment/changyan.json @@ -8,7 +8,7 @@ "type": "string", "const": "changyan" }, - "appid": { + "app_id": { "type": "string", "description": "Changyan app ID" }, @@ -19,7 +19,7 @@ }, "required": [ "type", - "appid", + "app_id", "conf" ] } \ No newline at end of file diff --git a/include/schema/comment/disqusjs.json b/include/schema/comment/disqusjs.json index 336f187..33ebaf5 100644 --- a/include/schema/comment/disqusjs.json +++ b/include/schema/comment/disqusjs.json @@ -12,7 +12,7 @@ "type": "string", "description": "Disqus shortname" }, - "apiKey": { + "api_key": { "description": "Disqus application API key", "anyOf": [ { @@ -36,7 +36,7 @@ "type": "string", "description": "Disqus moderator username" }, - "adminLabel": { + "admin_label": { "type": "string", "description": "Disqus moderator badge text", "default": false @@ -50,6 +50,6 @@ "required": [ "type", "shortname", - "apiKey" + "api_key" ] } \ No newline at end of file diff --git a/include/schema/comment/gitalk.json b/include/schema/comment/gitalk.json index 2e85739..1d6986a 100644 --- a/include/schema/comment/gitalk.json +++ b/include/schema/comment/gitalk.json @@ -8,11 +8,11 @@ "type": "string", "const": "gitalk" }, - "clientId": { + "client_id": { "type": "string", "description": "GitHub application client ID" }, - "clientSecret": { + "client_secret": { "type": "string", "description": "GitHub application client secret" }, @@ -31,22 +31,22 @@ "type": "string" } }, - "perPage": { + "per_page": { "type": "number", "description": "Pagination size, with maximum 100", "default": 10 }, - "distractionFreeMode": { + "distraction_free_mode": { "type": "boolean", "description": "Facebook-like distraction free mode", "default": false }, - "pagerDirection": { + "pager_direction": { "type": "string", "description": "Comment sorting direction, available values are `last` and `first`", "default": "last" }, - "createIssueManually": { + "create_issue_manually": { "type": "boolean", "description": "Create GitHub issues manually for each page", "default": false @@ -55,11 +55,11 @@ "type": "string", "description": "GitHub oauth request reverse proxy for CORS" }, - "flipMoveOptions": { + "flip_move_options": { "type": "object", "description": "Comment list animation" }, - "enableHotKey": { + "enable_hotkey": { "type": "boolean", "description": "Enable hot key (cmd|ctrl + enter) submit comment", "default": true @@ -67,8 +67,8 @@ }, "required": [ "type", - "clientId", - "clientSecret", + "client_id", + "client_secret", "repo", "owner", "admin" diff --git a/include/schema/comment/gitment.json b/include/schema/comment/gitment.json index 28251d5..b220fc1 100644 --- a/include/schema/comment/gitment.json +++ b/include/schema/comment/gitment.json @@ -16,11 +16,11 @@ "type": "string", "description": "The repository to store your comments. Make sure you're repo's owner" }, - "clientId": { + "client_id": { "type": "string", "description": "GitHub client ID" }, - "clientSecret": { + "client_secret": { "type": "string", "description": "GitHub client secret" }, @@ -29,12 +29,12 @@ "description": "An optional Gitment theme object", "default": "gitment.defaultTheme" }, - "perPage": { + "per_page": { "type": "number", "description": "An optional number to which comments will be paginated", "default": 20 }, - "maxCommentHeight": { + "max_comment_height": { "type": "number", "description": "An optional number to limit comments' max height, over which comments will be folded", "default": 250 @@ -44,7 +44,7 @@ "type", "owner", "repo", - "clientId", - "clientSecret" + "client_id", + "client_secret" ] } \ No newline at end of file diff --git a/include/schema/comment/livere.json b/include/schema/comment/livere.json index 9199f35..1459882 100644 --- a/include/schema/comment/livere.json +++ b/include/schema/comment/livere.json @@ -8,13 +8,13 @@ "type": "string", "const": "livere" }, - "url": { + "uid": { "type": "string", "description": "LiveRe comment service UID" } }, "required": [ "type", - "url" + "uid" ] } \ No newline at end of file diff --git a/include/schema/comment/valine.json b/include/schema/comment/valine.json index 507890e..46bede8 100644 --- a/include/schema/comment/valine.json +++ b/include/schema/comment/valine.json @@ -8,11 +8,11 @@ "type": "string", "const": "valine" }, - "appId": { + "app_id": { "type": "string", "description": "Application from Leancloud" }, - "appKey": { + "app_key": { "type": "string", "description": "Application from Leancloud" }, @@ -46,7 +46,7 @@ ], "default": "mm" }, - "avatarForce": { + "avatar_force": { "type": "boolean", "description": "Pull the latest avatar upon page visit", "default": false @@ -63,7 +63,7 @@ "link" ] }, - "pageSize": { + "page_size": { "type": "integer", "description": "Number of comments per page", "default": 10 @@ -78,7 +78,7 @@ "description": "Enable code highlighting", "default": true }, - "recordIP": { + "record_ip": { "type": "boolean", "description": "Record reviewer IP address", "default": false @@ -86,7 +86,7 @@ }, "required": [ "type", - "appId", - "appKey" + "app_id", + "app_key" ] } \ No newline at end of file diff --git a/include/schema/donate/alipay.json b/include/schema/donate/alipay.json new file mode 100644 index 0000000..3ba2aa2 --- /dev/null +++ b/include/schema/donate/alipay.json @@ -0,0 +1,20 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/donate/alipay.json", + "description": "Alipay donate button configurations", + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "alipay" + }, + "qrcode": { + "type": "string", + "description": "Alipay qrcode image URL" + } + }, + "required": [ + "type", + "qrcode" + ] +} \ No newline at end of file diff --git a/include/schema/donate/buymeacoffee.json b/include/schema/donate/buymeacoffee.json new file mode 100644 index 0000000..dfc19db --- /dev/null +++ b/include/schema/donate/buymeacoffee.json @@ -0,0 +1,20 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/donate/buymeacoffee.json", + "description": "\"Buy me a coffee\" donate button configurations", + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "patreon" + }, + "url": { + "type": "string", + "description": "URL to the \"Buy me a coffee\" page" + } + }, + "required": [ + "type", + "url" + ] +} \ No newline at end of file diff --git a/include/schema/donate/patreon.json b/include/schema/donate/patreon.json new file mode 100644 index 0000000..f3c2c9c --- /dev/null +++ b/include/schema/donate/patreon.json @@ -0,0 +1,20 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/donate/patreon.json", + "description": "Patreon donate button configurations", + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "patreon" + }, + "url": { + "type": "string", + "description": "URL to the Patreon page" + } + }, + "required": [ + "type", + "url" + ] +} \ No newline at end of file diff --git a/include/schema/donate/paypal.json b/include/schema/donate/paypal.json new file mode 100644 index 0000000..72eda1d --- /dev/null +++ b/include/schema/donate/paypal.json @@ -0,0 +1,25 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/donate/paypal.json", + "description": "Paypal donate button configurations", + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "paypal" + }, + "business": { + "type": "string", + "description": "Paypal business ID or email address" + }, + "currency_code": { + "type": "string", + "description": "Currency code" + } + }, + "required": [ + "type", + "business", + "currencyCode" + ] +} \ No newline at end of file diff --git a/include/schema/donate/wechat.json b/include/schema/donate/wechat.json new file mode 100644 index 0000000..a50cfc0 --- /dev/null +++ b/include/schema/donate/wechat.json @@ -0,0 +1,20 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/donate/wechat.json", + "description": "Wechat donate button configurations", + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "wechat" + }, + "qrcode": { + "type": "string", + "description": "Wechat qrcode image URL" + } + }, + "required": [ + "type", + "qrcode" + ] +} \ No newline at end of file diff --git a/include/schema/misc/meta.json b/include/schema/misc/meta.json new file mode 100644 index 0000000..fa83261 --- /dev/null +++ b/include/schema/misc/meta.json @@ -0,0 +1,10 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/misc/meta.json", + "description": "Additional HTML meta tags in an array", + "type": "array", + "items": { + "type": "string", + "description": "Meta tag specified in = style\nE.g., name=theme-color;content=#123456 => " + } +} \ No newline at end of file diff --git a/include/schema/misc/open_graph.json b/include/schema/misc/open_graph.json new file mode 100644 index 0000000..d08142f --- /dev/null +++ b/include/schema/misc/open_graph.json @@ -0,0 +1,63 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/misc/open_graph.json", + "description": "Open Graph metadata\nhttps://hexo.io/docs/helpers.html#open-graph", + "type": "object", + "properties": { + "title": { + "type": "string", + "description": "Page title (og:title)" + }, + "type": { + "type": "string", + "description": "Page type (og:type)", + "default": "blog" + }, + "url": { + "type": "string", + "description": "Page URL (og:url)" + }, + "image": { + "type": [ + "string", + "array" + ], + "description": "Page cover (og:image)", + "items": { + "type": "string" + } + }, + "site_name": { + "type": "string", + "description": "Site name (og:site_name)" + }, + "description": { + "type": "string", + "description": "Page description (og:description)" + }, + "twitter_card": { + "type": "string", + "description": "Twitter card type (twitter:card)" + }, + "twitter_id": { + "type": "string", + "description": "Twitter ID (twitter:creator)" + }, + "twitter_site": { + "type": "string", + "description": "Twitter ID (twitter:creator)" + }, + "google_plus": { + "type": "string", + "description": "Google+ profile link (deprecated)" + }, + "fb_admins": { + "type": "string", + "description": "Facebook admin ID" + }, + "fb_app_id": { + "type": "string", + "description": "Facebook App ID" + } + } +} \ No newline at end of file diff --git a/include/schema/misc/poly_links.json b/include/schema/misc/poly_links.json new file mode 100644 index 0000000..4b260dc --- /dev/null +++ b/include/schema/misc/poly_links.json @@ -0,0 +1,40 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/misc/poly_links.json", + "description": "A polymorphic link", + "type": "object", + "patternProperties": { + ".+": { + "type": [ + "string", + "object" + ], + "description": "URL or path of the link, with/without the icon element class name", + "properties": { + "url": { + "type": "string", + "description": "URL or path of the link" + }, + "icon": { + "type": "string", + "description": "Icon element class name" + } + }, + "required": [ + "url", + "icon" + ] + } + }, + "examples": [ + { + "My GitHub Page": "https://github.com/ppoffice" + }, + { + "My GitHub Page": { + "url": "https://github.com/ppoffice", + "icon": "fab fa-github" + } + } + ] +} \ No newline at end of file diff --git a/include/schema/plugin/animejs.json b/include/schema/plugin/animejs.json new file mode 100644 index 0000000..1773190 --- /dev/null +++ b/include/schema/plugin/animejs.json @@ -0,0 +1,7 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/plugin/animejs.json", + "description": "Enable page startup animations", + "type": "boolean", + "default": true +} \ No newline at end of file diff --git a/include/schema/plugin/back_to_top.json b/include/schema/plugin/back_to_top.json new file mode 100644 index 0000000..eb0e618 --- /dev/null +++ b/include/schema/plugin/back_to_top.json @@ -0,0 +1,7 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/plugin/back_to_top.json", + "description": "Show the \"back to top\" button", + "type": "boolean", + "default": true +} \ No newline at end of file diff --git a/include/schema/plugin/baidu_analytics.json b/include/schema/plugin/baidu_analytics.json new file mode 100644 index 0000000..5073ed1 --- /dev/null +++ b/include/schema/plugin/baidu_analytics.json @@ -0,0 +1,15 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/plugin/baidu_analytics.json", + "description": "Baidu Analytics plugin settings\nhttps://tongji.baidu.com", + "type": "object", + "properties": { + "tracking_id": { + "type": "object", + "description": "Baidu Analytics tracking ID" + } + }, + "required": [ + "tracking_id" + ] +} \ No newline at end of file diff --git a/include/schema/plugin/busuanzi.json b/include/schema/plugin/busuanzi.json new file mode 100644 index 0000000..a9f4d27 --- /dev/null +++ b/include/schema/plugin/busuanzi.json @@ -0,0 +1,7 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/plugin/busuanzi.json", + "description": "BuSuanZi site/page view counter\nhttps://busuanzi.ibruce.info", + "type": "boolean", + "default": false +} \ No newline at end of file diff --git a/include/schema/plugin/gallery.json b/include/schema/plugin/gallery.json new file mode 100644 index 0000000..b8aa3c0 --- /dev/null +++ b/include/schema/plugin/gallery.json @@ -0,0 +1,7 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/plugin/gallery.json", + "description": "Enable the lightGallery and Justified Gallery plugins\nhttps://ppoffice.github.io/hexo-theme-icarus/Plugins/General/gallery-plugin/", + "type": "boolean", + "default": true +} \ No newline at end of file diff --git a/include/schema/plugin/google_analytics.json b/include/schema/plugin/google_analytics.json new file mode 100644 index 0000000..5cdd790 --- /dev/null +++ b/include/schema/plugin/google_analytics.json @@ -0,0 +1,15 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/plugin/google_analytics.json", + "description": "Google Analytics plugin settings\nhttps://analytics.google.com", + "type": "object", + "properties": { + "tracking_id": { + "type": "object", + "description": "Google Analytics tracking ID" + } + }, + "required": [ + "tracking_id" + ] +} \ No newline at end of file diff --git a/include/schema/plugin/hotjar.json b/include/schema/plugin/hotjar.json new file mode 100644 index 0000000..788c7b8 --- /dev/null +++ b/include/schema/plugin/hotjar.json @@ -0,0 +1,15 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/plugin/hotjar.json", + "description": "Hotjar user feedback plugin\nhttps://www.hotjar.com/", + "type": "object", + "properties": { + "site_id": { + "type": [ + "string", + "number" + ], + "description": "Hotjar site id" + } + } +} \ No newline at end of file diff --git a/include/schema/plugin/katex.json b/include/schema/plugin/katex.json new file mode 100644 index 0000000..2991b62 --- /dev/null +++ b/include/schema/plugin/katex.json @@ -0,0 +1,7 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/plugin/katex.json", + "description": "Enable the KaTeX math typesetting supprot\nhttps://katex.org/", + "type": "boolean", + "default": false +} \ No newline at end of file diff --git a/include/schema/plugin/mathjax.json b/include/schema/plugin/mathjax.json new file mode 100644 index 0000000..26387e8 --- /dev/null +++ b/include/schema/plugin/mathjax.json @@ -0,0 +1,7 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/plugin/mathjax.json", + "description": "Enable the MathJax math typesetting support\nhttps://www.mathjax.org/", + "type": "boolean", + "default": false +} \ No newline at end of file diff --git a/include/schema/plugin/outdated_browser.json b/include/schema/plugin/outdated_browser.json new file mode 100644 index 0000000..35554ea --- /dev/null +++ b/include/schema/plugin/outdated_browser.json @@ -0,0 +1,7 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/plugin/outdated_browser.json", + "description": "Enable the Outdated Browser plugin\nhttp://outdatedbrowser.com/", + "type": "boolean", + "default": true +} \ No newline at end of file diff --git a/include/schema/plugin/progressbar.json b/include/schema/plugin/progressbar.json new file mode 100644 index 0000000..6ad74d1 --- /dev/null +++ b/include/schema/plugin/progressbar.json @@ -0,0 +1,7 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/plugin/progressbar.json", + "description": "Show a progress bar at top of the page on page loading", + "type": "boolean", + "default": true +} \ No newline at end of file diff --git a/include/schema/search/baidu.json b/include/schema/search/baidu.json new file mode 100644 index 0000000..7b390cd --- /dev/null +++ b/include/schema/search/baidu.json @@ -0,0 +1,15 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/search/baidu.json", + "description": "Enable Baidu search", + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "baidu" + } + }, + "required": [ + "type" + ] +} \ No newline at end of file diff --git a/include/schema/search/google_cse.json b/include/schema/search/google_cse.json new file mode 100644 index 0000000..a2afe12 --- /dev/null +++ b/include/schema/search/google_cse.json @@ -0,0 +1,20 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/search/google_cse.json", + "description": "Enable Google CSE\nhttps://cse.google.com/cse/create/new", + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "google_cse" + }, + "cx": { + "type": "string", + "description": "Google CSE cx value" + } + }, + "required": [ + "type", + "cx" + ] +} \ No newline at end of file diff --git a/include/schema/search/insight.json b/include/schema/search/insight.json new file mode 100644 index 0000000..45ebf7b --- /dev/null +++ b/include/schema/search/insight.json @@ -0,0 +1,15 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/search/insight.json", + "description": "Enable Insight search\nhttps://ppoffice.github.io/hexo-theme-icarus/Plugins/Search/insight-search-plugin/", + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "insight" + } + }, + "required": [ + "type" + ] +} \ No newline at end of file diff --git a/include/schema/share/addthis.json b/include/schema/share/addthis.json new file mode 100644 index 0000000..603866e --- /dev/null +++ b/include/schema/share/addthis.json @@ -0,0 +1,20 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/share/addthis.json", + "description": "Enable AddThis share buttons\nhttps://www.addthis.com/", + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "addthis" + }, + "install_url": { + "type": "string", + "description": "URL to the AddThis share plugin script" + } + }, + "required": [ + "type", + "install_url" + ] +} \ No newline at end of file diff --git a/include/schema/share/addtoany.json b/include/schema/share/addtoany.json new file mode 100644 index 0000000..2ed9af7 --- /dev/null +++ b/include/schema/share/addtoany.json @@ -0,0 +1,15 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/share/addtoany.json", + "description": "Enable AddToAny share buttons\nhttps://www.addtoany.com/", + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "addtoany" + } + }, + "required": [ + "type" + ] +} \ No newline at end of file diff --git a/include/schema/share/bdshare.json b/include/schema/share/bdshare.json new file mode 100644 index 0000000..4e310d5 --- /dev/null +++ b/include/schema/share/bdshare.json @@ -0,0 +1,15 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/share/bdshare.json", + "description": "Enable Baidu share buttons", + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "bdshare" + } + }, + "required": [ + "type" + ] +} \ No newline at end of file diff --git a/include/schema/share/sharejs.json b/include/schema/share/sharejs.json new file mode 100644 index 0000000..9b4d330 --- /dev/null +++ b/include/schema/share/sharejs.json @@ -0,0 +1,15 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/share/sharejs.json", + "description": "Enable Share.js share buttons\nhttps://github.com/overtrue/share.js/", + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "sharejs" + } + }, + "required": [ + "type" + ] +} \ No newline at end of file diff --git a/include/schema/share/sharethis.json b/include/schema/share/sharethis.json new file mode 100644 index 0000000..6fc6c51 --- /dev/null +++ b/include/schema/share/sharethis.json @@ -0,0 +1,20 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/share/sharethis.json", + "description": "Enable ShareThis share buttons\nhttps://sharethis.com/", + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "sharethis" + }, + "install_url": { + "type": "string", + "description": "URL to the ShareThis share plugin script" + } + }, + "required": [ + "type", + "install_url" + ] +} \ No newline at end of file diff --git a/include/schema/widget/archives.json b/include/schema/widget/archives.json new file mode 100644 index 0000000..35d9244 --- /dev/null +++ b/include/schema/widget/archives.json @@ -0,0 +1,15 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/widget/archives.json", + "description": "Archives widget configurations", + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "archives" + } + }, + "required": [ + "type" + ] +} \ No newline at end of file diff --git a/include/schema/widget/categories.json b/include/schema/widget/categories.json new file mode 100644 index 0000000..7fc2ec4 --- /dev/null +++ b/include/schema/widget/categories.json @@ -0,0 +1,15 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/widget/categories.json", + "description": "Categories widget configurations", + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "categories" + } + }, + "required": [ + "type" + ] +} \ No newline at end of file diff --git a/include/schema/widget/links.json b/include/schema/widget/links.json new file mode 100644 index 0000000..4d95d0f --- /dev/null +++ b/include/schema/widget/links.json @@ -0,0 +1,25 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/widget/links.json", + "description": "Recommendation links widget configurations", + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "links" + }, + "links": { + "type": "object", + "description": "Names and URLs of the sites", + "patternProperties": { + ".+": { + "type": "string", + "description": "URL of the site" + } + } + } + }, + "required": [ + "type" + ] +} \ No newline at end of file diff --git a/include/schema/widget/profile.json b/include/schema/widget/profile.json new file mode 100644 index 0000000..e0afbdf --- /dev/null +++ b/include/schema/widget/profile.json @@ -0,0 +1,43 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/widget/profile.json", + "description": "Profile widget configurations", + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "profile" + }, + "author": { + "type": "string", + "description": "Author name" + }, + "author_title": { + "type": "string", + "description": "Author title" + }, + "location": { + "type": "string", + "description": "Author's current location" + }, + "avatar": { + "type": "string", + "description": "URL or path to the avatar image" + }, + "gravatar": { + "type": "string", + "description": "Email address for the Gravatar" + }, + "follow_link": { + "type": "string", + "description": "URL or path for the follow button" + }, + "social_links": { + "$ref": "/misc/poly_links.json", + "description": "Links to be shown on the bottom of the profile widget" + } + }, + "required": [ + "type" + ] +} \ No newline at end of file diff --git a/include/schema/widget/recent_posts.json b/include/schema/widget/recent_posts.json new file mode 100644 index 0000000..e19cf11 --- /dev/null +++ b/include/schema/widget/recent_posts.json @@ -0,0 +1,15 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/widget/recent_posts.json", + "description": "Recent posts widget configurations", + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "recent_posts" + } + }, + "required": [ + "type" + ] +} \ No newline at end of file diff --git a/include/schema/widget/subscribe_email.json b/include/schema/widget/subscribe_email.json new file mode 100644 index 0000000..843098e --- /dev/null +++ b/include/schema/widget/subscribe_email.json @@ -0,0 +1,24 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/widget/subscribe_email.json", + "description": "Google FeedBurner email subscription widget configurations", + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "subscribe_email" + }, + "description": { + "type": "string", + "description": "Hint text under the email input" + }, + "feedburner_id": { + "type": "string", + "description": "Feedburner ID" + } + }, + "required": [ + "type", + "feedburner_id" + ] +} \ No newline at end of file diff --git a/include/schema/widget/tags.json b/include/schema/widget/tags.json new file mode 100644 index 0000000..4cb438a --- /dev/null +++ b/include/schema/widget/tags.json @@ -0,0 +1,15 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/widget/tags.json", + "description": "Tags widget configurations", + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "tags" + } + }, + "required": [ + "type" + ] +} \ No newline at end of file diff --git a/include/schema/widget/toc.json b/include/schema/widget/toc.json new file mode 100644 index 0000000..911023e --- /dev/null +++ b/include/schema/widget/toc.json @@ -0,0 +1,15 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "/widget/toc.json", + "description": "Table of contents widget configurations", + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "toc" + } + }, + "required": [ + "type" + ] +} \ No newline at end of file diff --git a/languages/en.yml b/languages/en.yml index a938a03..657939f 100644 --- a/languages/en.yml +++ b/languages/en.yml @@ -34,6 +34,7 @@ donate: wechat: 'Wechat' paypal: 'Paypal' patreon: 'Patreon' + buymeacoffee: 'Buy me a coffee' plugin: backtotop: 'Back to Top' visit: '%s visits' diff --git a/languages/zh-CN.yml b/languages/zh-CN.yml index 7c0846c..af22ef3 100644 --- a/languages/zh-CN.yml +++ b/languages/zh-CN.yml @@ -29,6 +29,7 @@ donate: title: '喜欢这篇文章?打赏一下作者吧' alipay: '支付宝' wechat: '微信' + buymeacoffee: '送我杯咖啡' plugin: backtotop: '回到顶端' visit: '%s次访问' diff --git a/layout/comment/changyan.jsx b/layout/comment/changyan.jsx index 3ddbbad..c8f212d 100644 --- a/layout/comment/changyan.jsx +++ b/layout/comment/changyan.jsx @@ -6,7 +6,7 @@ class ChangeYan extends Component { const { appId, conf, path } = this.props; if (!appId || !conf) { return
- You forgot to set the appid or conf for Changyan. + You forgot to set the app_id or conf for Changyan. Please set it in _config.yml.
; } @@ -23,7 +23,7 @@ module.exports = cacheComponent(ChangeYan, 'comment.changyan', props => { const { comment, page } = props; return { - appId: comment.appid, + appId: comment.app_id, conf: comment.conf, path: page.path }; diff --git a/layout/comment/disqusjs.jsx b/layout/comment/disqusjs.jsx index 9d8cf79..922fb4b 100644 --- a/layout/comment/disqusjs.jsx +++ b/layout/comment/disqusjs.jsx @@ -20,7 +20,7 @@ class DisqusJs extends Component { } = this.props; if (!shortname) { return
- You forgot to set the shortname or apiKey for Disqus. + You forgot to set the shortname or api_key for Disqus. Please set it in _config.yml.
; } @@ -53,10 +53,10 @@ module.exports = cacheComponent(DisqusJs, 'comment.disqusjs', props => { return { path: page.path, shortname: comment.shortname, - apiKey: comment.apiKey, + apiKey: comment.api_key, api: comment.api, admin: comment.admin, - adminLabel: comment.adminLabel, + adminLabel: comment.admin_label, nesting: comment.nesting, disqusId: page.disqusId, permalink: page.permalink, diff --git a/layout/comment/gitalk.jsx b/layout/comment/gitalk.jsx index c655a80..ac41392 100644 --- a/layout/comment/gitalk.jsx +++ b/layout/comment/gitalk.jsx @@ -64,15 +64,15 @@ module.exports = cacheComponent(Gitalk, 'comment.gitalk', props => { repo: comment.repo, owner: comment.owner, admin: comment.admin, - clientId: comment.clientId, - clientSecret: comment.clientSecret, - createIssueManually: comment.createIssueManually, - distractionFreeMode: comment.distractionFreeMode, - pagerDirection: comment.pagerDirection, - perPage: comment.perPage, + clientId: comment.client_id, + clientSecret: comment.client_secret, + createIssueManually: comment.create_issue_manually, + distractionFreeMode: comment.distraction_free_mode, + pagerDirection: comment.pager_direction, + perPage: comment.per_page, proxy: comment.proxy, - flipMoveOptions: comment.flipMoveOptions, - enableHotKey: comment.enableHotKey, + flipMoveOptions: comment.flip_move_options, + enableHotKey: comment.enable_hotkey, cssUrl: helper.cdn('gitalk', '1.4.1', 'dist/gitalk.css'), jsUrl: helper.cdn('gitalk', '1.4.1', 'dist/gitalk.min.js') }; diff --git a/layout/comment/gitment.jsx b/layout/comment/gitment.jsx index 19f803a..faf3061 100644 --- a/layout/comment/gitment.jsx +++ b/layout/comment/gitment.jsx @@ -50,9 +50,9 @@ module.exports = cacheComponent(Gitment, 'comment.gitment', props => { id, repo: comment.repo, owner: comment.owner, - clientId: comment.clientId, - clientSecret: comment.clientSecret, - perPage: comment.perPage, - maxCommentHeight: comment.maxCommentHeight + clientId: comment.client_id, + clientSecret: comment.client_secret, + perPage: comment.per_page, + maxCommentHeight: comment.max_comment_height }; }); diff --git a/layout/comment/valine.jsx b/layout/comment/valine.jsx index 616955b..0f48d95 100644 --- a/layout/comment/valine.jsx +++ b/layout/comment/valine.jsx @@ -15,7 +15,8 @@ class Valine extends Component { pageSize = 10, visitor = false, highlight = true, - recordIP = false + recordIp = false, + jsUrl } = this.props; if (!appId || !appKey) { return
@@ -36,19 +37,19 @@ class Valine extends Component { pageSize: ${pageSize}, visitor: ${visitor}, highlight: ${highlight}, - recordIP: ${recordIP} + recordIP: ${recordIp} });`; return
- +
; } } module.exports = cacheComponent(Valine, 'comment.valine', props => { - const { comment } = props; + const { comment, helper } = props; return { appId: comment.app_id, @@ -57,11 +58,12 @@ module.exports = cacheComponent(Valine, 'comment.valine', props => { verify: comment.verify, placeholder: comment.placeholder, avatar: comment.avatar, - avatarForce: comment.avatarForce, + avatarForce: comment.avatar_force, meta: comment.meta, - pageSize: comment.pageSize, + pageSize: comment.page_size, visitor: comment.visitor, highlight: comment.highlight, - recordIP: comment.recordIP + recordIp: comment.record_ip, + jsUrl: helper.cdn('valine', '1.3.10', 'dist/Valine.min.js') }; }); diff --git a/layout/common/article.jsx b/layout/common/article.jsx index 0d6179e..4e1f3b1 100644 --- a/layout/common/article.jsx +++ b/layout/common/article.jsx @@ -33,7 +33,7 @@ module.exports = class extends Component { }
: null} {/* Metadata */} -
+
{page.layout !== 'page' ?