hexo-theme-redefine-x 2.8.5

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.
Files changed (319) hide show
  1. package/.github/ISSUE_TEMPLATE/bug-chinese.yml +115 -0
  2. package/.github/ISSUE_TEMPLATE/bug-english.yml +106 -0
  3. package/.github/ISSUE_TEMPLATE/enhancement-chinese.yml +55 -0
  4. package/.github/ISSUE_TEMPLATE/enhancement-english.yml +55 -0
  5. package/.github/workflows/build-and-commit.yml +49 -0
  6. package/.github/workflows/npm-publish.yml +34 -0
  7. package/.github/workflows/stale-issues.yml +20 -0
  8. package/CHANGELOG_REDEFINE_X.md +236 -0
  9. package/CODE_OF_CONDUCT.md +128 -0
  10. package/CONTRIBUTING.md +51 -0
  11. package/DONATION.md +82 -0
  12. package/LICENSE +674 -0
  13. package/README.md +135 -0
  14. package/README_zh-CN.md +138 -0
  15. package/README_zh-TW.md +137 -0
  16. package/TODO.md +215 -0
  17. package/_config.yml +489 -0
  18. package/languages/en.yml +93 -0
  19. package/languages/es.yml +92 -0
  20. package/languages/fr.yml +92 -0
  21. package/languages/ja.yml +92 -0
  22. package/languages/zh-CN.yml +95 -0
  23. package/languages/zh-TW.yml +94 -0
  24. package/layout/404.ejs +1 -0
  25. package/layout/archive.ejs +1 -0
  26. package/layout/category.ejs +1 -0
  27. package/layout/components/comments/comment.ejs +22 -0
  28. package/layout/components/comments/giscus.ejs +42 -0
  29. package/layout/components/comments/gitalk.ejs +47 -0
  30. package/layout/components/comments/twikoo.ejs +50 -0
  31. package/layout/components/comments/waline.ejs +34 -0
  32. package/layout/components/footer/footer.ejs +99 -0
  33. package/layout/components/header/head.ejs +222 -0
  34. package/layout/components/header/navbar.ejs +163 -0
  35. package/layout/components/header/preloader.ejs +148 -0
  36. package/layout/components/header/progress-bar.ejs +12 -0
  37. package/layout/components/plugins/aplayer.ejs +3 -0
  38. package/layout/components/scripts.ejs +90 -0
  39. package/layout/components/sidebar/author.ejs +6 -0
  40. package/layout/components/sidebar/avatar.ejs +3 -0
  41. package/layout/components/sidebar/statistics.ejs +14 -0
  42. package/layout/components/swup.ejs +27 -0
  43. package/layout/index.ejs +1 -0
  44. package/layout/layout.ejs +13 -0
  45. package/layout/page.ejs +57 -0
  46. package/layout/pages/archive/archive.ejs +3 -0
  47. package/layout/pages/bookmarks/bookmarks.ejs +68 -0
  48. package/layout/pages/category/categories.ejs +11 -0
  49. package/layout/pages/category/category-detail.ejs +6 -0
  50. package/layout/pages/friends/friends-link.ejs +59 -0
  51. package/layout/pages/home/home-article.ejs +52 -0
  52. package/layout/pages/home/home-background.ejs +33 -0
  53. package/layout/pages/home/home-banner.ejs +234 -0
  54. package/layout/pages/home/home-content.ejs +62 -0
  55. package/layout/pages/home/home-sidebar.ejs +78 -0
  56. package/layout/pages/masonry/masonry.ejs +28 -0
  57. package/layout/pages/notfound/notfound.ejs +8 -0
  58. package/layout/pages/page-template.ejs +23 -0
  59. package/layout/pages/post/article-content.ejs +153 -0
  60. package/layout/pages/post/article-copyright.ejs +69 -0
  61. package/layout/pages/post/article-info.ejs +78 -0
  62. package/layout/pages/post/post-tools.ejs +17 -0
  63. package/layout/pages/post/toc.ejs +15 -0
  64. package/layout/pages/shuoshuo/essays.ejs +23 -0
  65. package/layout/pages/tag/tag-detail.ejs +6 -0
  66. package/layout/pages/tag/tags.ejs +24 -0
  67. package/layout/post.ejs +1 -0
  68. package/layout/tag.ejs +1 -0
  69. package/layout/tags.ejs +1 -0
  70. package/layout/utils/image-viewer.ejs +3 -0
  71. package/layout/utils/local-search.ejs +20 -0
  72. package/layout/utils/paginator.ejs +8 -0
  73. package/layout/utils/posts-list.ejs +28 -0
  74. package/layout/utils/side-tools.ejs +51 -0
  75. package/package.json +45 -0
  76. package/scripts/config-export.js +66 -0
  77. package/scripts/data-handle.js +37 -0
  78. package/scripts/events/404.js +16 -0
  79. package/scripts/events/welcome.js +141 -0
  80. package/scripts/filters/delete-mask-handle.js +27 -0
  81. package/scripts/filters/encrypt.js +202 -0
  82. package/scripts/filters/img-handle.js +9 -0
  83. package/scripts/filters/lazyload-handle.js +350 -0
  84. package/scripts/filters/lib/hbe.default.js +15 -0
  85. package/scripts/filters/link-handle.js +42 -0
  86. package/scripts/filters/stylus-handle.js +9 -0
  87. package/scripts/filters/table-handle.js +11 -0
  88. package/scripts/helpers/meta-helpers.js +38 -0
  89. package/scripts/helpers/page-helpers.js +153 -0
  90. package/scripts/helpers/recommendation-helpers.js +367 -0
  91. package/scripts/helpers/theme-helpers.js +251 -0
  92. package/scripts/helpers/waline-helpers.js +33 -0
  93. package/scripts/modules/btn.js +85 -0
  94. package/scripts/modules/btns.js +71 -0
  95. package/scripts/modules/folding.js +34 -0
  96. package/scripts/modules/note-large.js +72 -0
  97. package/scripts/modules/note.js +64 -0
  98. package/scripts/modules/tabs.js +99 -0
  99. package/source/assets/hbe.style.css +220 -0
  100. package/source/assets/odometer-theme-minimal.css +81 -0
  101. package/source/css/build/tailwind.css +2 -0
  102. package/source/css/common/animated.styl +71 -0
  103. package/source/css/common/basic.styl +239 -0
  104. package/source/css/common/codeblock/code-block.styl +158 -0
  105. package/source/css/common/codeblock/code-theme.styl +82 -0
  106. package/source/css/common/codeblock/highlight.styl +189 -0
  107. package/source/css/common/codeblock/hljs-themes/dark/a11y-dark.styl +18 -0
  108. package/source/css/common/codeblock/hljs-themes/dark/agate.styl +18 -0
  109. package/source/css/common/codeblock/hljs-themes/dark/atom-one-dark.styl +18 -0
  110. package/source/css/common/codeblock/hljs-themes/dark/github-dark.styl +18 -0
  111. package/source/css/common/codeblock/hljs-themes/dark/monokai-sublime.styl +18 -0
  112. package/source/css/common/codeblock/hljs-themes/dark/night-owl.styl +18 -0
  113. package/source/css/common/codeblock/hljs-themes/dark/nord.styl +18 -0
  114. package/source/css/common/codeblock/hljs-themes/dark/tokyo-night-dark.styl +18 -0
  115. package/source/css/common/codeblock/hljs-themes/dark/vs2015.styl +18 -0
  116. package/source/css/common/codeblock/hljs-themes/light/atom-one-light.styl +18 -0
  117. package/source/css/common/codeblock/hljs-themes/light/default.styl +18 -0
  118. package/source/css/common/codeblock/hljs-themes/light/github.styl +18 -0
  119. package/source/css/common/colors.styl +112 -0
  120. package/source/css/common/markdown.styl +337 -0
  121. package/source/css/common/redefine-theme.styl +65 -0
  122. package/source/css/common/theme.styl +72 -0
  123. package/source/css/common/variables.styl +145 -0
  124. package/source/css/layout/_modules/aplayer.styl +799 -0
  125. package/source/css/layout/_modules/buttons.styl +42 -0
  126. package/source/css/layout/_modules/folding.styl +180 -0
  127. package/source/css/layout/_modules/notes.styl +181 -0
  128. package/source/css/layout/_modules/tabs.styl +105 -0
  129. package/source/css/layout/_partials/404.styl +14 -0
  130. package/source/css/layout/_partials/archive-list.styl +49 -0
  131. package/source/css/layout/_partials/article-copyright-info.styl +27 -0
  132. package/source/css/layout/_partials/article-meta-info.styl +62 -0
  133. package/source/css/layout/_partials/comments/comment.styl +11 -0
  134. package/source/css/layout/_partials/comments/gitalk.styl +529 -0
  135. package/source/css/layout/_partials/comments/twikoo.styl +62 -0
  136. package/source/css/layout/_partials/comments/waline.styl +1151 -0
  137. package/source/css/layout/_partials/footer.styl +59 -0
  138. package/source/css/layout/_partials/home-banner.styl +48 -0
  139. package/source/css/layout/_partials/image-viewer.styl +37 -0
  140. package/source/css/layout/_partials/local-search.styl +137 -0
  141. package/source/css/layout/_partials/navbar.styl +309 -0
  142. package/source/css/layout/_partials/page-template.styl +147 -0
  143. package/source/css/layout/_partials/paginator.styl +65 -0
  144. package/source/css/layout/_partials/post-tools.styl +43 -0
  145. package/source/css/layout/_partials/progress-bar.styl +33 -0
  146. package/source/css/layout/_partials/side-tools.styl +87 -0
  147. package/source/css/layout/_partials/tagcloud.styl +136 -0
  148. package/source/css/layout/_partials/toc.styl +105 -0
  149. package/source/css/layout/animations.styl +42 -0
  150. package/source/css/layout/archive-content.styl +8 -0
  151. package/source/css/layout/article-content.styl +257 -0
  152. package/source/css/layout/bookmarks.styl +8 -0
  153. package/source/css/layout/category-content.styl +21 -0
  154. package/source/css/layout/category-list.styl +119 -0
  155. package/source/css/layout/home-content.styl +114 -0
  156. package/source/css/layout/home-sidebar.styl +126 -0
  157. package/source/css/layout/page.styl +144 -0
  158. package/source/css/layout/tag-content.styl +30 -0
  159. package/source/css/style.styl +26 -0
  160. package/source/css/tailwind.source.css +236 -0
  161. package/source/fontawesome/all.min.css +6 -0
  162. package/source/fontawesome/brands.min.css +6 -0
  163. package/source/fontawesome/duotone.min.css +6 -0
  164. package/source/fontawesome/fontawesome.min.css +6 -0
  165. package/source/fontawesome/light.min.css +6 -0
  166. package/source/fontawesome/regular.min.css +6 -0
  167. package/source/fontawesome/sharp-solid.min.css +6 -0
  168. package/source/fontawesome/solid.min.css +6 -0
  169. package/source/fontawesome/svg-with-js.min.css +6 -0
  170. package/source/fontawesome/thin.min.css +6 -0
  171. package/source/fontawesome/v4-font-face.min.css +6 -0
  172. package/source/fontawesome/v4-shims.min.css +6 -0
  173. package/source/fontawesome/v5-font-face.min.css +6 -0
  174. package/source/fonts/Chillax/Chillax-Variable.eot +0 -0
  175. package/source/fonts/Chillax/Chillax-Variable.ttf +0 -0
  176. package/source/fonts/Chillax/Chillax-Variable.woff +0 -0
  177. package/source/fonts/Chillax/Chillax-Variable.woff2 +0 -0
  178. package/source/fonts/Chillax/chillax.css +39 -0
  179. package/source/fonts/Geist/GeistVF.ttf +0 -0
  180. package/source/fonts/Geist/GeistVF.woff +0 -0
  181. package/source/fonts/Geist/GeistVF.woff2 +0 -0
  182. package/source/fonts/Geist/geist.css +16 -0
  183. package/source/fonts/GeistMono/GeistMonoVF.ttf +0 -0
  184. package/source/fonts/GeistMono/GeistMonoVF.woff +0 -0
  185. package/source/fonts/GeistMono/GeistMonoVF.woff2 +0 -0
  186. package/source/fonts/GeistMono/geist-mono.css +16 -0
  187. package/source/images/bookmark-placeholder.svg +9 -0
  188. package/source/images/loading.svg +5 -0
  189. package/source/images/redefine-avatar.svg +1 -0
  190. package/source/images/redefine-favicon.svg +1 -0
  191. package/source/images/redefine-logo.svg +1 -0
  192. package/source/images/redefine-logo.webp +0 -0
  193. package/source/images/redefine-og.webp +0 -0
  194. package/source/images/wallhaven-wqery6-dark.webp +0 -0
  195. package/source/images/wallhaven-wqery6-light.webp +0 -0
  196. package/source/js/build/layouts/bookmarkNav.js +2 -0
  197. package/source/js/build/layouts/bookmarkNav.js.map +1 -0
  198. package/source/js/build/layouts/categoryList.js +2 -0
  199. package/source/js/build/layouts/categoryList.js.map +1 -0
  200. package/source/js/build/layouts/essays.js +2 -0
  201. package/source/js/build/layouts/essays.js.map +1 -0
  202. package/source/js/build/layouts/lazyload.js +2 -0
  203. package/source/js/build/layouts/lazyload.js.map +1 -0
  204. package/source/js/build/layouts/navbarShrink.js +2 -0
  205. package/source/js/build/layouts/navbarShrink.js.map +1 -0
  206. package/source/js/build/layouts/toc.js +2 -0
  207. package/source/js/build/layouts/toc.js.map +1 -0
  208. package/source/js/build/libs/APlayer.min.js +2 -0
  209. package/source/js/build/libs/Swup.min.js +2 -0
  210. package/source/js/build/libs/SwupPreloadPlugin.min.js +1 -0
  211. package/source/js/build/libs/SwupProgressPlugin.min.js +1 -0
  212. package/source/js/build/libs/SwupScriptsPlugin.min.js +1 -0
  213. package/source/js/build/libs/SwupScrollPlugin.min.js +1 -0
  214. package/source/js/build/libs/SwupSlideTheme.min.js +1 -0
  215. package/source/js/build/libs/Typed.min.js +10 -0
  216. package/source/js/build/libs/anime.min.js +8 -0
  217. package/source/js/build/libs/mermaid.min.js +2314 -0
  218. package/source/js/build/libs/minimasonry.min.js +1 -0
  219. package/source/js/build/libs/moment-with-locales.min.js +2 -0
  220. package/source/js/build/libs/moment.min.js +2 -0
  221. package/source/js/build/libs/odometer.min.js +2 -0
  222. package/source/js/build/libs/pangu.min.js +9 -0
  223. package/source/js/build/libs/pjax.min.js +1 -0
  224. package/source/js/build/libs/waline.js +84 -0
  225. package/source/js/build/main.js +2 -0
  226. package/source/js/build/main.js.map +1 -0
  227. package/source/js/build/plugins/aplayer.js +2 -0
  228. package/source/js/build/plugins/aplayer.js.map +1 -0
  229. package/source/js/build/plugins/hbe.js +2 -0
  230. package/source/js/build/plugins/hbe.js.map +1 -0
  231. package/source/js/build/plugins/masonry.js +2 -0
  232. package/source/js/build/plugins/masonry.js.map +1 -0
  233. package/source/js/build/plugins/mermaid.js +2 -0
  234. package/source/js/build/plugins/mermaid.js.map +1 -0
  235. package/source/js/build/plugins/pangu.js +2 -0
  236. package/source/js/build/plugins/pangu.js.map +1 -0
  237. package/source/js/build/plugins/tabs.js +2 -0
  238. package/source/js/build/plugins/tabs.js.map +1 -0
  239. package/source/js/build/plugins/typed.js +2 -0
  240. package/source/js/build/plugins/typed.js.map +1 -0
  241. package/source/js/build/tools/codeBlock.js +2 -0
  242. package/source/js/build/tools/codeBlock.js.map +1 -0
  243. package/source/js/build/tools/imageViewer.js +2 -0
  244. package/source/js/build/tools/imageViewer.js.map +1 -0
  245. package/source/js/build/tools/lightDarkSwitch.js +2 -0
  246. package/source/js/build/tools/lightDarkSwitch.js.map +1 -0
  247. package/source/js/build/tools/localSearch.js +2 -0
  248. package/source/js/build/tools/localSearch.js.map +1 -0
  249. package/source/js/build/tools/runtime.js +2 -0
  250. package/source/js/build/tools/runtime.js.map +1 -0
  251. package/source/js/build/tools/scrollTopBottom.js +2 -0
  252. package/source/js/build/tools/scrollTopBottom.js.map +1 -0
  253. package/source/js/build/tools/tocToggle.js +2 -0
  254. package/source/js/build/tools/tocToggle.js.map +1 -0
  255. package/source/js/build/utils.js +2 -0
  256. package/source/js/build/utils.js.map +1 -0
  257. package/source/js/build.js +148 -0
  258. package/source/js/layouts/bookmarkNav.js +65 -0
  259. package/source/js/layouts/categoryList.js +53 -0
  260. package/source/js/layouts/essays.js +25 -0
  261. package/source/js/layouts/lazyload.js +199 -0
  262. package/source/js/layouts/navbarShrink.js +135 -0
  263. package/source/js/layouts/toc.js +115 -0
  264. package/source/js/libs/APlayer.min.js +2 -0
  265. package/source/js/libs/APlayer.min.js.map +1 -0
  266. package/source/js/libs/Swup.min.js +2 -0
  267. package/source/js/libs/Swup.min.js.map +1 -0
  268. package/source/js/libs/SwupPreloadPlugin.min.js +1 -0
  269. package/source/js/libs/SwupPreloadPlugin.min.js.map +1 -0
  270. package/source/js/libs/SwupProgressPlugin.min.js +1 -0
  271. package/source/js/libs/SwupScriptsPlugin.min.js +1 -0
  272. package/source/js/libs/SwupScrollPlugin.min.js +1 -0
  273. package/source/js/libs/SwupScrollPlugin.min.js.map +1 -0
  274. package/source/js/libs/SwupSlideTheme.min.js +1 -0
  275. package/source/js/libs/Typed.min.js +10 -0
  276. package/source/js/libs/anime.min.js +8 -0
  277. package/source/js/libs/mermaid.min.js +2314 -0
  278. package/source/js/libs/mermaid.min.js.map +7 -0
  279. package/source/js/libs/minimasonry.min.js +1 -0
  280. package/source/js/libs/moment-with-locales.min.js +2 -0
  281. package/source/js/libs/moment.min.js +2 -0
  282. package/source/js/libs/odometer.min.js +2 -0
  283. package/source/js/libs/pangu.min.js +9 -0
  284. package/source/js/libs/pjax.min.js +1 -0
  285. package/source/js/libs/waline.js +84 -0
  286. package/source/js/libs/waline.js.map +1 -0
  287. package/source/js/main.js +95 -0
  288. package/source/js/plugins/aplayer.js +33 -0
  289. package/source/js/plugins/hbe.js +350 -0
  290. package/source/js/plugins/masonry.js +115 -0
  291. package/source/js/plugins/mermaid.js +7 -0
  292. package/source/js/plugins/pangu.js +12 -0
  293. package/source/js/plugins/tabs.js +29 -0
  294. package/source/js/plugins/typed.js +62 -0
  295. package/source/js/tools/codeBlock.js +48 -0
  296. package/source/js/tools/imageViewer.js +194 -0
  297. package/source/js/tools/lightDarkSwitch.js +165 -0
  298. package/source/js/tools/localSearch.js +327 -0
  299. package/source/js/tools/runtime.js +28 -0
  300. package/source/js/tools/scrollTopBottom.js +34 -0
  301. package/source/js/tools/tocToggle.js +58 -0
  302. package/source/js/utils.js +383 -0
  303. package/source/webfonts/fa-brands-400.ttf +0 -0
  304. package/source/webfonts/fa-brands-400.woff2 +0 -0
  305. package/source/webfonts/fa-duotone-900.ttf +0 -0
  306. package/source/webfonts/fa-duotone-900.woff2 +0 -0
  307. package/source/webfonts/fa-light-300.ttf +0 -0
  308. package/source/webfonts/fa-light-300.woff2 +0 -0
  309. package/source/webfonts/fa-regular-400.ttf +0 -0
  310. package/source/webfonts/fa-regular-400.woff2 +0 -0
  311. package/source/webfonts/fa-sharp-solid-900.ttf +0 -0
  312. package/source/webfonts/fa-sharp-solid-900.woff2 +0 -0
  313. package/source/webfonts/fa-solid-900.ttf +0 -0
  314. package/source/webfonts/fa-solid-900.woff2 +0 -0
  315. package/source/webfonts/fa-thin-100.ttf +0 -0
  316. package/source/webfonts/fa-thin-100.woff2 +0 -0
  317. package/source/webfonts/fa-v4compatibility.ttf +0 -0
  318. package/source/webfonts/fa-v4compatibility.woff2 +0 -0
  319. package/vercel.json +7 -0
