hexo-theme-shokax 0.4.17 → 0.4.18
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -1
- package/_config.yml +1 -0
- package/layout/_partials/layout.pug +4 -3
- package/package.json +1 -1
- package/scripts/generaters/script.js +1 -0
- package/source/js/_app/library/declare.d.ts +1 -0
- package/source/js/_app/pjax/refresh.ts +8 -0
- package/source/js/_app/pjax/siteInit.ts +8 -0
package/README.md
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
** [关于近期部分站点遭到全站复制的安全提示](https://github.com/theme-shoka-x/hexo-theme-shokaX/discussions/386) **
|
1
2
|
# hexo-theme-shokaX
|
2
3
|

|
3
4
|

|
@@ -27,7 +28,7 @@ shokaX的社区资源导航和插件仓库为[awesome-shokaX](https://github.com
|
|
27
28
|
|
28
29
|
## 🔧 如何安装?
|
29
30
|
注意: 本项目需要 node.js 18.x 或更高版本才能运行 \
|
30
|
-
见文档中[如何安装](https://
|
31
|
+
见文档中[如何安装](https://hexo.docs.shokax.top/getting-started/)部分
|
31
32
|
|
32
33
|
## 📚子项目
|
33
34
|
- [ShokaX docs](https://github.com/theme-shoka-x/shokaX-docs) ShokaX 主题文档 (正在编写中,欢迎加入!)
|
package/_config.yml
CHANGED
@@ -18,9 +18,11 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
|
|
18
18
|
if enablePreload && enableCover
|
19
19
|
if enableFixedCover
|
20
20
|
link(rel="preload" href=theme.homeConfig.fixedCover as="image" fetchpriority="high")
|
21
|
-
else
|
21
|
+
else if Array.isArray(covers)
|
22
22
|
each image in covers
|
23
|
-
link(rel="preload" href
|
23
|
+
link(rel="preload" href!=image as="image" fetchpriority="high")
|
24
|
+
else
|
25
|
+
link(rel="preload" href!=covers as="image" fetchpriority="high")
|
24
26
|
|
25
27
|
!= partial('_partials/head/head_com.pug')
|
26
28
|
!= shokax_inject('head')
|
@@ -143,4 +145,3 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
|
|
143
145
|
!= shokax_inject('bodyEnd')
|
144
146
|
|
145
147
|
|
146
|
-
|
package/package.json
CHANGED
@@ -137,6 +137,7 @@ hexo.extend.generator.register("script", function(locals) {
|
|
137
137
|
__shokax_fancybox__: theme.modules.fancybox ? "true" : "false",
|
138
138
|
__shokax_waline__: theme.waline.enable ? "true" : "false",
|
139
139
|
__shokax_twikoo__: theme.twikoo.enable ? "true" : "false",
|
140
|
+
__shokax_antiFakeWebsite__: theme.experiments.antiFakeWebsite ? "true" : "false",
|
140
141
|
shokax_CONFIG: JSON.stringify(siteConfig),
|
141
142
|
shokax_siteURL: "'" + config.url + "'"
|
142
143
|
}
|
@@ -34,6 +34,14 @@ export const pjaxReload = () => {
|
|
34
34
|
}
|
35
35
|
|
36
36
|
export const siteRefresh = async (reload) => {
|
37
|
+
if (__shokax_antiFakeWebsite__) {
|
38
|
+
if (window.location.origin !== CONFIG.hostname) {
|
39
|
+
window.location.href = CONFIG.hostname
|
40
|
+
/*! 我知道你正在试图去除这段代码,虽然我无法阻止你,但我劝你好自为之 */
|
41
|
+
alert('检测到非法仿冒网站,已自动跳转回正确首页;\nWe have detected a fake website, and you have been redirected to the correct homepage.')
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
37
45
|
setLocalHash(0)
|
38
46
|
setLocalUrl(window.location.href)
|
39
47
|
|
@@ -99,6 +99,14 @@ const siteInit = async () => {
|
|
99
99
|
|
100
100
|
cloudflareInit()
|
101
101
|
|
102
|
+
if (__shokax_antiFakeWebsite__) {
|
103
|
+
if (window.location.origin !== CONFIG.hostname) {
|
104
|
+
window.location.href = CONFIG.hostname
|
105
|
+
/*! 我知道你正在试图去除这段代码,虽然我无法阻止你,但我劝你好自为之 */
|
106
|
+
alert('检测到非法仿冒网站,已自动跳转回正确首页;\nWe have detected a fake website, and you have been redirected to the correct homepage.')
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
102
110
|
window.addEventListener('DOMContentLoaded', siteInit, {
|
103
111
|
passive: true
|
104
112
|
})
|