From f324c43c21c987f14a74c7f2ec110a38f8f85dc7 Mon Sep 17 00:00:00 2001 From: Jactor-Sue Date: Sun, 4 Nov 2018 11:17:15 +0800 Subject: [PATCH 1/8] add gitalk comment system --- _config.yml | 12 + layout/_partials/comments.swig | 5 + layout/_third-party/comments/gitalk.swig | 17 ++ layout/_third-party/comments/index.swig | 1 + .../components/third-party/gitalk.styl | 4 + .../components/third-party/third-party.styl | 1 + source/js/src/md5.js | 280 ++++++++++++++++++ 7 files changed, 320 insertions(+) create mode 100644 layout/_third-party/comments/gitalk.swig create mode 100644 source/css/_common/components/third-party/gitalk.styl create mode 100644 source/js/src/md5.js diff --git a/_config.yml b/_config.yml index ba5570316a..ce253bfdd2 100644 --- a/_config.yml +++ b/_config.yml @@ -537,6 +537,18 @@ gitment: proxy_gateway: # Address of api proxy, See: https://github.com/aimingoo/intersect redirect_protocol: # Protocol of redirect_uri with force_redirect_protocol when mint enabled +# Gitalk +# Demo: https://gitalk.github.io +# Reference: https://asdfv1929.github.io/2018/01/20/gitalk/, https://liujunzhou.cn/2018/8/10/gitalk-error/#more +gitalk: + enable: false + githubID: # Github repo owner + repo: # Repository name to store issues. + ClientID: # Github Application Client ID + ClientSecret: # Github Application Client Secret + adminUser: # GitHub repo owner and collaborators, only these guys can initialize github issues + distractionFreeMode: true # Facebook-like distraction free mode + # Baidu Share # Available value: # button | slide diff --git a/layout/_partials/comments.swig b/layout/_partials/comments.swig index b690b1f894..ccfde49e83 100644 --- a/layout/_partials/comments.swig +++ b/layout/_partials/comments.swig @@ -48,6 +48,11 @@ {% elseif theme.valine.enable and theme.valine.appid and theme.valine.appkey %}
+ + {% elseif theme.gitalk.enable %} +
+
+ {% endif %} {% endif %} diff --git a/layout/_third-party/comments/gitalk.swig b/layout/_third-party/comments/gitalk.swig new file mode 100644 index 0000000000..6c1a6c2dc0 --- /dev/null +++ b/layout/_third-party/comments/gitalk.swig @@ -0,0 +1,17 @@ +{% if page.comments && theme.gitalk.enable %} + + + + +{% endif %} \ No newline at end of file diff --git a/layout/_third-party/comments/index.swig b/layout/_third-party/comments/index.swig index f5ebccba40..0812777665 100644 --- a/layout/_third-party/comments/index.swig +++ b/layout/_third-party/comments/index.swig @@ -3,3 +3,4 @@ {% include 'changyan.swig' %} {% include 'gitment.swig' %} {% include 'valine.swig' %} +{% include 'gitalk.swig' %} \ No newline at end of file diff --git a/source/css/_common/components/third-party/gitalk.styl b/source/css/_common/components/third-party/gitalk.styl new file mode 100644 index 0000000000..fed0206821 --- /dev/null +++ b/source/css/_common/components/third-party/gitalk.styl @@ -0,0 +1,4 @@ +.gt-header a, .gt-comments a, .gt-popup a + border-bottom: none; +.gt-container .gt-popup .gt-action.is--active:before + top: 0.7em; \ No newline at end of file diff --git a/source/css/_common/components/third-party/third-party.styl b/source/css/_common/components/third-party/third-party.styl index cb14c9f4d2..2a0fc6abcb 100644 --- a/source/css/_common/components/third-party/third-party.styl +++ b/source/css/_common/components/third-party/third-party.styl @@ -5,3 +5,4 @@ @import "algolia-search" if hexo-config('algolia_search.enable'); @import "needsharebutton" if hexo-config('needmoreshare2.enable'); @import "related-posts" if hexo-config('related_posts.enable'); +@import "gitalk" if hexo-config('gitalk.enable'); diff --git a/source/js/src/md5.js b/source/js/src/md5.js new file mode 100644 index 0000000000..762de3c520 --- /dev/null +++ b/source/js/src/md5.js @@ -0,0 +1,280 @@ +/* + * JavaScript MD5 + * https://github.com/blueimp/JavaScript-MD5 + * + * Copyright 2011, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + * + * Based on + * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message + * Digest Algorithm, as defined in RFC 1321. + * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009 + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * Distributed under the BSD License + * See http://pajhome.org.uk/crypt/md5 for more info. + */ + +/* global define */ + +;(function ($) { + 'use strict' + + /* + * Add integers, wrapping at 2^32. This uses 16-bit operations internally + * to work around bugs in some JS interpreters. + */ + function safeAdd (x, y) { + var lsw = (x & 0xffff) + (y & 0xffff) + var msw = (x >> 16) + (y >> 16) + (lsw >> 16) + return (msw << 16) | (lsw & 0xffff) + } + + /* + * Bitwise rotate a 32-bit number to the left. + */ + function bitRotateLeft (num, cnt) { + return (num << cnt) | (num >>> (32 - cnt)) + } + + /* + * These functions implement the four basic operations the algorithm uses. + */ + function md5cmn (q, a, b, x, s, t) { + return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b) + } + function md5ff (a, b, c, d, x, s, t) { + return md5cmn((b & c) | (~b & d), a, b, x, s, t) + } + function md5gg (a, b, c, d, x, s, t) { + return md5cmn((b & d) | (c & ~d), a, b, x, s, t) + } + function md5hh (a, b, c, d, x, s, t) { + return md5cmn(b ^ c ^ d, a, b, x, s, t) + } + function md5ii (a, b, c, d, x, s, t) { + return md5cmn(c ^ (b | ~d), a, b, x, s, t) + } + + /* + * Calculate the MD5 of an array of little-endian words, and a bit length. + */ + function binlMD5 (x, len) { + /* append padding */ + x[len >> 5] |= 0x80 << (len % 32) + x[((len + 64) >>> 9 << 4) + 14] = len + + var i + var olda + var oldb + var oldc + var oldd + var a = 1732584193 + var b = -271733879 + var c = -1732584194 + var d = 271733878 + + for (i = 0; i < x.length; i += 16) { + olda = a + oldb = b + oldc = c + oldd = d + + a = md5ff(a, b, c, d, x[i], 7, -680876936) + d = md5ff(d, a, b, c, x[i + 1], 12, -389564586) + c = md5ff(c, d, a, b, x[i + 2], 17, 606105819) + b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330) + a = md5ff(a, b, c, d, x[i + 4], 7, -176418897) + d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426) + c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341) + b = md5ff(b, c, d, a, x[i + 7], 22, -45705983) + a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416) + d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417) + c = md5ff(c, d, a, b, x[i + 10], 17, -42063) + b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162) + a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682) + d = md5ff(d, a, b, c, x[i + 13], 12, -40341101) + c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290) + b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329) + + a = md5gg(a, b, c, d, x[i + 1], 5, -165796510) + d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632) + c = md5gg(c, d, a, b, x[i + 11], 14, 643717713) + b = md5gg(b, c, d, a, x[i], 20, -373897302) + a = md5gg(a, b, c, d, x[i + 5], 5, -701558691) + d = md5gg(d, a, b, c, x[i + 10], 9, 38016083) + c = md5gg(c, d, a, b, x[i + 15], 14, -660478335) + b = md5gg(b, c, d, a, x[i + 4], 20, -405537848) + a = md5gg(a, b, c, d, x[i + 9], 5, 568446438) + d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690) + c = md5gg(c, d, a, b, x[i + 3], 14, -187363961) + b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501) + a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467) + d = md5gg(d, a, b, c, x[i + 2], 9, -51403784) + c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473) + b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734) + + a = md5hh(a, b, c, d, x[i + 5], 4, -378558) + d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463) + c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562) + b = md5hh(b, c, d, a, x[i + 14], 23, -35309556) + a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060) + d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353) + c = md5hh(c, d, a, b, x[i + 7], 16, -155497632) + b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640) + a = md5hh(a, b, c, d, x[i + 13], 4, 681279174) + d = md5hh(d, a, b, c, x[i], 11, -358537222) + c = md5hh(c, d, a, b, x[i + 3], 16, -722521979) + b = md5hh(b, c, d, a, x[i + 6], 23, 76029189) + a = md5hh(a, b, c, d, x[i + 9], 4, -640364487) + d = md5hh(d, a, b, c, x[i + 12], 11, -421815835) + c = md5hh(c, d, a, b, x[i + 15], 16, 530742520) + b = md5hh(b, c, d, a, x[i + 2], 23, -995338651) + + a = md5ii(a, b, c, d, x[i], 6, -198630844) + d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415) + c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905) + b = md5ii(b, c, d, a, x[i + 5], 21, -57434055) + a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571) + d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606) + c = md5ii(c, d, a, b, x[i + 10], 15, -1051523) + b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799) + a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359) + d = md5ii(d, a, b, c, x[i + 15], 10, -30611744) + c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380) + b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649) + a = md5ii(a, b, c, d, x[i + 4], 6, -145523070) + d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379) + c = md5ii(c, d, a, b, x[i + 2], 15, 718787259) + b = md5ii(b, c, d, a, x[i + 9], 21, -343485551) + + a = safeAdd(a, olda) + b = safeAdd(b, oldb) + c = safeAdd(c, oldc) + d = safeAdd(d, oldd) + } + return [a, b, c, d] + } + + /* + * Convert an array of little-endian words to a string + */ + function binl2rstr (input) { + var i + var output = '' + var length32 = input.length * 32 + for (i = 0; i < length32; i += 8) { + output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xff) + } + return output + } + + /* + * Convert a raw string to an array of little-endian words + * Characters >255 have their high-byte silently ignored. + */ + function rstr2binl (input) { + var i + var output = [] + output[(input.length >> 2) - 1] = undefined + for (i = 0; i < output.length; i += 1) { + output[i] = 0 + } + var length8 = input.length * 8 + for (i = 0; i < length8; i += 8) { + output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << (i % 32) + } + return output + } + + /* + * Calculate the MD5 of a raw string + */ + function rstrMD5 (s) { + return binl2rstr(binlMD5(rstr2binl(s), s.length * 8)) + } + + /* + * Calculate the HMAC-MD5, of a key and some data (raw strings) + */ + function rstrHMACMD5 (key, data) { + var i + var bkey = rstr2binl(key) + var ipad = [] + var opad = [] + var hash + ipad[15] = opad[15] = undefined + if (bkey.length > 16) { + bkey = binlMD5(bkey, key.length * 8) + } + for (i = 0; i < 16; i += 1) { + ipad[i] = bkey[i] ^ 0x36363636 + opad[i] = bkey[i] ^ 0x5c5c5c5c + } + hash = binlMD5(ipad.concat(rstr2binl(data)), 512 + data.length * 8) + return binl2rstr(binlMD5(opad.concat(hash), 512 + 128)) + } + + /* + * Convert a raw string to a hex string + */ + function rstr2hex (input) { + var hexTab = '0123456789abcdef' + var output = '' + var x + var i + for (i = 0; i < input.length; i += 1) { + x = input.charCodeAt(i) + output += hexTab.charAt((x >>> 4) & 0x0f) + hexTab.charAt(x & 0x0f) + } + return output + } + + /* + * Encode a string as utf-8 + */ + function str2rstrUTF8 (input) { + return unescape(encodeURIComponent(input)) + } + + /* + * Take string arguments and return either raw or hex encoded strings + */ + function rawMD5 (s) { + return rstrMD5(str2rstrUTF8(s)) + } + function hexMD5 (s) { + return rstr2hex(rawMD5(s)) + } + function rawHMACMD5 (k, d) { + return rstrHMACMD5(str2rstrUTF8(k), str2rstrUTF8(d)) + } + function hexHMACMD5 (k, d) { + return rstr2hex(rawHMACMD5(k, d)) + } + + function md5 (string, key, raw) { + if (!key) { + if (!raw) { + return hexMD5(string) + } + return rawMD5(string) + } + if (!raw) { + return hexHMACMD5(key, string) + } + return rawHMACMD5(key, string) + } + + if (typeof define === 'function' && define.amd) { + define(function () { + return md5 + }) + } else if (typeof module === 'object' && module.exports) { + module.exports = md5 + } else { + $.md5 = md5 + } +})(this) From 1a87fc3cb4ecb0a8d69aada68c4bec9468bad5fe Mon Sep 17 00:00:00 2001 From: Jactor-Sue Date: Sun, 4 Nov 2018 21:38:06 +0800 Subject: [PATCH 2/8] update cdn for gitalk --- _config.yml | 19 ++++++++++----- layout/_third-party/comments/gitalk.swig | 30 ++++++++++++------------ 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/_config.yml b/_config.yml index ce253bfdd2..7807f8ad2b 100644 --- a/_config.yml +++ b/_config.yml @@ -541,13 +541,20 @@ gitment: # Demo: https://gitalk.github.io # Reference: https://asdfv1929.github.io/2018/01/20/gitalk/, https://liujunzhou.cn/2018/8/10/gitalk-error/#more gitalk: - enable: false - githubID: # Github repo owner + enable: true + github_id: # Github repo owner repo: # Repository name to store issues. - ClientID: # Github Application Client ID - ClientSecret: # Github Application Client Secret - adminUser: # GitHub repo owner and collaborators, only these guys can initialize github issues - distractionFreeMode: true # Facebook-like distraction free mode + client_id: # Github Application Client ID + client_secret: # Github Application Client Secret + admin_user: # GitHub repo owner and collaborators, only these guys can initialize github issues + distraction_free_mode: true # Facebook-like distraction free mode + ## CDN for Gitalk + gitalk_cdn_prefix: https://unpkg.com/gitalk/dist/ + # gitalk_cdn_prefix: https://cdn.bootcss.com/gitalk/1.4.0/ + # gitalk_cdn_prefix: https://cdnjs.cloudflare.com/ajax/libs/gitalk/1.4.0/ + ## CDN for MD5 + md5_cdn: https://cdnjs.cloudflare.com/ajax/libs/blueimp-md5/2.10.0/js/md5.min.js + # md5CDN: https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.min.js # Baidu Share # Available value: diff --git a/layout/_third-party/comments/gitalk.swig b/layout/_third-party/comments/gitalk.swig index 6c1a6c2dc0..c54f85a4b4 100644 --- a/layout/_third-party/comments/gitalk.swig +++ b/layout/_third-party/comments/gitalk.swig @@ -1,17 +1,17 @@ {% if page.comments && theme.gitalk.enable %} - - - - + + + + {% endif %} \ No newline at end of file From 44ddb5617a7c5ef15733daa75b277da7f39bb88a Mon Sep 17 00:00:00 2001 From: Jactor-Sue Date: Thu, 8 Nov 2018 23:20:59 +0800 Subject: [PATCH 3/8] update vendors config and fix typos --- _config.yml | 22 ++++++++++++++-------- layout/_third-party/comments/gitalk.swig | 22 +++++++++++++++++++--- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/_config.yml b/_config.yml index 7807f8ad2b..296f31c42b 100644 --- a/_config.yml +++ b/_config.yml @@ -541,20 +541,13 @@ gitment: # Demo: https://gitalk.github.io # Reference: https://asdfv1929.github.io/2018/01/20/gitalk/, https://liujunzhou.cn/2018/8/10/gitalk-error/#more gitalk: - enable: true + enable: false github_id: # Github repo owner repo: # Repository name to store issues. client_id: # Github Application Client ID client_secret: # Github Application Client Secret admin_user: # GitHub repo owner and collaborators, only these guys can initialize github issues distraction_free_mode: true # Facebook-like distraction free mode - ## CDN for Gitalk - gitalk_cdn_prefix: https://unpkg.com/gitalk/dist/ - # gitalk_cdn_prefix: https://cdn.bootcss.com/gitalk/1.4.0/ - # gitalk_cdn_prefix: https://cdnjs.cloudflare.com/ajax/libs/gitalk/1.4.0/ - ## CDN for MD5 - md5_cdn: https://cdnjs.cloudflare.com/ajax/libs/blueimp-md5/2.10.0/js/md5.min.js - # md5CDN: https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.min.js # Baidu Share # Available value: @@ -1028,6 +1021,19 @@ vendors: # Example: https://cdn.jsdelivr.net/npm/valine@1.1.8/dist/Valine.min.js valine: + # Internal version: + # See: + # Examples: + # gitalk_js: https://cdn.bootcss.com/gitalk/1.4.0/gitalk.min.js + # gitalk_css: https://cdn.bootcss.com/gitalk/1.4.0/gitalk.css + gitalk_js: + gitalk_css: + + # Internal version: 2.10.0 + # See: https://github.com/blueimp/JavaScript-MD5 + # Example: + # md5: https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.min.js + md5: # Assets css: css diff --git a/layout/_third-party/comments/gitalk.swig b/layout/_third-party/comments/gitalk.swig index c54f85a4b4..4d2fc6822d 100644 --- a/layout/_third-party/comments/gitalk.swig +++ b/layout/_third-party/comments/gitalk.swig @@ -1,7 +1,23 @@ {% if page.comments && theme.gitalk.enable %} - - - + + {% set gitalk_js_url = "//cdn.bootcss.com/gitalk/1.4.0/gitalk.min.js" %} + {% if theme.vendors.gitalk_js %} + {% set gitalk_js_url = theme.vendors.gitalk_js %} + {% endif %} + + + {% set gitalk_css_url = "//cdn.bootcss.com/gitalk/1.4.0/gitalk.css" %} + {% if theme.vendors.gitalk_css %} + {% set gitalk_css_url = theme.vendors.gitalk_css %} + {% endif %} + + + {% set md5_url = "//cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.min.js" %} + {% if theme.vendors.md5 %} + {% set md5_url = theme.vendors.md5 %} + {% endif %} + + - {% set gitalk_css_url = "//cdn.bootcss.com/gitalk/1.4.0/gitalk.css" %} + {% set gitalk_css_url = "//cdn.jsdelivr.net/npm/gitalk@1.4.0/dist/gitalk.css" %} {% if theme.vendors.gitalk_css %} {% set gitalk_css_url = theme.vendors.gitalk_css %} {% endif %} From f51cd84fcbd57e6aaf090c420c7643bbce9f06ba Mon Sep 17 00:00:00 2001 From: Jactor-Sue Date: Sat, 10 Nov 2018 09:39:17 +0800 Subject: [PATCH 6/8] Revert "update cdn source" This reverts commit 8175b469323c6f8ebb14c5b2022c026ca92e8a02. --- _config.yml | 29 ++++++++---------------- layout/_third-party/comments/gitalk.swig | 4 ++-- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/_config.yml b/_config.yml index 8ab33b0ecd..296f31c42b 100644 --- a/_config.yml +++ b/_config.yml @@ -540,21 +540,13 @@ gitment: # Gitalk # Demo: https://gitalk.github.io # Reference: https://asdfv1929.github.io/2018/01/20/gitalk/, https://liujunzhou.cn/2018/8/10/gitalk-error/#more -# gitalk: -# enable: false -# github_id: # Github repo owner -# repo: # Repository name to store issues. -# client_id: # Github Application Client ID -# client_secret: # Github Application Client Secret -# admin_user: # GitHub repo owner and collaborators, only these guys can initialize github issues -# distraction_free_mode: true # Facebook-like distraction free mode gitalk: - enable: true - github_id: Jactor-Sue # Github repo owner - repo: Jactor-Sue.github.io # Repository name to store issues. - client_id: 58fa2e0d1d9986df9611 # Github Application Client ID - client_secret: fda9924ebbf38a9aa8788921635544417cc6b875 # Github Application Client Secret - admin_user: Jactor-Sue # GitHub repo owner and collaborators, only these guys can initialize github issues + enable: false + github_id: # Github repo owner + repo: # Repository name to store issues. + client_id: # Github Application Client ID + client_secret: # Github Application Client Secret + admin_user: # GitHub repo owner and collaborators, only these guys can initialize github issues distraction_free_mode: true # Facebook-like distraction free mode # Baidu Share @@ -1029,11 +1021,11 @@ vendors: # Example: https://cdn.jsdelivr.net/npm/valine@1.1.8/dist/Valine.min.js valine: - # Internal version: 1.4.0 - # See: https://github.com/gitalk/gitalk + # Internal version: + # See: # Examples: - # gitalk_js: https://cdn.jsdelivr.net/npm/gitalk@1.4.0/dist/gitalk.min.js - # gitalk_css: https://cdn.jsdelivr.net/npm/gitalk@1.4.0/dist/gitalk.css + # gitalk_js: https://cdn.bootcss.com/gitalk/1.4.0/gitalk.min.js + # gitalk_css: https://cdn.bootcss.com/gitalk/1.4.0/gitalk.css gitalk_js: gitalk_css: @@ -1041,7 +1033,6 @@ vendors: # See: https://github.com/blueimp/JavaScript-MD5 # Example: # md5: https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.min.js - # md5: https://cdn.jsdelivr.net/npm/js-md5@0.7.3/src/md5.min.js md5: # Assets diff --git a/layout/_third-party/comments/gitalk.swig b/layout/_third-party/comments/gitalk.swig index 2585cd031c..4d2fc6822d 100644 --- a/layout/_third-party/comments/gitalk.swig +++ b/layout/_third-party/comments/gitalk.swig @@ -1,12 +1,12 @@ {% if page.comments && theme.gitalk.enable %} - {% set gitalk_js_url = "//cdn.jsdelivr.net/npm/gitalk@1.4.0/dist/gitalk.min.js" %} + {% set gitalk_js_url = "//cdn.bootcss.com/gitalk/1.4.0/gitalk.min.js" %} {% if theme.vendors.gitalk_js %} {% set gitalk_js_url = theme.vendors.gitalk_js %} {% endif %} - {% set gitalk_css_url = "//cdn.jsdelivr.net/npm/gitalk@1.4.0/dist/gitalk.css" %} + {% set gitalk_css_url = "//cdn.bootcss.com/gitalk/1.4.0/gitalk.css" %} {% if theme.vendors.gitalk_css %} {% set gitalk_css_url = theme.vendors.gitalk_css %} {% endif %} From bb48d51e3284f984a4a1c13c0b0f9edde1e94b52 Mon Sep 17 00:00:00 2001 From: Jactor-Sue Date: Sat, 10 Nov 2018 10:00:12 +0800 Subject: [PATCH 7/8] update cdn source --- _config.yml | 8 ++++---- layout/_third-party/comments/gitalk.swig | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/_config.yml b/_config.yml index 296f31c42b..08631b0d34 100644 --- a/_config.yml +++ b/_config.yml @@ -1021,11 +1021,11 @@ vendors: # Example: https://cdn.jsdelivr.net/npm/valine@1.1.8/dist/Valine.min.js valine: - # Internal version: - # See: + # Internal version: 1.4.0 + # See: https://github.com/gitalk/gitalk # Examples: - # gitalk_js: https://cdn.bootcss.com/gitalk/1.4.0/gitalk.min.js - # gitalk_css: https://cdn.bootcss.com/gitalk/1.4.0/gitalk.css + # gitalk_js: https://cdn.jsdelivr.net/npm/gitalk@1.4.0/dist/gitalk.min.js + # gitalk_css: https://cdn.jsdelivr.net/npm/gitalk@1.4.0/dist/gitalk.css gitalk_js: gitalk_css: diff --git a/layout/_third-party/comments/gitalk.swig b/layout/_third-party/comments/gitalk.swig index 4d2fc6822d..2585cd031c 100644 --- a/layout/_third-party/comments/gitalk.swig +++ b/layout/_third-party/comments/gitalk.swig @@ -1,12 +1,12 @@ {% if page.comments && theme.gitalk.enable %} - {% set gitalk_js_url = "//cdn.bootcss.com/gitalk/1.4.0/gitalk.min.js" %} + {% set gitalk_js_url = "//cdn.jsdelivr.net/npm/gitalk@1.4.0/dist/gitalk.min.js" %} {% if theme.vendors.gitalk_js %} {% set gitalk_js_url = theme.vendors.gitalk_js %} {% endif %} - {% set gitalk_css_url = "//cdn.bootcss.com/gitalk/1.4.0/gitalk.css" %} + {% set gitalk_css_url = "//cdn.jsdelivr.net/npm/gitalk@1.4.0/dist/gitalk.css" %} {% if theme.vendors.gitalk_css %} {% set gitalk_css_url = theme.vendors.gitalk_css %} {% endif %} From 3d2ec8eea98c21178311789f30d3077be0f9ce47 Mon Sep 17 00:00:00 2001 From: Jactor-Sue Date: Sat, 10 Nov 2018 22:34:00 +0800 Subject: [PATCH 8/8] update md5 cdn --- _config.yml | 6 +++--- layout/_third-party/comments/gitalk.swig | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/_config.yml b/_config.yml index 23fe3f9dd0..f72ee1fffc 100644 --- a/_config.yml +++ b/_config.yml @@ -1051,10 +1051,10 @@ vendors: gitalk_js: gitalk_css: - # Internal version: 2.10.0 - # See: https://github.com/blueimp/JavaScript-MD5 + # Internal version: 0.7.3 + # See: https://github.com/emn178/js-md5/ # Example: - # md5: https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.min.js + # md5: https://cdn.jsdelivr.net/npm/js-md5@0.7.3/src/md5.min.js md5: # Assets diff --git a/layout/_third-party/comments/gitalk.swig b/layout/_third-party/comments/gitalk.swig index 2585cd031c..265578b811 100644 --- a/layout/_third-party/comments/gitalk.swig +++ b/layout/_third-party/comments/gitalk.swig @@ -12,7 +12,7 @@ {% endif %} - {% set md5_url = "//cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.min.js" %} + {% set md5_url = "//cdn.jsdelivr.net/npm/js-md5@0.7.3/src/md5.min.js" %} {% if theme.vendors.md5 %} {% set md5_url = theme.vendors.md5 %} {% endif %}