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 CHANGED
@@ -1,3 +1,4 @@
1
+ ** [关于近期部分站点遭到全站复制的安全提示](https://github.com/theme-shoka-x/hexo-theme-shokaX/discussions/386) **
1
2
  # hexo-theme-shokaX
2
3
  ![LICENSE]( https://img.shields.io/github/license/theme-shoka-x/hexo-theme-shokaX)
3
4
  ![stars](https://img.shields.io/github/stars/theme-shoka-x/hexo-theme-shokaX)
@@ -27,7 +28,7 @@ shokaX的社区资源导航和插件仓库为[awesome-shokaX](https://github.com
27
28
 
28
29
  ## 🔧 如何安装?
29
30
  注意: 本项目需要 node.js 18.x 或更高版本才能运行 \
30
- 见文档中[如何安装](https://docs-hexo.shokax.top/getting-started/)部分
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
@@ -34,6 +34,7 @@ experiments:
34
34
  enablePreload: true #是否开启预加载头图
35
35
  enableNextGradientCover: false # 使用CSS渐变作为上/下一页封面
36
36
  copyrightLength: 50 # 自定义复制时显示copyright的长度
37
+ antiFakeWebsite: true # 防止恶意网站伪装
37
38
 
38
39
  homeConfig:
39
40
  gradient: false # 使用CSS渐变作为文章封面
@@ -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=image as="image" fetchpriority="high")
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-shokax",
3
- "version": "0.4.17",
3
+ "version": "0.4.18",
4
4
  "description": "a hexo theme based on shoka",
5
5
  "main": "index.js",
6
6
  "repository": "https://github.com/theme-shoka-x/hexo-theme-shokaX",
@@ -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
  }
@@ -132,3 +132,4 @@ declare const __shokax_waline__:boolean
132
132
  declare const __shokax_twikoo__:boolean
133
133
  declare const shokax_CONFIG:configType
134
134
  declare const shokax_siteURL:string
135
+ declare const __shokax_antiFakeWebsite__:boolean
@@ -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
  })