hexo-theme-shokax 0.4.17 → 0.4.19

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渐变作为文章封面
@@ -374,6 +375,14 @@ vendors:
374
375
  source: cdnjs
375
376
  url: jquery/3.5.1/jquery.min.js
376
377
  sri: "sha384-ZvpUoO/+PpLXR1lu4jmpXWu80pZlYUAfxl5NsBMWOEPSjUn/6Z/hRTt8+pR6L4N2"
378
+ fancybox:
379
+ source: cdnjs
380
+ url: fancybox/3.5.7/jquery.fancybox.min.js
381
+ sri: "sha384-Zm+UU4tdcfAm29vg+MTbfu//q5B/lInMbMCr4T8c9rQFyOv6PlfQYpB5wItcXWe7"
382
+ justifiedGallery:
383
+ source: cdnjs
384
+ url: justifiedGallery/3.8.1/js/jquery.justifiedGallery.min.js
385
+ sri: "sha384-TOxsBplaL96/QDWPIUg+ye3v89qSE3s22XNtJMmCeZEep3cVDmXy1zEfZvVv+y2m"
377
386
  async_js:
378
387
  fancybox:
379
388
  source: cdnjs
package/languages/en.yml CHANGED
@@ -67,6 +67,7 @@ footer:
67
67
  powered: "Powered by %s"
68
68
  total_views: Total Views
69
69
  total_visitors: Total Visitors
70
+ loading: "Loading..."
70
71
 
71
72
  counter:
72
73
  index:
@@ -109,6 +110,7 @@ symbol:
109
110
  comma: ", "
110
111
  period: ". "
111
112
  colon: ": "
113
+ space: " "
112
114
  year: "Y"
113
115
  month: "M"
114
116
 
package/languages/ja.yml CHANGED
@@ -67,6 +67,7 @@ footer:
67
67
  powered: "Powered by %s"
68
68
  total_views: 閲覧合計数
69
69
  total_visitors: 合計閲覧者数
70
+ loading: "ローディング..."
70
71
 
71
72
  counter:
72
73
  index:
@@ -109,6 +110,7 @@ symbol:
109
110
  comma: "、"
110
111
  period: "。"
111
112
  colon: ":"
113
+ space: " "
112
114
  year: 年
113
115
  month: 月
114
116
 
@@ -67,6 +67,7 @@ footer:
67
67
  powered: "基于 %s"
68
68
  total_views: 总访问量
69
69
  total_visitors: 总访客量
70
+ loading: "加载中..."
70
71
 
71
72
  counter:
72
73
  index:
@@ -109,6 +110,7 @@ symbol:
109
110
  comma: ","
110
111
  period: "。"
111
112
  colon: ":"
113
+ space: " "
112
114
  year: 年
113
115
  month: 月
114
116
 
@@ -67,6 +67,7 @@ footer:
67
67
  powered: "基於 %s"
68
68
  total_views: 總瀏覽次數
69
69
  total_visitors: 訪客總數
70
+ loading: "載入中..."
70
71
 
71
72
  counter:
72
73
  index:
@@ -109,6 +110,7 @@ symbol:
109
110
  comma: ","
110
111
  period: "。"
111
112
  colon: ":"
113
+ space: " "
112
114
  year: 年
113
115
  month: 月
114
116
 
@@ -67,6 +67,7 @@ footer:
67
67
  powered: "基於 %s"
68
68
  total_views: 總瀏覽次數
69
69
  total_visitors: 訪客總數
70
+ loading: "載入中..."
70
71
 
71
72
  counter:
72
73
  index:
@@ -109,6 +110,7 @@ symbol:
109
110
  comma: ","
110
111
  period: "。"
111
112
  colon: ":"
113
+ space: " "
112
114
  year: 年
113
115
  month: 月
114
116
 
@@ -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')
@@ -95,8 +97,8 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
95
97
  script(data-config type="text/javascript").
