From 6c94cfb45fd8958c78e3532b32efdfb03efafc54 Mon Sep 17 00:00:00 2001 From: Mimi <1119186082@qq.com> Date: Sat, 28 Nov 2020 15:30:05 +0800 Subject: [PATCH] Remove Valine --- _vendors.yml | 4 --- layout/_partials/post/post-meta.njk | 2 +- layout/_third-party/comments/valine.njk | 12 --------- scripts/events/lib/config.js | 6 +---- scripts/filters/comment/valine.js | 35 ------------------------- 5 files changed, 2 insertions(+), 57 deletions(-) delete mode 100644 layout/_third-party/comments/valine.njk delete mode 100644 scripts/filters/comment/valine.js diff --git a/_vendors.yml b/_vendors.yml index 8a2dff6..cec037f 100644 --- a/_vendors.yml +++ b/_vendors.yml @@ -88,10 +88,6 @@ disqusjs_css: name: disqusjs version: 1.3.0 file: dist/disqusjs.css -valine: - name: valine - version: 1.4.14 - file: dist/Valine.min.js gitalk_js: name: gitalk version: 1.7.0 diff --git a/layout/_partials/post/post-meta.njk b/layout/_partials/post/post-meta.njk index a020fad..fcd5f9a 100644 --- a/layout/_partials/post/post-meta.njk +++ b/layout/_partials/post/post-meta.njk @@ -51,7 +51,7 @@ {%- endif %} {# LeanCloud PageView #} - {%- if theme.leancloud_visitors.enable or (theme.valine and theme.valine.enable and theme.valine.visitor) %} + {%- if theme.leancloud_visitors.enable %} diff --git a/layout/_third-party/comments/valine.njk b/layout/_third-party/comments/valine.njk deleted file mode 100644 index 3e58901..0000000 --- a/layout/_third-party/comments/valine.njk +++ /dev/null @@ -1,12 +0,0 @@ -{%- set serverURLs = theme.valine.serverURLs or 'https://' + theme.valine.appId.slice(0, 8) | lower + '.api.lncldglobal.com' %} - diff --git a/scripts/events/lib/config.js b/scripts/events/lib/config.js index 78d0998..91f6f29 100644 --- a/scripts/events/lib/config.js +++ b/scripts/events/lib/config.js @@ -10,7 +10,7 @@ module.exports = hexo => { hexo.log.warn('Documentation: https://theme-next.js.org/docs/getting-started/configuration.html'); } - const { cache, language_switcher, leancloud_visitors, valine } = hexo.theme.config; + const { cache, language_switcher } = hexo.theme.config; const warning = function(...args) { hexo.log.warn(`Since ${args[0]} is turned on, the ${args[1]} is disabled to avoid potential hazards.`); }; @@ -23,10 +23,6 @@ module.exports = hexo => { warning('caching', '`relative_link` option in Hexo `_config.yml`'); hexo.config.relative_link = false; } - if (leancloud_visitors && leancloud_visitors.enable && valine && valine.enable && valine.visitor) { - warning('valine.visitor', 'leancloud_visitors'); - leancloud_visitors.enable = false; - } hexo.config.meta_generator = false; // Custom languages support. Introduced in NexT v6.3.0. diff --git a/scripts/filters/comment/valine.js b/scripts/filters/comment/valine.js deleted file mode 100644 index c3363b9..0000000 --- a/scripts/filters/comment/valine.js +++ /dev/null @@ -1,35 +0,0 @@ -/* global hexo */ - -'use strict'; - -const path = require('path'); -const { iconText } = require('./common'); - -// Add comment -hexo.extend.filter.register('theme_inject', injects => { - const theme = hexo.theme.config; - if (!theme.valine || !theme.valine.enable || !theme.valine.appId || !theme.valine.appKey) return; - - injects.comment.raw('valine', '
', {}, {cache: true}); - - injects.bodyEnd.file('valine', path.join(hexo.theme_dir, 'layout/_third-party/comments/valine.njk')); - -}); - -// Add post_meta -hexo.extend.filter.register('theme_inject', injects => { - const theme = hexo.theme.config; - if (!theme.valine || !theme.valine.enable || !theme.valine.appId || !theme.valine.appKey) return; - - injects.postMeta.raw('valine', ` - {% if post.comments and (is_post() or theme.valine.comment_count) %} - - {% endif %} - `, {}, {}); - -});