hexo-theme-gnix 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +106 -0
- package/include/hexo/filter/locals.js +109 -0
- package/include/hexo/generator/categories.js +12 -0
- package/include/hexo/generator/category.js +52 -0
- package/include/hexo/generator/insight.js +50 -0
- package/include/hexo/generator/manifest.js +23 -0
- package/include/hexo/generator/tags.js +12 -0
- package/include/hexo/helper/cdn.js +21 -0
- package/include/hexo/helper/page.js +27 -0
- package/include/hexo/view.js +40 -0
- package/include/register.js +11 -0
- package/include/util/common.js +33 -0
- package/languages/en.yml +47 -0
- package/languages/fr.yml +46 -0
- package/languages/ja.yml +46 -0
- package/languages/zh-CN.yml +47 -0
- package/languages/zh-TW.yml +47 -0
- package/layout/archive.jsx +118 -0
- package/layout/categories.jsx +137 -0
- package/layout/category.jsx +38 -0
- package/layout/comment/disqus.jsx +79 -0
- package/layout/comment/disqusjs.jsx +127 -0
- package/layout/comment/giscus.jsx +193 -0
- package/layout/comment/gitalk.jsx +141 -0
- package/layout/comment/twikoo.jsx +63 -0
- package/layout/comment/utterances.jsx +86 -0
- package/layout/comment/valine.jsx +143 -0
- package/layout/comment/waline.jsx +156 -0
- package/layout/common/article.jsx +131 -0
- package/layout/common/article_cover.jsx +33 -0
- package/layout/common/article_media.jsx +34 -0
- package/layout/common/comment.jsx +38 -0
- package/layout/common/footer.jsx +228 -0
- package/layout/common/head.jsx +242 -0
- package/layout/common/navbar.jsx +219 -0
- package/layout/common/plugins.jsx +39 -0
- package/layout/common/scripts.jsx +49 -0
- package/layout/common/search.jsx +22 -0
- package/layout/common/theme_selector.jsx +79 -0
- package/layout/common/toc.jsx +53 -0
- package/layout/index.jsx +29 -0
- package/layout/layout.jsx +34 -0
- package/layout/misc/article_licensing.jsx +114 -0
- package/layout/misc/meta.jsx +61 -0
- package/layout/misc/open_graph.jsx +164 -0
- package/layout/misc/paginator.jsx +90 -0
- package/layout/misc/structured_data.jsx +110 -0
- package/layout/misc/web_app.jsx +106 -0
- package/layout/page.jsx +12 -0
- package/layout/plugin/bing_webmaster.jsx +47 -0
- package/layout/plugin/busuanzi.jsx +40 -0
- package/layout/plugin/clarity.jsx +22 -0
- package/layout/plugin/cookie_consent.jsx +136 -0
- package/layout/plugin/google_analytics.jsx +66 -0
- package/layout/plugin/google_tag_mamager.jsx +41 -0
- package/layout/plugin/netlify.jsx +39 -0
- package/layout/plugin/pjax.jsx +20 -0
- package/layout/plugin/statcounter.jsx +69 -0
- package/layout/plugin/twitter_conversion_tracking.jsx +51 -0
- package/layout/post.jsx +16 -0
- package/layout/search/insight.jsx +53 -0
- package/layout/tag.jsx +29 -0
- package/layout/tags.jsx +55 -0
- package/package.json +42 -0
- package/scripts/index.js +1 -0
- package/source/css/callout_blocks.css +204 -0
- package/source/css/default.css +1590 -0
- package/source/css/font/woff2/Futura-Book.woff2 +0 -0
- package/source/css/font/woff2/Paris2024-Variable.woff2 +0 -0
- package/source/css/font/woff2/doto.woff2 +0 -0
- package/source/css/optional/chinese.css +17 -0
- package/source/css/responsive/desktop.css +164 -0
- package/source/css/responsive/mobile.css +46 -0
- package/source/css/responsive/tablet.css +46 -0
- package/source/css/responsive/touch.css +254 -0
- package/source/css/shiki/shiki.min.css +1 -0
- package/source/css/twikoo.css +2143 -0
- package/source/img/avatar.webp +0 -0
- package/source/img/background.webp +0 -0
- package/source/img/favicon.svg +6 -0
- package/source/img/logo.svg +9 -0
- package/source/img/og_image.png +0 -0
- package/source/js/busuanzi.js +46 -0
- package/source/js/host/cookieconsent/3.1.1/build/cookieconsent.min.css +6 -0
- package/source/js/host/cookieconsent/3.1.1/build/cookieconsent.min.js +1 -0
- package/source/js/host/iconify-icon/3.0.2/iconify-icon.min.js +12 -0
- package/source/js/host/medium-zoom/dist/medium-zoom.min.js +2 -0
- package/source/js/host/mermaid/mermaid.min.js +2811 -0
- package/source/js/host/pjax/0.2.8/pjax.min.js +1 -0
- package/source/js/host/twikoo/1.6.41/dist/twikoo.all.min.js +2 -0
- package/source/js/insight.js +330 -0
- package/source/js/instant-page.min.js +1 -0
- package/source/js/live2d_Asoul/Model/Ava/Ava.4096/texture_00.webp +0 -0
- package/source/js/live2d_Asoul/Model/Ava/Ava.moc3 +0 -0
- package/source/js/live2d_Asoul/Model/Ava/Ava.model3.json +323 -0
- package/source/js/live2d_Asoul/Model/Ava/Ava.physics3.json +1225 -0
- package/source/js/live2d_Asoul/Model/Ava/motions/Ava_idle.motion3.json +1 -0
- package/source/js/live2d_Asoul/Model/Ava/motions/Ava_shake01.motion3.json +1 -0
- package/source/js/live2d_Asoul/Model/Ava/motions/Ava_shake02.motion3.json +1 -0
- package/source/js/live2d_Asoul/Model/Ava/motions/Ava_tap01.motion3.json +1 -0
- package/source/js/live2d_Asoul/Model/Ava/motions/Ava_tap02.motion3.json +1 -0
- package/source/js/live2d_Asoul/Model/Ava/motions/Ava_tap03.motion3.json +1 -0
- package/source/js/live2d_Asoul/Model/Ava/motions/Ava_tap04.motion3.json +1 -0
- package/source/js/live2d_Asoul/Model/Ava/motions/Ava_tap05.motion3.json +1 -0
- package/source/js/live2d_Asoul/Model/Ava/motions/Ava_tap06.motion3.json +1 -0
- package/source/js/live2d_Asoul/Model/Ava/motions/Ava_tap07.motion3.json +1 -0
- package/source/js/live2d_Asoul/Model/Ava/motions/Ava_tap08.motion3.json +1 -0
- package/source/js/live2d_Asoul/Model/Ava/motions/Ava_tap09.motion3.json +1 -0
- package/source/js/live2d_Asoul/Model/Ava/motions/Ava_tap10.motion3.json +1 -0
- package/source/js/live2d_Asoul/Model/Ava/motions/Ava_tap11.motion3.json +1 -0
- package/source/js/live2d_Asoul/Model/Ava/raw.ex.json +16 -0
- package/source/js/live2d_Asoul/Model/Ava/raw.model3.json +321 -0
- package/source/js/live2d_Asoul/Model/Diana/Diana.4096/texture_00.webp +0 -0
- package/source/js/live2d_Asoul/Model/Diana/Diana.moc3 +0 -0
- package/source/js/live2d_Asoul/Model/Diana/Diana.model3.json +212 -0
- package/source/js/live2d_Asoul/Model/Diana/Diana.physics3.json +764 -0
- package/source/js/live2d_Asoul/Model/Diana/motions/Diana_idle.motion3.json +1 -0
- package/source/js/live2d_Asoul/Model/Diana/motions/Diana_tap01.motion3.json +1 -0
- package/source/js/live2d_Asoul/Model/Diana/motions/Diana_tap02.motion3.json +1 -0
- package/source/js/live2d_Asoul/Model/Diana/motions/Diana_tap03.motion3.json +1 -0
- package/source/js/live2d_Asoul/Model/Diana/motions/Diana_tap04.motion3.json +1 -0
- package/source/js/live2d_Asoul/Model/Diana/motions/Diana_tap05.motion3.json +1 -0
- package/source/js/live2d_Asoul/Model/Diana/motions/Diana_tap06.motion3.json +1 -0
- package/source/js/live2d_Asoul/Model/Diana/motions/Diana_tap07.motion3.json +1 -0
- package/source/js/live2d_Asoul/Model/Diana/motions/Diana_tap08.motion3.json +1 -0
- package/source/js/live2d_Asoul/Model/Diana/motions/Diana_tap09.motion3.json +1 -0
- package/source/js/live2d_Asoul/Model/Diana/motions/Diana_tap10.motion3.json +1 -0
- package/source/js/live2d_Asoul/Model/Diana/motions/Diana_tap11.motion3.json +1 -0
- package/source/js/live2d_Asoul/Model/Diana/raw.ex.json +16 -0
- package/source/js/live2d_Asoul/Model/Diana/raw.model3.json +210 -0
- package/source/js/live2d_Asoul/TweenLite.js +12 -0
- package/source/js/live2d_Asoul/cubism4.min.js +2 -0
- package/source/js/live2d_Asoul/live2dcubismcore.min.js +9 -0
- package/source/js/live2d_Asoul/load.js +231 -0
- package/source/js/live2d_Asoul/pio.css +161 -0
- package/source/js/live2d_Asoul/pio.js +296 -0
- package/source/js/live2d_Asoul/pio_sdk4.js +149 -0
- package/source/js/live2d_Asoul/pixi.min.js +9 -0
- package/source/js/main.js +218 -0
- package/source/js/pjax.js +29 -0
- package/source/js/shiki/shiki.js +191 -0
- package/source/js/theme-selector.js +206 -0
- package/util/cache.js +47 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Giscus comment JSX component.
|
|
3
|
+
* @module view/comment/giscus
|
|
4
|
+
*/
|
|
5
|
+
const { Component, cacheComponent } = require("../../include/util/common");
|
|
6
|
+
/**
|
|
7
|
+
* Giscus comment JSX component.
|
|
8
|
+
*
|
|
9
|
+
* @see https://giscus.app/
|
|
10
|
+
* @example
|
|
11
|
+
* <Giscus
|
|
12
|
+
* repo="usr/repo"
|
|
13
|
+
* repoId="X_xxxxxxxxxx"
|
|
14
|
+
* category="******"
|
|
15
|
+
* categoryId="XXX_xxxxxxxxxxxxxxxx"
|
|
16
|
+
* mapping="******"
|
|
17
|
+
* strict={0}
|
|
18
|
+
* reactionsEnabled={0}
|
|
19
|
+
* emitMetadata={0}
|
|
20
|
+
* inputPosition="******"
|
|
21
|
+
* theme="******"
|
|
22
|
+
* lang="******"
|
|
23
|
+
* lazy="******" />
|
|
24
|
+
*/
|
|
25
|
+
class Giscus extends Component {
|
|
26
|
+
render() {
|
|
27
|
+
const {
|
|
28
|
+
repo,
|
|
29
|
+
repoId,
|
|
30
|
+
category,
|
|
31
|
+
categoryId,
|
|
32
|
+
mapping,
|
|
33
|
+
term,
|
|
34
|
+
strict,
|
|
35
|
+
reactionsEnabled,
|
|
36
|
+
emitMetadata,
|
|
37
|
+
inputPosition,
|
|
38
|
+
theme,
|
|
39
|
+
customThemeCss,
|
|
40
|
+
lang,
|
|
41
|
+
lazy,
|
|
42
|
+
} = this.props;
|
|
43
|
+
if (!repo || !repoId || !categoryId) {
|
|
44
|
+
return (
|
|
45
|
+
<div class="notification is-danger">
|
|
46
|
+
You forgot to set the <code>repo</code>, <code>repoId</code>, or{" "}
|
|
47
|
+
<code>categoryId</code> for Giscus. Please set it in{" "}
|
|
48
|
+
<code>_config.yml</code>.
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
if ((mapping === "specific" || mapping === "number") && !term) {
|
|
53
|
+
return (
|
|
54
|
+
<div class="notification is-danger">
|
|
55
|
+
You set <code>mapping</code> to <code>specific</code> or{" "}
|
|
56
|
+
<code>number</code>, but did not set <code>term</code> for Giscus.
|
|
57
|
+
Please set <code>term</code> in <code>_config.yml</code>.
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
const config = { repo };
|
|
62
|
+
config["data-repo"] = repo;
|
|
63
|
+
config["data-repo-id"] = repoId;
|
|
64
|
+
config["data-category-id"] = categoryId;
|
|
65
|
+
if (category) {
|
|
66
|
+
config["data-category"] = category;
|
|
67
|
+
} else {
|
|
68
|
+
config["data-category"] = "Announcements";
|
|
69
|
+
}
|
|
70
|
+
if (mapping) {
|
|
71
|
+
config["data-mapping"] = mapping;
|
|
72
|
+
} else {
|
|
73
|
+
config["data-mapping"] = "pathname";
|
|
74
|
+
}
|
|
75
|
+
if (strict) {
|
|
76
|
+
config["data-strict"] = 1;
|
|
77
|
+
} else {
|
|
78
|
+
config["data-strict"] = 0;
|
|
79
|
+
}
|
|
80
|
+
if (reactionsEnabled) {
|
|
81
|
+
config["data-reactions-enabled"] = 1;
|
|
82
|
+
} else {
|
|
83
|
+
config["data-reactions-enabled"] = 0;
|
|
84
|
+
}
|
|
85
|
+
if (emitMetadata) {
|
|
86
|
+
config["data-emit-metadata"] = 1;
|
|
87
|
+
} else {
|
|
88
|
+
config["data-emit-metadata"] = 0;
|
|
89
|
+
}
|
|
90
|
+
if (inputPosition) {
|
|
91
|
+
config["data-input-position"] = inputPosition;
|
|
92
|
+
} else {
|
|
93
|
+
config["data-input-position"] = "top";
|
|
94
|
+
}
|
|
95
|
+
if (theme) {
|
|
96
|
+
if (theme === "custom") {
|
|
97
|
+
if (customThemeCss) {
|
|
98
|
+
config["data-theme"] = customThemeCss;
|
|
99
|
+
} else {
|
|
100
|
+
return (
|
|
101
|
+
<div class="notification is-danger">
|
|
102
|
+
You set <code>theme</code> to <code>custom</code>, but did not
|
|
103
|
+
apply a <code>customThemeCss</code> for Giscus. Please set it in{" "}
|
|
104
|
+
<code>_config.yml</code>.
|
|
105
|
+
</div>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
} else {
|
|
109
|
+
config["data-theme"] = theme;
|
|
110
|
+
}
|
|
111
|
+
} else {
|
|
112
|
+
config["data-theme"] = "noborder_light";
|
|
113
|
+
}
|
|
114
|
+
if (lang) {
|
|
115
|
+
config["data-lang"] = lang;
|
|
116
|
+
} else {
|
|
117
|
+
config["data-lang"] = "en";
|
|
118
|
+
}
|
|
119
|
+
if (lazy) {
|
|
120
|
+
config["data-loading"] = "lazy";
|
|
121
|
+
}
|
|
122
|
+
return (
|
|
123
|
+
<script
|
|
124
|
+
src="https://giscus.app/client.js"
|
|
125
|
+
{...config}
|
|
126
|
+
crossorigin="anonymous"
|
|
127
|
+
async={true}
|
|
128
|
+
></script>
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Cacheable Giscus comment JSX component.
|
|
135
|
+
* <p>
|
|
136
|
+
* This class is supposed to be used in combination with the <code>locals</code> hexo filter
|
|
137
|
+
* ({@link module:hexo/filter/locals}).
|
|
138
|
+
*
|
|
139
|
+
* @see module:util/cache.cacheComponent
|
|
140
|
+
* @example
|
|
141
|
+
* <Giscus.Cacheable
|
|
142
|
+
* comment={{
|
|
143
|
+
* repo: "usr/repo"
|
|
144
|
+
* repoId: "X_xxxxxxxxxx"
|
|
145
|
+
* category: "******"
|
|
146
|
+
* categoryId: "XXX_xxxxxxxxxxxxxxxx"
|
|
147
|
+
* mapping: "******"
|
|
148
|
+
* strict: {false}
|
|
149
|
+
* reactionsEnabled: {false}
|
|
150
|
+
* emitMetadata: {false}
|
|
151
|
+
* inputPosition: "******"
|
|
152
|
+
* theme: "******"
|
|
153
|
+
* lang: "******"
|
|
154
|
+
* lazy: "******"
|
|
155
|
+
* }} />
|
|
156
|
+
*/
|
|
157
|
+
Giscus.Cacheable = cacheComponent(Giscus, "comment.giscus", (props) => {
|
|
158
|
+
const {
|
|
159
|
+
repo,
|
|
160
|
+
repoId,
|
|
161
|
+
category,
|
|
162
|
+
categoryId,
|
|
163
|
+
mapping,
|
|
164
|
+
term,
|
|
165
|
+
strict,
|
|
166
|
+
reactionsEnabled,
|
|
167
|
+
emitMetadata,
|
|
168
|
+
inputPosition,
|
|
169
|
+
theme,
|
|
170
|
+
customThemeCss,
|
|
171
|
+
lang,
|
|
172
|
+
lazy,
|
|
173
|
+
} = props.comment;
|
|
174
|
+
|
|
175
|
+
return {
|
|
176
|
+
repo,
|
|
177
|
+
repoId,
|
|
178
|
+
category,
|
|
179
|
+
categoryId,
|
|
180
|
+
mapping,
|
|
181
|
+
term,
|
|
182
|
+
strict,
|
|
183
|
+
reactionsEnabled,
|
|
184
|
+
emitMetadata,
|
|
185
|
+
inputPosition,
|
|
186
|
+
theme,
|
|
187
|
+
customThemeCss,
|
|
188
|
+
lang,
|
|
189
|
+
lazy,
|
|
190
|
+
};
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
module.exports = Giscus;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gitalk comment JSX component.
|
|
3
|
+
* @module view/comment/gitalk
|
|
4
|
+
*/
|
|
5
|
+
const crypto = require("node:crypto");
|
|
6
|
+
const { Component, cacheComponent } = require("../../include/util/common");
|
|
7
|
+
/**
|
|
8
|
+
* Gitalk comment JSX component.
|
|
9
|
+
*
|
|
10
|
+
* @see https://github.com/gitalk/gitalk
|
|
11
|
+
* @example
|
|
12
|
+
* <Gitalk
|
|
13
|
+
* id="******",
|
|
14
|
+
* repo="******",
|
|
15
|
+
* owner="******",
|
|
16
|
+
* admin={["******"]},
|
|
17
|
+
* clientId="******",
|
|
18
|
+
* clientSecret="******",
|
|
19
|
+
* createIssueManually={false},
|
|
20
|
+
* distractionFreeMode={false},
|
|
21
|
+
* pagerDirection="last",
|
|
22
|
+
* perPage={10},
|
|
23
|
+
* proxy="******",
|
|
24
|
+
* flipMoveOptions={...},
|
|
25
|
+
* enableHotKey={true},
|
|
26
|
+
* language="zh-CN",
|
|
27
|
+
* jsUrl="/path/to/gitalk.js",
|
|
28
|
+
* cssUrl="/path/to/gitalk.css" />
|
|
29
|
+
*/
|
|
30
|
+
class Gitalk extends Component {
|
|
31
|
+
render() {
|
|
32
|
+
const {
|
|
33
|
+
id,
|
|
34
|
+
repo,
|
|
35
|
+
owner,
|
|
36
|
+
admin,
|
|
37
|
+
clientId,
|
|
38
|
+
clientSecret,
|
|
39
|
+
createIssueManually = false,
|
|
40
|
+
distractionFreeMode = false,
|
|
41
|
+
pagerDirection = "last",
|
|
42
|
+
perPage = 10,
|
|
43
|
+
proxy,
|
|
44
|
+
flipMoveOptions,
|
|
45
|
+
enableHotKey,
|
|
46
|
+
language,
|
|
47
|
+
jsUrl,
|
|
48
|
+
cssUrl,
|
|
49
|
+
} = this.props;
|
|
50
|
+
|
|
51
|
+
if (!id || !repo || !owner || !admin || !clientId || !clientSecret) {
|
|
52
|
+
return (
|
|
53
|
+
<div class="notification is-danger">
|
|
54
|
+
You forgot to set the <code>owner</code>, <code>admin</code>,{" "}
|
|
55
|
+
<code>repo</code>,<code>client_id</code>, or{" "}
|
|
56
|
+
<code>client_secret</code> for Gitalk. Please set it in{" "}
|
|
57
|
+
<code>_config.yml</code>.
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
const js = `var gitalk = new Gitalk({
|
|
62
|
+
id: ${JSON.stringify(id)},
|
|
63
|
+
repo: ${JSON.stringify(repo)},
|
|
64
|
+
owner: ${JSON.stringify(owner)},
|
|
65
|
+
clientID: ${JSON.stringify(clientId)},
|
|
66
|
+
clientSecret: ${JSON.stringify(clientSecret)},
|
|
67
|
+
admin: ${JSON.stringify(admin)},
|
|
68
|
+
createIssueManually: ${!!createIssueManually},
|
|
69
|
+
distractionFreeMode: ${!!distractionFreeMode},
|
|
70
|
+
perPage: ${JSON.stringify(perPage)},
|
|
71
|
+
pagerDirection: ${JSON.stringify(pagerDirection)},
|
|
72
|
+
${proxy ? `proxy: ${JSON.stringify(proxy)},` : ""}
|
|
73
|
+
${flipMoveOptions ? `flipMoveOptions: ${JSON.stringify(flipMoveOptions)},` : ""}
|
|
74
|
+
enableHotKey: ${enableHotKey ? !!enableHotKey : true},
|
|
75
|
+
${language ? `language: ${JSON.stringify(language)},` : ""}
|
|
76
|
+
})
|
|
77
|
+
gitalk.render('comment-container')`;
|
|
78
|
+
return (
|
|
79
|
+
<>
|
|
80
|
+
<div id="comment-container"></div>
|
|
81
|
+
<link rel="stylesheet" href={cssUrl} />
|
|
82
|
+
<script src={jsUrl}></script>
|
|
83
|
+
<script dangerouslySetInnerHTML={{ __html: js }}></script>
|
|
84
|
+
</>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Cacheable Gitalk comment JSX component.
|
|
91
|
+
* <p>
|
|
92
|
+
* This class is supposed to be used in combination with the <code>locals</code> hexo filter
|
|
93
|
+
* ({@link module:hexo/filter/locals}).
|
|
94
|
+
*
|
|
95
|
+
* @see module:util/cache.cacheComponent
|
|
96
|
+
* @example
|
|
97
|
+
* <Gitalk.Cacheable
|
|
98
|
+
* comment={{
|
|
99
|
+
* repo: '******',
|
|
100
|
+
* owner: '******',
|
|
101
|
+
* admin: ['******'],
|
|
102
|
+
* client_id: '******',
|
|
103
|
+
* client_secret: '******',
|
|
104
|
+
* create_issue_manually: false,
|
|
105
|
+
* distraction_free_mode: false,
|
|
106
|
+
* pager_direction: 'last',
|
|
107
|
+
* per_page: 10,
|
|
108
|
+
* proxy: '******',
|
|
109
|
+
* flip_move_options: {...},
|
|
110
|
+
* enable_hotkey: true,
|
|
111
|
+
* language: 'zh-CN'
|
|
112
|
+
* }}
|
|
113
|
+
* page={{ path: '/path/to/page' }}
|
|
114
|
+
* helper={{ cdn: function() {...} }} />
|
|
115
|
+
*/
|
|
116
|
+
Gitalk.Cacheable = cacheComponent(Gitalk, "comment.gitalk", (props) => {
|
|
117
|
+
const { helper, comment } = props;
|
|
118
|
+
|
|
119
|
+
// FIXME: config name change
|
|
120
|
+
const id = crypto.createHash("md5").update(props.page.path).digest("hex");
|
|
121
|
+
return {
|
|
122
|
+
id,
|
|
123
|
+
repo: comment.repo,
|
|
124
|
+
owner: comment.owner,
|
|
125
|
+
admin: comment.admin,
|
|
126
|
+
clientId: comment.client_id,
|
|
127
|
+
clientSecret: comment.client_secret,
|
|
128
|
+
createIssueManually: comment.create_issue_manually,
|
|
129
|
+
distractionFreeMode: comment.distraction_free_mode,
|
|
130
|
+
pagerDirection: comment.pager_direction,
|
|
131
|
+
perPage: comment.per_page,
|
|
132
|
+
proxy: comment.proxy,
|
|
133
|
+
flipMoveOptions: comment.flip_move_options,
|
|
134
|
+
enableHotKey: comment.enable_hotkey,
|
|
135
|
+
language: comment.language,
|
|
136
|
+
cssUrl: helper.cdn("gitalk", "1.7.2", "dist/gitalk.css"),
|
|
137
|
+
jsUrl: helper.cdn("gitalk", "1.7.2", "dist/gitalk.min.js"),
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
module.exports = Gitalk;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const {
|
|
2
|
+
Component,
|
|
3
|
+
Fragment,
|
|
4
|
+
cacheComponent,
|
|
5
|
+
lazy_load_css,
|
|
6
|
+
} = require("../../include/util/common");
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Twikoo comment JSX component.
|
|
10
|
+
*
|
|
11
|
+
* @see https://twikoo.js.org/quick-start.html
|
|
12
|
+
* @example
|
|
13
|
+
* <Twikoo
|
|
14
|
+
* envId="env_id"
|
|
15
|
+
* region="ap-guangzhou"
|
|
16
|
+
* lang="zh-CN"
|
|
17
|
+
* jsUrl="/path/to/Twikoo.js" />
|
|
18
|
+
*/
|
|
19
|
+
class Twikoo extends Component {
|
|
20
|
+
render() {
|
|
21
|
+
const { envId, region, lang, jsUrl } = this.props;
|
|
22
|
+
const js = `twikoo.init({ envId: '${envId}', ${region ? `region: ${JSON.stringify(region)},` : ""} ${lang ? `lang: ${JSON.stringify(lang)},` : ""} });`;
|
|
23
|
+
const lazy_load_css_script = lazy_load_css("/css/twikoo.css");
|
|
24
|
+
return (
|
|
25
|
+
<Fragment>
|
|
26
|
+
<div id="twikoo" class="content twikoo"></div>
|
|
27
|
+
<script
|
|
28
|
+
dangerouslySetInnerHTML={{ __html: lazy_load_css_script }}
|
|
29
|
+
></script>
|
|
30
|
+
<script async data-pjax src={jsUrl} onload={`${js};`}></script>
|
|
31
|
+
</Fragment>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Cacheable Twikoo comment JSX component.
|
|
38
|
+
* <p>
|
|
39
|
+
* This class is supposed to be used in combination with the <code>locals</code> hexo filter
|
|
40
|
+
* ({@link module:hexo/filter/locals}).
|
|
41
|
+
*
|
|
42
|
+
* @see module:util/cache.cacheComponent
|
|
43
|
+
* @example
|
|
44
|
+
* <Twikoo.Cacheable
|
|
45
|
+
* comment={{
|
|
46
|
+
* env_id: "env_id",
|
|
47
|
+
* region: "ap-guangzhou",
|
|
48
|
+
* lang: "zh-CN",
|
|
49
|
+
* }} />
|
|
50
|
+
*/
|
|
51
|
+
Twikoo.Cacheable = cacheComponent(Twikoo, "comment.twikoo", (props) => {
|
|
52
|
+
const { comment, helper, page, config } = props;
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
envId: comment.env_id,
|
|
56
|
+
region: comment.region,
|
|
57
|
+
lang:
|
|
58
|
+
comment.lang || page.lang || page.language || config.language || "zh-CN",
|
|
59
|
+
jsUrl: helper.cdn("twikoo", "1.6.41", "dist/twikoo.all.min.js"),
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
module.exports = Twikoo;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utterances comment JSX component.
|
|
3
|
+
* @module view/comment/utterances
|
|
4
|
+
*/
|
|
5
|
+
const { Component, cacheComponent } = require("../../include/util/common");
|
|
6
|
+
/**
|
|
7
|
+
* Utterances comment JSX component.
|
|
8
|
+
*
|
|
9
|
+
* @see https://utteranc.es/
|
|
10
|
+
* @example
|
|
11
|
+
* <Utterances
|
|
12
|
+
* repo="******"
|
|
13
|
+
* issueTerm="******"
|
|
14
|
+
* issueNumber={123}
|
|
15
|
+
* label="******"
|
|
16
|
+
* theme="******" />
|
|
17
|
+
*/
|
|
18
|
+
class Utterances extends Component {
|
|
19
|
+
render() {
|
|
20
|
+
const { repo, issueTerm, issueNumber, label, theme } = this.props;
|
|
21
|
+
if (!repo || (!issueTerm && !issueNumber)) {
|
|
22
|
+
return (
|
|
23
|
+
<div class="notification is-danger">
|
|
24
|
+
You forgot to set the <code>repo</code>, <code>issue_term</code>, or{" "}
|
|
25
|
+
<code>issue_number</code> for Utterances. Please set it in{" "}
|
|
26
|
+
<code>_config.yml</code>.
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
const config = { repo };
|
|
31
|
+
if (issueTerm) {
|
|
32
|
+
config["issue-term"] = issueTerm;
|
|
33
|
+
} else {
|
|
34
|
+
config["issue-number"] = issueNumber;
|
|
35
|
+
}
|
|
36
|
+
if (label) {
|
|
37
|
+
config.label = label;
|
|
38
|
+
}
|
|
39
|
+
if (theme) {
|
|
40
|
+
config.theme = theme;
|
|
41
|
+
}
|
|
42
|
+
return (
|
|
43
|
+
<script
|
|
44
|
+
src="https://utteranc.es/client.js"
|
|
45
|
+
{...config}
|
|
46
|
+
crossorigin="anonymous"
|
|
47
|
+
async={true}
|
|
48
|
+
></script>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Cacheable Utterances comment JSX component.
|
|
55
|
+
* <p>
|
|
56
|
+
* This class is supposed to be used in combination with the <code>locals</code> hexo filter
|
|
57
|
+
* ({@link module:hexo/filter/locals}).
|
|
58
|
+
*
|
|
59
|
+
* @see module:util/cache.cacheComponent
|
|
60
|
+
* @example
|
|
61
|
+
* <Utterances.Cacheable
|
|
62
|
+
* comment={{
|
|
63
|
+
* repo: "******",
|
|
64
|
+
* issue_term: "******"
|
|
65
|
+
* issue_number: {123}
|
|
66
|
+
* label: "******"
|
|
67
|
+
* theme: "******"
|
|
68
|
+
* }} />
|
|
69
|
+
*/
|
|
70
|
+
Utterances.Cacheable = cacheComponent(
|
|
71
|
+
Utterances,
|
|
72
|
+
"comment.utterances",
|
|
73
|
+
(props) => {
|
|
74
|
+
const { repo, issue_term, issue_number, label, theme } = props.comment;
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
repo,
|
|
78
|
+
issueTerm: issue_term,
|
|
79
|
+
issueNumber: issue_number,
|
|
80
|
+
label,
|
|
81
|
+
theme,
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
module.exports = Utterances;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Valine comment JSX component.
|
|
3
|
+
* @module view/comment/valine
|
|
4
|
+
*/
|
|
5
|
+
const { Component, cacheComponent } = require("../../include/util/common");
|
|
6
|
+
/**
|
|
7
|
+
* Valine comment JSX component.
|
|
8
|
+
*
|
|
9
|
+
* @see https://valine.js.org/quickstart.html
|
|
10
|
+
* @example
|
|
11
|
+
* <Valine
|
|
12
|
+
* appId="******"
|
|
13
|
+
* appKey="******"
|
|
14
|
+
* placeholder="******"
|
|
15
|
+
* avatar="mm"
|
|
16
|
+
* avatarForce={false}
|
|
17
|
+
* meta={['nick', 'mail', 'link']}
|
|
18
|
+
* pageSize={10}
|
|
19
|
+
* lang="zh-CN"
|
|
20
|
+
* visitor={false}
|
|
21
|
+
* highlight={true}
|
|
22
|
+
* recordIP={false}
|
|
23
|
+
* serverURLs="http[s]://[tab/us].avoscloud.com"
|
|
24
|
+
* emojiCDN=""
|
|
25
|
+
* emojiMaps={null}
|
|
26
|
+
* enableQQ={false}
|
|
27
|
+
* requiredFields={[]}
|
|
28
|
+
* jsUrl="/path/to/Valine.js" />
|
|
29
|
+
*/
|
|
30
|
+
class Valine extends Component {
|
|
31
|
+
render() {
|
|
32
|
+
const {
|
|
33
|
+
appId,
|
|
34
|
+
appKey,
|
|
35
|
+
placeholder,
|
|
36
|
+
avatar = "mm",
|
|
37
|
+
avatarForce = false,
|
|
38
|
+
meta = ["nick", "mail", "link"],
|
|
39
|
+
pageSize = 10,
|
|
40
|
+
lang = "zh-CN",
|
|
41
|
+
visitor = false,
|
|
42
|
+
highlight = true,
|
|
43
|
+
recordIP = false,
|
|
44
|
+
serverURLs = "",
|
|
45
|
+
emojiCDN = "",
|
|
46
|
+
emojiMaps = null,
|
|
47
|
+
enableQQ = false,
|
|
48
|
+
requiredFields: fields = [],
|
|
49
|
+
jsUrl,
|
|
50
|
+
} = this.props;
|
|
51
|
+
if (!appId || !appKey) {
|
|
52
|
+
return (
|
|
53
|
+
<div class="notification is-danger">
|
|
54
|
+
You forgot to set the <code>app_id</code> or <code>app_key</code> for
|
|
55
|
+
Valine. Please set it in <code>_config.yml</code>.
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
const js = `new Valine({
|
|
60
|
+
el: '#valine-thread',
|
|
61
|
+
appId: ${JSON.stringify(appId)},
|
|
62
|
+
appKey: ${JSON.stringify(appKey)},
|
|
63
|
+
${placeholder ? `placeholder: ${JSON.stringify(placeholder)},` : ""}
|
|
64
|
+
${avatar ? `avatar: ${JSON.stringify(avatar)},` : ""}
|
|
65
|
+
${`avatarForce: ${JSON.stringify(avatarForce)},`}
|
|
66
|
+
${meta ? `meta: ${JSON.stringify(meta)},` : ""}
|
|
67
|
+
${pageSize ? `pageSize: ${JSON.stringify(pageSize)},` : ""}
|
|
68
|
+
${lang ? `lang: ${JSON.stringify(lang)},` : ""}
|
|
69
|
+
${`visitor: ${JSON.stringify(visitor)},`}
|
|
70
|
+
${`highlight: ${JSON.stringify(highlight)},`}
|
|
71
|
+
${`recordIP: ${JSON.stringify(recordIP)},`}
|
|
72
|
+
${serverURLs ? `serverURLs: ${JSON.stringify(serverURLs)},` : ""}
|
|
73
|
+
${emojiCDN ? `emojiCDN: ${JSON.stringify(emojiCDN)},` : ""}
|
|
74
|
+
${emojiMaps ? `emojiMaps: ${JSON.stringify(emojiMaps)},` : ""}
|
|
75
|
+
${`enableQQ: ${JSON.stringify(enableQQ)},`}
|
|
76
|
+
${Array.isArray(fields) ? `requiredFields: ${JSON.stringify(fields)},` : ""}
|
|
77
|
+
});`;
|
|
78
|
+
return (
|
|
79
|
+
<>
|
|
80
|
+
<div id="valine-thread" class="content"></div>
|
|
81
|
+
<script src="//cdn.jsdelivr.net/npm/leancloud-storage@3/dist/av-min.js"></script>
|
|
82
|
+
<script src={jsUrl}></script>
|
|
83
|
+
<script dangerouslySetInnerHTML={{ __html: js }}></script>
|
|
84
|
+
</>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Cacheable Valine comment JSX component.
|
|
91
|
+
* <p>
|
|
92
|
+
* This class is supposed to be used in combination with the <code>locals</code> hexo filter
|
|
93
|
+
* ({@link module:hexo/filter/locals}).
|
|
94
|
+
*
|
|
95
|
+
* @see module:util/cache.cacheComponent
|
|
96
|
+
* @example
|
|
97
|
+
* <Valine.Cacheable
|
|
98
|
+
* comment={{
|
|
99
|
+
* app_id: "******"
|
|
100
|
+
* app_key: "******"
|
|
101
|
+
* placeholder: "******"
|
|
102
|
+
* avatar: "mm"
|
|
103
|
+
* avatar_force: false
|
|
104
|
+
* meta: ["nick", "mail", "link"]
|
|
105
|
+
* page_size: 10
|
|
106
|
+
* lang: "zh-CN"
|
|
107
|
+
* visitor: false
|
|
108
|
+
* highlight: true
|
|
109
|
+
* record_ip: false
|
|
110
|
+
* server_urls: "http[s]://[tab/us].avoscloud.com"
|
|
111
|
+
* emoji_cdn: ""
|
|
112
|
+
* emoji_maps: null
|
|
113
|
+
* enable_qq: false
|
|
114
|
+
* required_fields: []
|
|
115
|
+
* }}
|
|
116
|
+
* helper={{ cdn: function() {...} }} />
|
|
117
|
+
*/
|
|
118
|
+
Valine.Cacheable = cacheComponent(Valine, "comment.valine", (props) => {
|
|
119
|
+
const { comment, helper, page, config } = props;
|
|
120
|
+
|
|
121
|
+
return {
|
|
122
|
+
appId: comment.app_id,
|
|
123
|
+
appKey: comment.app_key,
|
|
124
|
+
placeholder: comment.placeholder,
|
|
125
|
+
avatar: comment.avatar,
|
|
126
|
+
avatarForce: comment.avatar_force,
|
|
127
|
+
meta: comment.meta,
|
|
128
|
+
pageSize: comment.page_size,
|
|
129
|
+
lang:
|
|
130
|
+
comment.lang || page.lang || page.language || config.language || "zh-CN",
|
|
131
|
+
visitor: comment.visitor,
|
|
132
|
+
highlight: comment.highlight,
|
|
133
|
+
recordIP: comment.record_ip,
|
|
134
|
+
serverURLs: comment.server_urls,
|
|
135
|
+
emojiCDN: comment.emoji_cdn,
|
|
136
|
+
emojiMaps: comment.emoji_maps,
|
|
137
|
+
enableQQ: comment.enable_qq,
|
|
138
|
+
requiredFields: comment.required_fields,
|
|
139
|
+
jsUrl: helper.cdn("valine", "1.4.16", "dist/Valine.min.js"),
|
|
140
|
+
};
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
module.exports = Valine;
|