96
98
  var LOCAL = {
97
99
  ispost: !{is_post()},
98
- path: `#{_permapath(page.path)}`,
99
- favicon: {
100
+ path: `#{_permapath(page.path)}`,
101
+ favicon: {
100
102
  show: `#{__('favicon.show')}`,
101
103
  hide: `#{__('favicon.hide')}`
102
104
  },
@@ -134,6 +136,8 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
134
136
 
135
137
  != vendor_js('pace')
136
138
  != vendor_js('jquery')
139
+ != vendor_js('fancybox')
140
+ != vendor_js('justifiedGallery')
137
141
 
138
142
  if theme.polyfill.enable
139
143
  script(src=`https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?version=4.8.0&features=${theme.polyfill.features}` defer)
@@ -143,4 +147,3 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
143
147
  != shokax_inject('bodyEnd')
144
148
 
145
149
 
146
-
@@ -1,16 +1,19 @@
1
1
  div(class="meta")
2
- if date(post.date) !== date(post.updated) || time(post.date) !== time(post.updated)
3
- if theme.twikoo.enable || theme.waline.pageview
2
+ if theme.twikoo.enable || theme.waline.pageview
3
+ span(class="item")
4
4
  span(class="icon")
5
5
  i(class="ic i-eye")
6
- span 此文章已被阅读次数:
6
+ span(class="text")
7
+ !=__('footer.total_views') + __('symbol.colon')
7
8
  - var prefixedPath = post.path.startsWith('/') ? post.path : '/' + post.path
8
- span(id="twikoo_visitors" class="waline-pageview-count" data-path=prefixedPath) 正在加载...
9
+ span(id="twikoo_visitors" class="waline-pageview-count" data-path=prefixedPath)
10
+ !=__('footer.loading')
11
+ if date(post.date) !== date(post.updated) || time(post.date) !== time(post.updated)
9
12
  span(class="item")
10
13
  span(class="icon")
11
14
  i(class="ic i-calendar-check")
12
15
  span(class="text")
13
- != __('post.edited')
16
+ != __('post.edited') + __('symbol.space')
14
17
  time(title=__('post.modified') + __('symbol.colon') + full_date(post.updated) itemprop="dateModified" datetime=moment(post.updated).format())
15
18
  != date(post.updated)
16
19
 
package/package.json CHANGED
@@ -1,36 +1,36 @@
1
1
  {
2
2
  "name": "hexo-theme-shokax",
3
- "version": "0.4.17",
3
+ "version": "0.4.19",
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",
7
7
  "author": "zkz098",
8
8
  "license": "AGPL-3.0-or-later",
9
- "packageManager": "pnpm@9.5.0",
9
+ "packageManager": "pnpm@9.15.4",
10
10
  "scripts": {
11
11
  "test": "tsc --build --verbose",
12
12
  "build": "node ./toolbox/compiler.mjs"
13
13
  },
14
14
  "devDependencies": {
15
15
  "@types/fancybox": "^3.5.7",
16
- "@types/jquery": "^3.5.30",
16
+ "@types/jquery": "^3.5.32",
17
17
  "@types/js-yaml": "^4.0.9",
18
18
  "@types/katex": "^0.16.7",
19
- "@types/node": "^22.5.5",
19
+ "@types/node": "^22.10.10",
20
20
  "@types/quicklink": "^2.3.4",
21
- "@typescript-eslint/eslint-plugin": "^8.6.0",
22
- "@typescript-eslint/parser": "^8.6.0",
23
- "eslint": "^9.11.0",
21
+ "@typescript-eslint/eslint-plugin": "^8.21.0",
22
+ "@typescript-eslint/parser": "^8.21.0",
23
+ "eslint": "^9.19.0",
24
24
  "eslint-config-standard": "~17",
25
- "eslint-plugin-vue": "^9.28.0",
26
- "glob": "^11.0.0",
27
- "typescript": "^5.6.2"
25
+ "eslint-plugin-vue": "^9.32.0",
26
+ "glob": "^11.0.1",
27
+ "typescript": "^5.7.3"
28
28
  },
29
29
  "dependencies": {
30
- "@algolia/client-search": "^5.5.3",
31
- "@waline/client": "^3.3.2",
32
- "algoliasearch": "5.18.0",
33
- "esbuild": "^0.24.0",
30
+ "@algolia/client-search": "^5.20.0",
31
+ "@waline/client": "^3.5.1",
32
+ "algoliasearch": "5.20.0",
33
+ "esbuild": "^0.24.2",
34
34
  "hexo": "^7.3.0",
35
35
  "hexo-algoliasearch": "^2.0.1",
36
36
  "hexo-feed": "^1.1.2",
@@ -38,14 +38,14 @@
38
38
  "hexo-pagination": "^4.0.0",
39
39
  "hexo-renderer-pug": "^3.0.0",
40
40
  "hexo-util": "^3.3.0",
41
- "instantsearch.js": "^4.74.1",
41
+ "instantsearch.js": "^4.77.1",
42
42
  "js-yaml": "^4.1.0",
43
- "katex": "^0.16.11",
43
+ "katex": "^0.16.21",
44
44
  "mouse-firework": "^0.0.6",
45
45
  "quicklink": "^2.3.0",
46
46
  "theme-shokax-anime": "^0.0.7",
47
47
  "theme-shokax-pjax": "^0.0.3",
48
- "twikoo": "^1.6.39",
48
+ "twikoo": "^1.6.41",
49
49
  "unlazy": "^0.12.1"
50
50
  },
51
51
  "engines": {
@@ -39,10 +39,6 @@ hexo.extend.generator.register("script", function(locals) {
39
39
  darkmode: theme.darkmode,
40
40
  auto_dark: theme.auto_dark,
41
41
  auto_scroll: theme.auto_scroll,
42
- js: {
43
- copy_tex: (0, import_utils.getVendorLink)(hexo, theme.vendors.async_js.copy_tex),
44
- fancybox: (0, import_utils.getVendorLink)(hexo, theme.vendors.async_js.fancybox)
45
- },
46
42
  css: {
47
43
  katex: (0, import_utils.getVendorLink)(hexo, theme.vendors.css.katex),
48
44
  mermaid: {
@@ -137,6 +133,7 @@ hexo.extend.generator.register("script", function(locals) {
137
133
  __shokax_fancybox__: theme.modules.fancybox ? "true" : "false",
138
134
  __shokax_waline__: theme.waline.enable ? "true" : "false",
139
135
  __shokax_twikoo__: theme.twikoo.enable ? "true" : "false",
136
+ __shokax_antiFakeWebsite__: theme.experiments.antiFakeWebsite ? "true" : "false",
140
137
  shokax_CONFIG: JSON.stringify(siteConfig),
141
138
  shokax_siteURL: "'" + config.url + "'"
142
139
  }
@@ -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
@@ -7,70 +7,61 @@ export const postFancybox = (p:string) => {
7
7
  if (document.querySelector(p + ' .md img')) {
8
8
  vendorCss('fancybox')
9
9
  vendorCss('justifiedGallery')
10
- vendorJs('jquery', ()=>{
11
- vendorJs('justifiedGallery',()=>{
12
- vendorJs('fancybox', () => {
13
- const q = jQuery.noConflict()
10
+ $dom.each(p + ' p.gallery', (element) => {
11
+ const box = document.createElement('div')
12
+ box.className = 'gallery'
13
+ box.setAttribute('data-height', String(element.getAttribute('data-height') || 220))
14
14
 
15
- $dom.each(p + ' p.gallery', (element) => {
16
- const box = document.createElement('div')
17
- box.className = 'gallery'
18
- box.setAttribute('data-height', String(element.getAttribute('data-height') || 220))
15
+ box.innerHTML = element.innerHTML.replace(/<br>/g, '')
19
16
 
20
- box.innerHTML = element.innerHTML.replace(/<br>/g, '')
21
-
22
- element.parentNode.insertBefore(box, element)
23
- element.remove()
24
- })
25
-
26
- $dom.each(p + ' .md img:not(.emoji):not(.vemoji)', (element) => {
27
- const $image = q(element)
28
- const imageLink = $image.attr('data-src') || $image.attr('src') // 替换
29
- const $imageWrapLink = $image.wrap('<a class="fancybox" href="' + imageLink + '" itemscope itemtype="https://schema.org/ImageObject" itemprop="url"></a>').parent('a')
30
- let info; let captionClass = 'image-info'
31
- if (!$image.is('a img')) {
32
- $image.data('safe-src', imageLink)
33
- if (!$image.is('.gallery img')) {
34
- $imageWrapLink.attr('data-fancybox', 'default').attr('rel', 'default')
35
- } else {
36
- captionClass = 'jg-caption'
37
- }
38
- }
39
- if ((info = element.getAttribute('title'))) {
40
- $imageWrapLink.attr('data-caption', info)
41
- const para = document.createElement('span')
42
- const txt = document.createTextNode(info)
43
- para.appendChild(txt)
44
- para.addClass(captionClass)
45
- insertAfter(element, para)
46
- }
47
- })
17
+ element.parentNode.insertBefore(box, element)
18
+ element.remove()
19
+ })
48
20
 
49
- $dom.each(p + ' div.gallery', (el, i) => {
50
- // @ts-ignore
51
- q(el).justifiedGallery({
52
- rowHeight: q(el).data('height') || 120,
53
- rel: 'gallery-' + i
54
- }).on('jg.complete', function () {
55
- q(this).find('a').each((k, ele) => {
56
- ele.setAttribute('data-fancybox', 'gallery-' + i)
57
- })
58
- })
59
- })
21
+ $dom.each(p + ' .md img:not(.emoji):not(.vemoji)', (element) => {
22
+ const $image = $(element)
23
+ const imageLink = $image.attr('data-src') || $image.attr('src') // 替换
24
+ const $imageWrapLink = $image.wrap('<a class="fancybox" href="' + imageLink + '" itemscope itemtype="https://schema.org/ImageObject" itemprop="url"></a>').parent('a')
25
+ let info; let captionClass = 'image-info'
26
+ if (!$image.is('a img')) {
27
+ $image.data('safe-src', imageLink)
28
+ if (!$image.is('.gallery img')) {
29
+ $imageWrapLink.attr('data-fancybox', 'default').attr('rel', 'default')
30
+ } else {
31
+ captionClass = 'jg-caption'
32
+ }
33
+ }
34
+ if ((info = element.getAttribute('title'))) {
35
+ $imageWrapLink.attr('data-caption', info)
36
+ const para = document.createElement('span')
37
+ const txt = document.createTextNode(info)
38
+ para.appendChild(txt)
39
+ para.addClass(captionClass)
40
+ insertAfter(element, para)
41
+ }
42
+ })
60
43
 
61
- q.fancybox.defaults.hash = false
62
- q(p + ' .fancybox').fancybox({
63
- loop: true,
64
- // @ts-ignore
65
- helpers: {
66
- overlay: {
67
- locked: false
68
- }
69
- }
70
- })
71
- // @ts-ignore
72
- }, window.jQuery)
44
+ $dom.each(p + ' div.gallery', (el, i) => {
45
+ // @ts-ignore
46
+ $(el).justifiedGallery({
47
+ rowHeight: $(el).data('height') || 120,
48
+ rel: 'gallery-' + i
49
+ }).on('jg.complete', function () {
50
+ $(this).find('a').each((k, ele) => {
51
+ ele.setAttribute('data-fancybox', 'gallery-' + i)
52
+ })
73
53
  })
74
54
  })
55
+
56
+ $.fancybox.defaults.hash = false
57
+ $(p + ' .fancybox').fancybox({
58
+ loop: true,
59
+ // @ts-ignore
60
+ helpers: {
61
+ overlay: {
62
+ locked: false
63
+ }
64
+ }
65
+ })
75
66
  }
76
67
  }
@@ -34,12 +34,18 @@ 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 && window.location.origin !== "http://localhost:4000") {
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
 
40
48
  vendorCss('katex');
41
- // await import('katex/dist/katex.min.css')
42
- // vendorJs('copy_tex')
43
49
  await import('katex/dist/contrib/copy-tex.mjs')
44
50
  vendorCss('mermaid')
45
51
 
@@ -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 && window.location.origin !== "http://localhost:4000") {
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
  })