hexo-theme-shokax 0.2.5-beta1 → 0.2.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.
package/_config.yml CHANGED
@@ -202,6 +202,7 @@ summary:
202
202
  enable: false
203
203
  introduce: "我是基于ChatGPT-turbo-3.5实现的AI助手,在此网站上负责整理和概括文章" # AI自我介绍
204
204
  mode: openai # openai/custom
205
+ pricing: "trial" # trial为试用模板(3 RPM);pay为即用即付模板(60 RPM)
205
206
  openai:
206
207
  remote: "https://api.openai.com"
207
208
  apikey: "key"
@@ -351,7 +352,7 @@ advVendors:
351
352
  pace:
352
353
  src: bytedance:pace/1.0.2/pace.min.js
353
354
  pjax:
354
- src: baomitu:pjax/0.2.8/pjax.min.js
355
+ src: npm:theme-shokax-pjax@latest/pjax.shokax.min.js
355
356
  fetch:
356
357
  src: npm:whatwg-fetch@3.4.0/dist/fetch.umd.js
357
358
  anime:
@@ -403,7 +404,7 @@ vendors:
403
404
 
404
405
  js:
405
406
  pace: npm/pace-js@1.0.2/pace.min.js # ok
406
- pjax: npm/pjax@0.2.8/pjax.min.js # ok
407
+ pjax: npm/theme-shokax-pjax@latest/pjax.shokax.min.js # ok
407
408
  fetch: npm/whatwg-fetch@3.4.0/dist/fetch.umd.min.js # ok
408
409
  anime: npm/theme-shokax-anime@latest/anime.shokax.min.js
409
410
  algolia: npm/algoliasearch@4/dist/algoliasearch-lite.umd.js # ok
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "hexo-theme-shokax",
3
- "version": "0.2.5-beta1",
3
+ "version": "0.2.5",
4
4
  "description": "a hexo theme based on shoka",
5
5
  "main": "index.js",
6
- "repository": "https://github.com/zkz098/hexo-theme-shokaX",
6
+ "repository": "https://github.com/theme-shoka-x/hexo-theme-shokaX",
7
7
  "author": "Chou kaitaku",
8
8
  "license": "GPL-3.0-or-later",
9
9
  "scripts": {
@@ -34,8 +34,8 @@
34
34
  "hexo-fs": "^4.1.1",
35
35
  "hexo-util": "^3.0.1",
36
36
  "instantsearch.js": "^4.54.1",
37
- "pjax": "^0.2.8",
38
37
  "theme-shokax-anime": "^0.0.4",
38
+ "theme-shokax-pjax": "^0.0.2",
39
39
  "typescript": "^5.0.4",
40
40
  "vue": "^3.2.47",
41
41
  "vuepress": "2.0.0-beta.61",
@@ -58,14 +58,14 @@ function postMessage(path, content, dbPath, startMessage) {
58
58
  });
59
59
  });
60
60
  };
61
- const checkTime = () => {
61
+ const checkTime = (waitTime) => {
62
62
  if (node_fs_1.default.existsSync('request.lock')) {
63
63
  if (node_fs_1.default.existsSync('requested.lock')) {
64
- setTimeout(checkTime, 1000 * 10);
64
+ setTimeout(checkTime, 1000 * waitTime);
65
65
  return;
66
66
  }
67
67
  node_fs_1.default.writeFileSync('requested.lock', '');
68
- setTimeout(request, 1000 * 20);
68
+ setTimeout(request, 1000 * 2.5 * waitTime);
69
69
  node_fs_1.default.unlinkSync('request.lock');
70
70
  }
71
71
  else {
@@ -82,7 +82,15 @@ function postMessage(path, content, dbPath, startMessage) {
82
82
  messages: [{ role: 'user', content: `${startMessage} ${content}` }],
83
83
  temperature: 0.7
84
84
  };
85
- checkTime();
85
+ if (config.pricing === 'trial') {
86
+ hexo.log.info('Requesting OpenAI API... (3 RPM mode)');
87
+ hexo.log.info('It may take 20 minutes or more (depending on the number of articles, each one takes 25 seconds)');
88
+ checkTime(10);
89
+ }
90
+ else {
91
+ hexo.log.info('Requesting OpenAI API... (60 RPM mode)');
92
+ checkTime(0.5);
93
+ }
86
94
  }
87
95
  else {
88
96
  }
@@ -6,8 +6,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const injects_1 = __importDefault(require("./lib/injects"));
7
7
  const node_https_1 = __importDefault(require("node:https"));
8
8
  const package_json_1 = require("../../package.json");
9
+ const node_fs_1 = __importDefault(require("node:fs"));
9
10
  hexo.on('generateBefore', () => {
10
11
  (0, injects_1.default)(hexo);
12
+ if (node_fs_1.default.existsSync('request.lock')) {
13
+ node_fs_1.default.unlinkSync('request.lock');
14
+ }
15
+ if (node_fs_1.default.existsSync('requested.lock')) {
16
+ node_fs_1.default.unlinkSync('requested.lock');
17
+ }
11
18
  });
12
19
  hexo.on('generateAfter', () => {
13
20
  node_https_1.default.get('https://api.github.com/repos/theme-shoka-x/hexo-theme-shokaX/releases/latest', {
@@ -666,7 +666,6 @@ const siteInit = function () {
666
666
  '.leancloud-recent-comment',
667
667
  'script[data-config]'
668
668
  ],
669
- analytics: false,
670
669
  cacheBust: false
671
670
  });
672
671
  CONFIG.quicklink.ignores = LOCAL.ignores;
@@ -425,7 +425,7 @@ const mediaPlayer = function (t, config) {
425
425
  t.player = {
426
426
  _id: utils.random(999999),
427
427
  group: true,
428
- load: (newList) => {
428
+ load: function (newList) {
429
429
  let d = '';
430
430
  if (newList && newList.length > 0) {
431
431
  if (this.options.rawList !== newList) {
@@ -483,7 +483,7 @@ const mediaPlayer = function (t, config) {
483
483
  }
484
484
  });
485
485
  },
486
- mode: () => {
486
+ mode: function () {
487
487
  const total = playlist.data.length;
488
488
  if (!total || playlist.errnum === total) {
489
489
  return;
@@ -523,7 +523,7 @@ const mediaPlayer = function (t, config) {
523
523
  }
524
524
  this.init();
525
525
  },
526
- switch: (index) => {
526
+ switch: function (index) {
527
527
  if (typeof index === 'number' &&
528
528
  index !== playlist.index &&
529
529
  playlist.current() &&
@@ -532,7 +532,7 @@ const mediaPlayer = function (t, config) {
532
532
  this.init();
533
533
  }
534
534
  },
535
- init: () => {
535
+ init: function () {
536
536
  const item = playlist.current();
537
537
  if (!item || item.error) {
538
538
  this.mode();
@@ -555,7 +555,7 @@ const mediaPlayer = function (t, config) {
555
555
  this.play();
556
556
  }
557
557
  },
558
- play: () => {
558
+ play: function () {
559
559
  NOWPLAYING && NOWPLAYING.player.pause();
560
560
  if (playlist.current().error) {
561
561
  this.mode();
@@ -608,7 +608,7 @@ const mediaPlayer = function (t, config) {
608
608
  el: null,
609
609
  data: null,
610
610
  index: 0,
611
- create: (box) => {
611
+ create: function (box) {
612
612
  const current = playlist.index;
613
613
  const raw = playlist.current().lrc;
614
614
  const callback = function (body) {