hexo-theme-shokax 0.4.16 → 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,7 +1,4 @@
1
- # 📣 公告
2
- [你的 ShokaX 和 Shoka 站点可能正在遭遇供应链攻击](https://github.com/theme-shoka-x/hexo-theme-shokaX/discussions/293) \
3
- [关于 ShokaX 部署平台和 Astro 迁移的调查](https://github.com/theme-shoka-x/hexo-theme-shokaX/discussions/229)
4
-
1
+ ** [关于近期部分站点遭到全站复制的安全提示](https://github.com/theme-shoka-x/hexo-theme-shokaX/discussions/386) **
5
2
  # hexo-theme-shokaX
6
3
  ![LICENSE]( https://img.shields.io/github/license/theme-shoka-x/hexo-theme-shokaX)
7
4
  ![stars](https://img.shields.io/github/stars/theme-shoka-x/hexo-theme-shokaX)
@@ -9,16 +6,10 @@
9
6
  ![build](https://img.shields.io/github/actions/workflow/status/theme-shoka-x/hexo-theme-shokaX/build-theme.yml)
10
7
 
11
8
  #### 语言(language): 简体中文 | [English](./README_en.MD) \
12
- 此项目是shoka的一个二次开发版(算精神续作),致力于提高性能和优化魔改体验 \
13
- 诞生原因是目前shoka已经三年没有更新了,积压了大量BUG和功能请求。
9
+ 此项目是shoka的一个二次开发版(算精神续作),致力于提高性能和优化魔改体验
14
10
 
15
11
  shokaX的社区资源导航和插件仓库为[awesome-shokaX](https://github.com/theme-shoka-x/awesome-shokaX)
16
12
 
17
- ## 💬 和shoka的区别
18
- 原先shoka使用了javascript+Native+nunjucks的技术 \
19
- 而shokaX则使用了typescript+Vue 3+Pug的技术搭配 \
20
- 更改了大量难以访问的CDN链接
21
-
22
13
  ## ✨ 功能清单
23
14
 
24
15
  | 功能名称 | 实现状态 | 功能名称 | 实现状态 |
@@ -37,7 +28,7 @@ shokaX的社区资源导航和插件仓库为[awesome-shokaX](https://github.com
37
28
 
38
29
  ## 🔧 如何安装?
39
30
  注意: 本项目需要 node.js 18.x 或更高版本才能运行 \
40
- 见文档中[如何安装](https://docs-hexo.shokax.top/getting-started/)部分
31
+ 见文档中[如何安装](https://hexo.docs.shokax.top/getting-started/)部分
41
32
 
42
33
  ## 📚子项目
43
34
  - [ShokaX docs](https://github.com/theme-shoka-x/shokaX-docs) ShokaX 主题文档 (正在编写中,欢迎加入!)
package/README_en.MD CHANGED
@@ -1,7 +1,3 @@
1
- # 📣 Announcement
2
- [Your ShokaX and Shoka sites might be under a supply chain attack](https://github.com/theme-shoka-x/hexo-theme-shokaX/discussions/293) \
3
- [Survey on ShokaX deployment platform and Astro migration](https://github.com/theme-shoka-x/hexo-theme-shokaX/discussions/229)
4
-
5
1
  # hexo-theme-shokaX
6
2
  ![LICENSE](https://img.shields.io/github/license/theme-shoka-x/hexo-theme-shokaX)
7
3
  ![stars](https://img.shields.io/github/stars/theme-shoka-x/hexo-theme-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.16",
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",
@@ -29,12 +29,12 @@
29
29
  "dependencies": {
30
30
  "@algolia/client-search": "^5.5.3",
31
31
  "@waline/client": "^3.3.2",
32
- "algoliasearch": "5.5.3",
32
+ "algoliasearch": "5.18.0",
33
33
  "esbuild": "^0.24.0",
34
34
  "hexo": "^7.3.0",
35
35
  "hexo-algoliasearch": "^2.0.1",
36
36
  "hexo-feed": "^1.1.2",
37
- "hexo-fs": "^4.1.3",
37
+ "hexo-fs": "^5.0.0",
38
38
  "hexo-pagination": "^4.0.0",
39
39
  "hexo-renderer-pug": "^3.0.0",
40
40
  "hexo-util": "^3.3.0",
@@ -46,7 +46,7 @@
46
46
  "theme-shokax-anime": "^0.0.7",
47
47
  "theme-shokax-pjax": "^0.0.3",
48
48
  "twikoo": "^1.6.39",
49
- "unlazy": "^0.11.3"
49
+ "unlazy": "^0.12.1"
50
50
  },
51
51
  "engines": {
52
52
  "node": ">=18.0.0"
@@ -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
  }
@@ -42,8 +42,8 @@ hexo.on("generateBefore", () => {
42
42
  }
43
43
  });
44
44
  hexo.on("generateAfter", () => {
45
- fetch("https://api.shokax.top/version/hexo", { headers: {
46
- "User-Agent": "Mozilla/5.0 ShokaX Client (hexo-theme-shokax)"
45
+ fetch("https://registry.npmmirror.com/hexo-theme-shokax/latest", { headers: {
46
+ "User-Agent": "ShokaX Client (hexo-theme-shokax)"
47
47
  } }).then((res) => {
48
48
  res.json().then((resp) => {
49
49
  try {
@@ -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
  })