@@ -0,0 +1,51 @@
1
+ <div class="side-tools-container">
2
+ <ul class="hidden-tools-list">
3
+ <li class="right-bottom-tools tool-font-adjust-plus flex justify-center items-center">
4
+ <i class="fa-regular fa-magnifying-glass-plus"></i>
5
+ </li>
6
+
7
+ <li class="right-bottom-tools tool-font-adjust-minus flex justify-center items-center">
8
+ <i class="fa-regular fa-magnifying-glass-minus"></i>
9
+ </li>
10
+
11
+ <li class="right-bottom-tools tool-dark-light-toggle flex justify-center items-center">
12
+ <i class="fa-regular fa-moon"></i>
13
+ </li>
14
+
15
+ <!-- rss -->
16
+ <% if (theme.plugins.feed.enable && config.feed) { %>
17
+ <li class="right-bottom-tools rss flex justify-center items-center">
18
+ <a class="flex justify-center items-center" href="<%= '/' + config.feed.path %>" target="_blank">
19
+ <i class="fa-regular fa-rss"></i>
20
+ </a>
21
+ </li>
22
+ <% } %>
23
+
24
+ <% if (theme.global.scroll_progress.percentage !== true) { %>
25
+ <li class="right-bottom-tools tool-scroll-to-top flex justify-center items-center">
26
+ <i class="fa-regular fa-arrow-up"></i>
27
+ </li>
28
+ <% } %>
29
+
30
+ <li class="right-bottom-tools tool-scroll-to-bottom flex justify-center items-center">
31
+ <i class="fa-regular fa-arrow-down"></i>
32
+ </li>
33
+ </ul>
34
+
35
+ <ul class="visible-tools-list">
36
+ <li class="right-bottom-tools toggle-tools-list flex justify-center items-center">
37
+ <i class="fa-regular fa-cog <% if (theme.global.side_tools && theme.global.side_tools.gear_rotation !== false) { %>fa-spin<% } %>"></i>
38
+ </li>
39
+ <% if (theme.global.scroll_progress.percentage === true) { %>
40
+ <li class="right-bottom-tools tool-scroll-to-top flex justify-center items-center">
41
+ <i class="arrow-up fas fa-arrow-up"></i>
42
+ <span class="percent"></span>
43
+ </li>
44
+ <% } %>
45
+ <% if (theme.plugins.aplayer.enable && theme.plugins.aplayer.type === "mini") { %>
46
+ <li class="right-bottom-tools tool-aplayer flex justify-center items-center">
47
+
48
+ </li>
49
+ <% } %>
50
+ </ul>
51
+ </div>
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "hexo-theme-redefine-x",
3
+ "version": "2.8.5",
4
+ "private": false,
5
+ "description": "Redefine-X your writing with Hexo Theme Redefine-X. A customized fork of hexo-theme-redefine.",
6
+ "scripts": {
7
+ "npm:publish": "npm run build && npm publish",
8
+ "build": "npm run build:css && npm run build:js",
9
+ "build:css": "npx @tailwindcss/cli -i source/css/tailwind.source.css -o source/css/build/tailwind.css --minify",
10
+ "build:js": "node source/js/build.js",
11
+ "watch:css": "npx @tailwindcss/cli -i source/css/tailwind.source.css -o source/css/build/tailwind.css --watch --minify",
12
+ "release": "npx standard-version",
13
+ "release:minor": "npx standard-version --release-as minor",
14
+ "release:patch": "npx standard-version --release-as patch",
15
+ "release:major": "npx standard-version --release-as major"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/Jason-JP-Yang/hexo-theme-Redefine-X.git"
20
+ },
21
+ "keywords": [
22
+ "hexo",
23
+ "theme",
24
+ "redefine",
25
+ "redefine-x",
26
+ "simple",
27
+ "pure",
28
+ "powerful",
29
+ "hexo-theme"
30
+ ],
31
+ "author": "Jason-JP-Yang",
32
+ "license": "GPL-3.0",
33
+ "bugs": {
34
+ "url": "https://github.com/Jason-JP-Yang/hexo-theme-Redefine-X/issues"
35
+ },
36
+ "homepage": "https://redefine-x-docs.jason-yang.top/zh",
37
+ "devDependencies": {
38
+ "eslint": "^8.47.0",
39
+ "glob-promise": "^6.0.7",
40
+ "postcss": "^8.4.47",
41
+ "standard-version": "^9.5.0",
42
+ "tailwindcss": "^4.1.11",
43
+ "terser": "^5.36.0"
44
+ }
45
+ }
@@ -0,0 +1,66 @@
1
+ /* main hexo */
2
+
3
+ "use strict";
4
+
5
+ const url = require("url");
6
+ const fs = require("fs");
7
+ const path = require("path");
8
+ const yaml = require("js-yaml");
9
+ const { version } = require("../package.json");
10
+
11
+ /**
12
+ * Export theme config to js
13
+ */
14
+ hexo.extend.helper.register("export_config", function () {
15
+ let hexo_config = {
16
+ hostname: new URL(this.config.url).hostname || this.config.url,
17
+ root: this.config.root,
18
+ language: this.config.language,
19
+ };
20
+
21
+ if (this.config.search) {
22
+ hexo_config.path = this.config.search.path;
23
+ }
24
+
25
+ let theme_config = {
26
+ articles: this.theme.articles,
27
+ colors: this.theme.colors,
28
+ global: this.theme.global,
29
+ home_banner: this.theme.home_banner,
30
+ plugins: this.theme.plugins,
31
+ version: version,
32
+ code_block: this.theme.code_block,
33
+ navbar: this.theme.navbar,
34
+ page_templates: this.theme.page_templates,
35
+ home: this.theme.home,
36
+
37
+ footerStart: this.theme.footer.start,
38
+ };
39
+
40
+ const languageDir = path.join(__dirname, "../languages");
41
+ let file = fs
42
+ .readdirSync(languageDir)
43
+ .find((v) => v === `${this.config.language}.yml`);
44
+ file = languageDir + "/" + (file ? file : "en.yml");
45
+ let languageContent = fs.readFileSync(file, "utf8");
46
+ try {
47
+ languageContent = yaml.load(languageContent);
48
+ } catch (e) {
49
+ console.log(e);
50
+ }
51
+
52
+ let data_config = {
53
+ masonry: false,
54
+ };
55
+
56
+ if (this.theme.masonry) {
57
+ data_config.masonry = true;
58
+ }
59
+
60
+ return `<script id="hexo-configurations">
61
+ window.config = ${JSON.stringify(hexo_config)};
62
+ window.theme = ${JSON.stringify(theme_config)};
63
+ window.lang_ago = ${JSON.stringify(languageContent["ago"])};
64
+ window.data = ${JSON.stringify(data_config)};
65
+ </script>`;
66
+ });
@@ -0,0 +1,37 @@
1
+ hexo.on('generateBefore', function () {
2
+
3
+ if (hexo.locals.get) {
4
+ const data = hexo.locals.get('data');
5
+
6
+ if (data) {
7
+ // theme config file handle
8
+ if (data._config) {
9
+ hexo.theme.config = data._config;
10
+
11
+ } else if (data.redefine) {
12
+ hexo.theme.config = data.redefine;
13
+
14
+ } else if (data._redefine) {
15
+ hexo.theme.config = data._redefine;
16
+ }
17
+
18
+ // friends link file handle
19
+ if (data.links || data.link) {
20
+ hexo.theme.config.links = (data.links || data.link);
21
+ }
22
+
23
+ if (data.essays || data.essay || data.shuoshuo) {
24
+ hexo.theme.config.essays = (data.essays || data.essay || data.shuoshuo);
25
+ }
26
+
27
+ if (data.masonry || data.gallery || data.photos) {
28
+ hexo.theme.config.masonry = (data.masonry || data.gallery || data.photos);
29
+ }
30
+
31
+ if (data.bookmarks || data.tools) {
32
+ hexo.theme.config.bookmarks = data.bookmarks || data.tools;
33
+ }
34
+
35
+ }
36
+ }
37
+ });
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Theme Redefine
3
+ * 404 error page
4
+ */
5
+
6
+ hexo.extend.generator.register('404', function (locals) {
7
+ return {
8
+ path: '404.html',
9
+ layout: '404',
10
+ data: {
11
+ title: 'Page Not Found',
12
+ type: 'notfound',
13
+ page: locals.pages.findOne({ path: '404.html' })
14
+ }
15
+ }
16
+ });
@@ -0,0 +1,141 @@
1
+ /**
2
+ * Theme Redefine
3
+ * welcome.js
4
+ */
5
+ const { version } = require("../../package.json");
6
+ const https = require("https");
7
+
8
+ hexo.on("ready", async () => {
9
+ const timeout = 3000;
10
+
11
+ async function fetchRedefineInfo() {
12
+ return new Promise((resolve, reject) => {
13
+ https
14
+ .get(
15
+ `https://redefine-version.ohevan.com/api/v2/info`,
16
+ { timeout: timeout },
17
+ (response) => {
18
+ if (response.statusCode < 200 || response.statusCode > 299) {
19
+ logFailedInfo();
20
+ return reject(
21
+ new Error(
22
+ `Failed to load page, status code: ${response.statusCode}`,
23
+ ),
24
+ );
25
+ }
26
+ let data = "";
27
+ response.on("data", (chunk) => {
28
+ data += chunk;
29
+ });
30
+ response.on("end", () => {
31
+ try {
32
+ const jsonData = JSON.parse(data);
33
+
34
+ if (jsonData.status !== "success") {
35
+ logFailedInfo();
36
+ return reject(
37
+ new Error(`Failed to fetch data: ${jsonData.message}`),
38
+ );
39
+ }
40
+
41
+ const redefineData = jsonData.data;
42
+
43
+ logInfo(redefineData);
44
+ checkVersionAndCDNAvailability(redefineData);
45
+ resolve();
46
+ } catch (error) {
47
+ logFailedInfo();
48
+ reject(new Error(`JSON parse failed: ${error.message}`));
49
+ }
50
+ });
51
+ },
52
+ )
53
+ .on("error", (error) => {
54
+ reject(error);
55
+ });
56
+ });
57
+ }
58
+
59
+ try {
60
+ await fetchRedefineInfo();
61
+ } catch (error) {
62
+ hexo.log.warn(`Check latest version failed: ${error}`);
63
+ hexo.locals.set(`cdnTestStatus_cdnjs`, 404);
64
+ hexo.locals.set(`cdnTestStatus_zstatic`, 404);
65
+ hexo.locals.set(`cdnTestStatus_npmMirror`, 404);
66
+ }
67
+ });
68
+
69
+ function logInfo(data) {
70
+ hexo.log.info(
71
+ `
72
+ +=====================================================================================+
73
+ | |
74
+ | ██████╗ ███████╗██████╗ ███████╗███████╗██╗███╗ ██╗███████╗ ██╗ ██╗ |
75
+ | ██╔══██╗██╔════╝██╔══██╗██╔════╝██╔════╝██║████╗ ██║██╔════╝ ╚██╗██╔╝ |
76
+ | ██████╔╝█████╗ ██║ ██║█████╗ █████╗ ██║██╔██╗ ██║█████╗█████╗╚███╔╝ |
77
+ | ██╔══██╗██╔══╝ ██║ ██║██╔══╝ ██╔══╝ ██║██║╚██╗██║██╔══╝╚════╝██╔██╗ |
78
+ | ██║ ██║███████╗██████╔╝███████╗██║ ██║██║ ╚████║███████╗ ██╔╝ ██╗ |
79
+ | ╚═╝ ╚═╝╚══════╝╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝╚══════╝ ╚═╝ ╚═╝ |
80
+ | |
81
+ | current v${version} latest v${data.npmVersion} |
82
+ | https://github.com/Jason-JP-Yang/hexo-theme-Redefine-X |
83
+ +=====================================================================================+
84
+ `,
85
+ );
86
+ }
87
+
88
+ function logFailedInfo() {
89
+ hexo.log.info(
90
+ `
91
+ +=====================================================================================+
92
+ | |
93
+ | ██████╗ ███████╗██████╗ ███████╗███████╗██╗███╗ ██╗███████╗ ██╗ ██╗ |
94
+ | ██╔══██╗██╔════╝██╔══██╗██╔════╝██╔════╝██║████╗ ██║██╔════╝ ╚██╗██╔╝ |
95
+ | ██████╔╝█████╗ ██║ ██║█████╗ █████╗ ██║██╔██╗ ██║█████╗█████╗╚███╔╝ |
96
+ | ██╔══██╗██╔══╝ ██║ ██║██╔══╝ ██╔══╝ ██║██║╚██╗██║██╔══╝╚════╝██╔██╗ |
97
+ | ██║ ██║███████╗██████╔╝███████╗██║ ██║██║ ╚████║███████╗ ██╔╝ ██╗ |
98
+ | ╚═╝ ╚═╝╚══════╝╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝╚══════╝ ╚═╝ ╚═╝ |
99
+ | |
100
+ | current v${version} fetch latest failed |
101
+ | https://github.com/Jason-JP-Yang/hexo-theme-Redefine-X |
102
+ +=====================================================================================+
103
+ `,
104
+ );
105
+ }
106
+
107
+ function checkVersionAndCDNAvailability(data) {
108
+ if (data.npmVersion > version) {
109
+ hexo.log.warn(
110
+ `\x1b[33m-X%s\x1b[0m`,
111
+ `Redefine v${version} is outdated, please update to v${data.npmVersion}!`,
112
+ );
113
+ }
114
+
115
+ if (data.npmMirrorCDN) {
116
+ hexo.log.info(
117
+ `\x1b[32m%s\x1b[0m`,
118
+ `CDN available: NPMMirror (Recommended)`,
119
+ );
120
+ hexo.locals.set(`cdnTestStatus_npmMirror`, 200);
121
+ } else {
122
+ hexo.log.warn(`\x1b[31m%s\x1b[0m`, `NPMMirror CDN is unavailable yet.`);
123
+ hexo.locals.set(`cdnTestStatus_npmMirror`, 404);
124
+ }
125
+
126
+ if (data.zstaticCDN) {
127
+ hexo.log.info(`\x1b[32m%s\x1b[0m`, `CDN available: ZStatic`);
128
+ hexo.locals.set(`cdnTestStatus_zstatic`, 200);
129
+ } else {
130
+ hexo.log.warn(`\x1b[31m%s\x1b[0m`, `ZStatic CDN is unavailable yet.`);
131
+ hexo.locals.set(`cdnTestStatus_zstatic`, 404);
132
+ }
133
+
134
+ if (data.cdnjsCDN) {
135
+ hexo.log.info(`\x1b[32m%s\x1b[0m`, `CDN available: CDNJS`);
136
+ hexo.locals.set(`cdnTestStatus_cdnjs`, 200);
137
+ } else {
138
+ hexo.log.warn(`\x1b[31m%s\x1b[0m`, `CDNJS CDN is unavailable yet.`);
139
+ hexo.locals.set(`cdnTestStatus_cdnjs`, 404);
140
+ }
141
+ }
@@ -0,0 +1,27 @@
1
+ /* delete mask */
2
+
3
+ "use strict";
4
+
5
+ hexo.extend.filter.register(
6
+ "after_post_render",
7
+ function (data) {
8
+ const theme = this.theme;
9
+
10
+ // 处理del标签的代码
11
+ const regPureDelTag = /<del(?:\s+[^>]*)?>((?:(?!<\/?del[\s>])[^])*)<\/del>/g;
12
+
13
+ data.content = data.content.replace(
14
+ regPureDelTag,
15
+ function (match, html) {
16
+ // 只有在配置为true时才添加mask类
17
+ if (theme.config.articles.style.delete_mask === true) {
18
+ return `<del class="mask">${html}</del>`;
19
+ }
20
+ return match;
21
+ }
22
+ );
23
+
24
+ return data;
25
+ },
26
+ 0
27
+ );
@@ -0,0 +1,202 @@
1
+ /* main hexo, __dirname */
2
+
3
+ "use strict";
4
+
5
+ const crypto = require("crypto");
6
+ const fs = require("fs");
7
+ const path = require("path");
8
+ const log = hexo.log;
9
+ const { hbeTheme } = require("./lib/hbe.default.js");
10
+
11
+ const defaultConfig = {
12
+ abstract:
13
+ "Here's something encrypted, password is required to continue reading.",
14
+ message: "Hey, password is required here.",
15
+ theme: "default",
16
+ wrong_pass_message:
17
+ "Oh, this is an invalid password. Check and try again, please.",
18
+ wrong_hash_message:
19
+ "OOPS, these decrypted content may changed, but you can still have a look.",
20
+ silent: false,
21
+ };
22
+
23
+ const keySalt = textToArray("too young too simple");
24
+ const ivSalt = textToArray("sometimes naive!");
25
+
26
+ // As we can't detect the wrong password with AES-CBC,
27
+ // so adding an empty tag and check it when decrption.
28
+ const knownPrefix = "<hbe-prefix></hbe-prefix>";
29
+
30
+ // disable log
31
+ var silent = false;
32
+ // use default theme
33
+ var theme = "default";
34
+
35
+ hexo.extend.filter.register(
36
+ "after_post_render",
37
+ (data) => {
38
+ const tagEncryptPairs = [];
39
+
40
+ let password = data.password;
41
+ let tagUsed = false;
42
+
43
+ // use a empty password to disable category encryption
44
+ if (password === "") {
45
+ return data;
46
+ }
47
+
48
+ if (hexo.config.encrypt === undefined) {
49
+ hexo.config.encrypt = [];
50
+ }
51
+
52
+ if ("encrypt" in hexo.config && "tags" in hexo.config.encrypt) {
53
+ hexo.config.encrypt.tags.forEach((tagObj) => {
54
+ tagEncryptPairs[tagObj.name] = tagObj.password;
55
+ });
56
+ }
57
+
58
+ if (data.tags) {
59
+ data.tags.forEach((cTag) => {
60
+ if (tagEncryptPairs.hasOwnProperty(cTag.name)) {
61
+ tagUsed = password ? tagUsed : cTag.name;
62
+ password = password || tagEncryptPairs[cTag.name];
63
+ }
64
+ });
65
+ }
66
+
67
+ if (password == undefined) {
68
+ return data;
69
+ }
70
+
71
+ password = password.toString();
72
+
73
+ // make sure toc can work.
74
+ data.origin = data.content;
75
+
76
+ // Let's rock n roll
77
+ const config = Object.assign(defaultConfig, hexo.config.encrypt, data);
78
+ silent = config.silent;
79
+ theme = config.theme.trim().toLowerCase();
80
+
81
+ // deprecate the template keyword
82
+ if (config.template) {
83
+ dlog(
84
+ "warn",
85
+ 'Looks like you use a deprecated property "template" to set up template, consider to use "theme"? See https://github.com/D0n9X1n/hexo-blog-encrypt#encrypt-theme',
86
+ );
87
+ }
88
+
89
+ // read theme from file
90
+ let template = hbeTheme;
91
+
92
+ if (tagUsed === false) {
93
+ dlog(
94
+ "info",
95
+ `hexo-blog-encrypt: encrypting "${data.title.trim()}" based on the password configured in Front-matter with theme: ${theme}.`,
96
+ );
97
+ } else {
98
+ dlog(
99
+ "info",
100
+ `hexo-blog-encrypt: encrypting "${data.title.trim()}" based on Tag: "${tagUsed}" with theme ${theme}.`,
101
+ );
102
+ }
103
+
104
+ data.content = knownPrefix + data.content.trim();
105
+ data.encrypt = true;
106
+
107
+ const key = crypto.pbkdf2Sync(password, keySalt, 1024, 32, "sha256");
108
+ const iv = crypto.pbkdf2Sync(password, ivSalt, 512, 16, "sha256");
109
+
110
+ const cipher = crypto.createCipheriv("aes-256-cbc", key, iv);
111
+ const hmac = crypto.createHmac("sha256", key);
112
+
113
+ let encryptedData = cipher.update(data.content, "utf8", "hex");
114
+ hmac.update(data.content, "utf8");
115
+ encryptedData += cipher.final("hex");
116
+ const hmacDigest = hmac.digest("hex");
117
+
118
+ data.content = template
119
+ .replace(/{{hbeEncryptedData}}/g, encryptedData)
120
+ .replace(/{{hbeHmacDigest}}/g, hmacDigest)
121
+ .replace(/{{hbeWrongPassMessage}}/g, config.wrong_pass_message)
122
+ .replace(/{{hbeWrongHashMessage}}/g, config.wrong_hash_message)
123
+ .replace(/{{hbeMessage}}/g, config.message);
124
+ data.content += `<link href="${hexo.config.root}css/hbe.style.css" rel="stylesheet" type="text/css"><script data-swup-reload-script type="module" src="${hexo.config.root}js/plugins/hbe.js"></script>
125
+ <script data-swup-reload-script type="module">
126
+ import {initHBE} from "${hexo.config.root}js/plugins/hbe.js";
127
+ console.log("hexo-blog-encrypt: loaded.");
128
+ initHBE();
129
+ </script>
130
+ `;
131
+ data.excerpt = data.more = config.abstract;
132
+
133
+ return data;
134
+ },
135
+ 1000,
136
+ );
137
+
138
+ hexo.extend.generator.register("hexo-blog-encrypt", () => [
139
+ {
140
+ data: () =>
141
+ fs.createReadStream(
142
+ path.resolve(__dirname, `../../source/assets/hbe.style.css`),
143
+ ),
144
+ path: `css/hbe.style.css`,
145
+ },
146
+ {
147
+ data: () =>
148
+ fs.createReadStream(
149
+ path.resolve(__dirname, "../../source/js/plugins/hbe.js"),
150
+ ),
151
+ path: "js/plugins/hbe.js",
152
+ },
153
+ ]);
154
+
155
+ // log function
156
+ function dlog(level, x) {
157
+ switch (level) {
158
+ case "warn":
159
+ log.warn(x);
160
+ break;
161
+
162
+ case "info":
163
+ default:
164
+ if (silent) {
165
+ return;
166
+ }
167
+
168
+ log.info(x);
169
+ }
170
+ }
171
+
172
+ // Utils functions
173
+ function textToArray(s) {
174
+ var i = s.length;
175
+ var n = 0;
176
+ var ba = new Array();
177
+
178
+ for (var j = 0; j < i; ) {
179
+ var c = s.codePointAt(j);
180
+ if (c < 128) {
181
+ ba[n++] = c;
182
+ j++;
183
+ } else if (c > 127 && c < 2048) {
184
+ ba[n++] = (c >> 6) | 192;
185
+ ba[n++] = (c & 63) | 128;
186
+ j++;
187
+ } else if (c > 2047 && c < 65536) {
188
+ ba[n++] = (c >> 12) | 224;
189
+ ba[n++] = ((c >> 6) & 63) | 128;
190
+ ba[n++] = (c & 63) | 128;
191
+ j++;
192
+ } else {
193
+ ba[n++] = (c >> 18) | 240;
194
+ ba[n++] = ((c >> 12) & 63) | 128;
195
+ ba[n++] = ((c >> 6) & 63) | 128;
196
+ ba[n++] = (c & 63) | 128;
197
+ j += 2;
198
+ }
199
+ }
200
+
201
+ return new Uint8Array(ba);
202
+ }
@@ -0,0 +1,9 @@
1
+ hexo.extend.filter.register('after_post_render', function(data) {
2
+ if (this.theme.config.articles.style.image_caption !== false) {
3
+ const class_name='image-caption';
4
+ if (data.layout === 'post' || data.layout === 'page' || data.layout === 'about') {
5
+ data.content = data.content.replace(/(<img [^>]*alt="([^"]+)"[^>]*>)/g, `<figure class="${class_name}">$1<figcaption>$2</figcaption></figure>`);
6
+ }
7
+ }
8
+ return data;
9
+ });