yz-yuki-plugin 2.0.5-0 → 2.0.5-10
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/.puppeteerrc.cjs +1 -1
- package/CHANGELOG.md +3 -0
- package/README.md +15 -21
- package/defaultConfig/bilibili/config.yaml +11 -1
- package/defaultConfig/help/help.yaml +2 -2
- package/lib/apps/bilibili.js +6 -6
- package/lib/apps/help.js +1 -1
- package/lib/apps/version.js +1 -1
- package/lib/apps/weibo.js +1 -1
- package/lib/components/dynamic/Footer.js +1 -1
- package/lib/components/help/Help.js +1 -1
- package/lib/components/version/Version.js +1 -1
- package/lib/index.js +2 -2
- package/lib/main.js +11 -0
- package/lib/models/bilibili/bilibili.main.api.js +125 -0
- package/lib/models/bilibili/{bilibili.get.web.data.js → bilibili.main.get.web.data.js} +19 -10
- package/lib/models/bilibili/{bilibili.models.js → bilibili.main.models.js} +57 -45
- package/lib/models/bilibili/{bilibili.query.js → bilibili.main.query.js} +3 -3
- package/lib/models/bilibili/{bilibili.task.js → bilibili.main.task.js} +32 -39
- package/lib/models/bilibili/bilibili.risk.buid.fp.js +77 -0
- package/lib/models/bilibili/bilibili.risk.dm.img.js +17 -0
- package/lib/models/bilibili/{bilibili.ticket.js → bilibili.risk.ticket.js} +1 -1
- package/lib/models/bilibili/bilibili.risk.w_webid.js +43 -0
- package/lib/models/weibo/weibo.get.web.data.js +1 -1
- package/lib/models/weibo/weibo.query.js +1 -1
- package/lib/models/weibo/weibo.task.js +8 -6
- package/lib/utils/config.js +3 -3
- package/lib/utils/image.js +4 -4
- package/package.json +20 -35
- package/lib/apps/bilibili.d.ts +0 -6
- package/lib/apps/help.d.ts +0 -6
- package/lib/apps/index.d.ts +0 -4
- package/lib/apps/version.d.ts +0 -6
- package/lib/apps/weibo.d.ts +0 -6
- package/lib/components/dynamic/Account.d.ts +0 -13
- package/lib/components/dynamic/Content.d.ts +0 -12
- package/lib/components/dynamic/Footer.d.ts +0 -11
- package/lib/components/dynamic/ForwardContent.d.ts +0 -6
- package/lib/components/dynamic/LogoText.d.ts +0 -9
- package/lib/components/dynamic/MainPage.d.ts +0 -34
- package/lib/components/help/Help.d.ts +0 -12
- package/lib/components/index.d.ts +0 -5
- package/lib/components/loginQrcode/Page.d.ts +0 -7
- package/lib/components/version/Version.d.ts +0 -8
- package/lib/index.d.ts +0 -5
- package/lib/main.d.ts +0 -1
- package/lib/models/bilibili/bilibili.api.d.ts +0 -70
- package/lib/models/bilibili/bilibili.api.js +0 -78
- package/lib/models/bilibili/bilibili.buid.fp.d.ts +0 -2
- package/lib/models/bilibili/bilibili.get.web.data.d.ts +0 -9
- package/lib/models/bilibili/bilibili.models.d.ts +0 -63
- package/lib/models/bilibili/bilibili.query.d.ts +0 -49
- package/lib/models/bilibili/bilibili.task.d.ts +0 -77
- package/lib/models/bilibili/bilibili.ticket.d.ts +0 -12
- package/lib/models/bilibili/bilibili.wbi.d.ts +0 -11
- package/lib/models/help/help.d.ts +0 -8
- package/lib/models/version/version.d.ts +0 -17
- package/lib/models/weibo/weibo.api.d.ts +0 -18
- package/lib/models/weibo/weibo.get.web.data.d.ts +0 -11
- package/lib/models/weibo/weibo.query.d.ts +0 -38
- package/lib/models/weibo/weibo.task.d.ts +0 -84
- package/lib/utils/config.d.ts +0 -73
- package/lib/utils/image.d.ts +0 -15
- package/lib/utils/paths.d.ts +0 -22
- package/lib/utils/puppeteer.render.d.ts +0 -40
- package/public/output.css +0 -1
- package/resources/img/readme/mini-help.jpg +0 -0
- /package/lib/models/bilibili/{bilibili.wbi.js → bilibili.risk.wbi.js} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import QRCode from 'qrcode';
|
|
2
|
-
import { Redis, Bot, Segment } from '
|
|
2
|
+
import { Redis, Bot, Segment } from 'yunzaijs';
|
|
3
3
|
import Config from '../../utils/config.js';
|
|
4
4
|
import { renderPage } from '../../utils/image.js';
|
|
5
|
-
import { BiliGetWebData } from './bilibili.get.web.data.js';
|
|
6
|
-
import { readSyncCookie, postGateway } from './bilibili.models.js';
|
|
7
|
-
import { BiliQuery } from './bilibili.query.js';
|
|
5
|
+
import { BiliGetWebData } from './bilibili.main.get.web.data.js';
|
|
6
|
+
import { readSyncCookie, postGateway } from './bilibili.main.models.js';
|
|
7
|
+
import { BiliQuery } from './bilibili.main.query.js';
|
|
8
8
|
|
|
9
9
|
class BiliTask {
|
|
10
10
|
taskName;
|
|
@@ -17,36 +17,29 @@ class BiliTask {
|
|
|
17
17
|
this.privateKey = 'Yz:yuki:bili:upPush:private:';
|
|
18
18
|
}
|
|
19
19
|
async hendleEventDynamicData(uid, count = 0) {
|
|
20
|
+
let { cookie } = await readSyncCookie();
|
|
20
21
|
const resp = await new BiliGetWebData().getBiliDynamicListDataByUid(uid);
|
|
21
22
|
const resjson = await resp.data;
|
|
22
|
-
|
|
23
|
-
if (resjson.code === 0) {
|
|
24
|
-
return resjson;
|
|
25
|
-
}
|
|
26
|
-
else if (resjson.code === -352) {
|
|
23
|
+
if (!resjson || resjson.code !== 0 || resjson.code === -352) {
|
|
27
24
|
await postGateway(cookie);
|
|
28
|
-
if (count <
|
|
25
|
+
if (count < 2) {
|
|
29
26
|
await this.randomDelay(2000, 8000); // 随机延时2-8秒
|
|
30
27
|
await this.hendleEventDynamicData(uid, count + 1);
|
|
31
28
|
logger.error(`获取 ${uid} 动态,Gateway count:${String(count)}`);
|
|
32
29
|
}
|
|
33
30
|
else {
|
|
34
31
|
count = 0;
|
|
35
|
-
return resjson;
|
|
36
32
|
}
|
|
37
33
|
}
|
|
38
|
-
|
|
39
|
-
return resjson;
|
|
40
|
-
}
|
|
34
|
+
return resjson;
|
|
41
35
|
}
|
|
42
36
|
async runTask() {
|
|
43
37
|
let biliConfigData = await Config.getUserConfig('bilibili', 'config');
|
|
44
38
|
let biliPushData = await Config.getUserConfig('bilibili', 'push');
|
|
45
|
-
let interval = biliConfigData
|
|
46
|
-
let lastLiveStatus = JSON.parse(await Redis.get('yuki:bililive:lastlivestatus')) || {};
|
|
39
|
+
let interval = biliConfigData?.interval || 7200;
|
|
47
40
|
const uidMap = new Map(); // 存放group 和 private 对应所属 uid 与推送信息的映射
|
|
48
41
|
const dynamicList = {}; // 存放获取的所有动态,键为 uid,值为动态数组
|
|
49
|
-
await this.processBiliData(biliPushData, uidMap, dynamicList
|
|
42
|
+
await this.processBiliData(biliPushData, biliConfigData, uidMap, dynamicList);
|
|
50
43
|
let now = Date.now() / 1000; // 时间戳(秒)
|
|
51
44
|
await this.pushDynamicMessages(uidMap, dynamicList, now, interval, biliConfigData);
|
|
52
45
|
}
|
|
@@ -57,7 +50,8 @@ class BiliTask {
|
|
|
57
50
|
* @param dynamicList 动态列表
|
|
58
51
|
* @param lastLiveStatus 最后直播状态
|
|
59
52
|
*/
|
|
60
|
-
async processBiliData(biliPushData, uidMap, dynamicList
|
|
53
|
+
async processBiliData(biliPushData, biliConfigData, uidMap, dynamicList) {
|
|
54
|
+
let getDataRandomDelay = biliConfigData?.getDataRandomDelay || 8000; // 获取相邻up动态数据的随机延时间隔
|
|
61
55
|
const requestedDataOfUids = new Map(); // 存放已请求的 uid 映射
|
|
62
56
|
for (let chatType in biliPushData) {
|
|
63
57
|
// 遍历 group 和 private
|
|
@@ -68,41 +62,40 @@ class BiliTask {
|
|
|
68
62
|
for (let chatId in biliPushData[chatType]) {
|
|
69
63
|
const subUpsOfChat = Array.prototype.slice.call(biliPushData[chatType][chatId] || []);
|
|
70
64
|
for (let subInfoOfup of subUpsOfChat) {
|
|
71
|
-
if (!lastLiveStatus[subInfoOfup.uid]) {
|
|
72
|
-
lastLiveStatus[subInfoOfup.uid] = 0;
|
|
73
|
-
}
|
|
74
65
|
let resp;
|
|
75
66
|
// 检查是否已经请求过该 uid
|
|
76
67
|
if (requestedDataOfUids.has(subInfoOfup.uid)) {
|
|
77
68
|
resp = requestedDataOfUids.get(subInfoOfup.uid); // 从已请求的映射中获取响应数据
|
|
69
|
+
const dynamicData = resp.data?.items || [];
|
|
70
|
+
dynamicList[subInfoOfup.uid] = dynamicData;
|
|
78
71
|
}
|
|
79
72
|
else {
|
|
80
73
|
resp = await this.hendleEventDynamicData(subInfoOfup.uid);
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
74
|
+
if (resp) {
|
|
75
|
+
if (resp.code === 0) {
|
|
76
|
+
requestedDataOfUids.set(subInfoOfup.uid, resp); // 将响应数据存储到映射中
|
|
77
|
+
const dynamicData = resp.data?.items || [];
|
|
78
|
+
dynamicList[subInfoOfup.uid] = dynamicData;
|
|
79
|
+
}
|
|
80
|
+
else if (resp.code === -352) {
|
|
81
|
+
logger.error(`获取 ${subInfoOfup.uid} 动态失败,resCode:-352,请待下次任务自动重试`);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
else if (resp.code !== 0) {
|
|
85
|
+
logger.error(`获取 ${subInfoOfup.uid} 动态失败,resCode:${resp.code},请待下次任务自动重试`);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
91
88
|
}
|
|
92
|
-
else
|
|
93
|
-
logger.error(`获取 ${subInfoOfup.uid}
|
|
89
|
+
else {
|
|
90
|
+
logger.error(`获取 ${subInfoOfup.uid} 动态失败,无响应数据,请待下次任务自动重试`);
|
|
94
91
|
return;
|
|
95
92
|
}
|
|
96
93
|
}
|
|
97
|
-
else {
|
|
98
|
-
logger.error(`获取 ${subInfoOfup.uid} 动态失败,resp 为空`);
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
94
|
const chatIds = Array.from(new Set([...Object((chatTypeMap.get(subInfoOfup.uid) && chatTypeMap.get(subInfoOfup.uid).chatIds) || []), chatId]));
|
|
102
95
|
const bot_id = subInfoOfup.bot_id || [];
|
|
103
96
|
const { name, type } = subInfoOfup;
|
|
104
97
|
chatTypeMap.set(subInfoOfup.uid, { chatIds, bot_id, upName: name, type });
|
|
105
|
-
await this.randomDelay(
|
|
98
|
+
await this.randomDelay(2000, getDataRandomDelay); // 随机延时
|
|
106
99
|
}
|
|
107
100
|
}
|
|
108
101
|
}
|
|
@@ -180,7 +173,7 @@ class BiliTask {
|
|
|
180
173
|
let boxGrid = !!biliConfigData.boxGrid === false ? false : true; // 是否启用九宫格样式,默认为 true
|
|
181
174
|
let isSplit = !!biliConfigData.isSplit === false ? false : true; // 是否启用分片截图,默认为 true
|
|
182
175
|
let style = isSplit ? '' : `.unfold { max-height: ${biliConfigData?.noSplitHeight ?? 7500}px; }`; // 不启用分片截图模式的样式
|
|
183
|
-
let splitHeight = biliConfigData?.splitHeight
|
|
176
|
+
let splitHeight = biliConfigData?.splitHeight || 8000; // 分片截图高度,默认 8000, 单位 px,启用分片截图时生效
|
|
184
177
|
const urlQrcodeData = await QRCode.toDataURL(extentData?.url);
|
|
185
178
|
let renderData = this.buildRenderData(extentData, urlQrcodeData, boxGrid);
|
|
186
179
|
const ScreenshotOptionsData = {
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
class Murmur3 {
|
|
2
|
+
static MOD = 1n << 64n;
|
|
3
|
+
static C1 = 0x87c37b91114253d5n;
|
|
4
|
+
static C2 = 0x4cf5ad432745937fn;
|
|
5
|
+
static C3 = 0x52dce729n;
|
|
6
|
+
static C4 = 0x38495ab5n;
|
|
7
|
+
static R1 = 27n;
|
|
8
|
+
static R2 = 31n;
|
|
9
|
+
static R3 = 33n;
|
|
10
|
+
static M = 5n;
|
|
11
|
+
static hash(source, seed) {
|
|
12
|
+
let h1 = BigInt(seed);
|
|
13
|
+
let h2 = BigInt(seed);
|
|
14
|
+
let processed = 0;
|
|
15
|
+
for (let i = 0; i < source.length; i += 16) {
|
|
16
|
+
const chunk = source.slice(i, i + 16);
|
|
17
|
+
processed += chunk.length;
|
|
18
|
+
if (chunk.length === 16) {
|
|
19
|
+
const k1 = BigInt(chunk.slice(0, 8).reduce((acc, val, idx) => acc | (BigInt(val) << BigInt(8 * idx)), 0n));
|
|
20
|
+
const k2 = BigInt(chunk.slice(8).reduce((acc, val, idx) => acc | (BigInt(val) << BigInt(8 * idx)), 0n));
|
|
21
|
+
h1 ^= (Murmur3.rotateLeft((k1 * Murmur3.C1) % Murmur3.MOD, Murmur3.R2) * Murmur3.C2) % Murmur3.MOD;
|
|
22
|
+
h1 = ((Murmur3.rotateLeft(h1, Murmur3.R1) + h2) * Murmur3.M + Murmur3.C3) % Murmur3.MOD;
|
|
23
|
+
h2 ^= (Murmur3.rotateLeft((k2 * Murmur3.C2) % Murmur3.MOD, Murmur3.R3) * Murmur3.C1) % Murmur3.MOD;
|
|
24
|
+
h2 = ((Murmur3.rotateLeft(h2, Murmur3.R2) + h1) * Murmur3.M + Murmur3.C4) % Murmur3.MOD;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
let k1 = 0n;
|
|
28
|
+
let k2 = 0n;
|
|
29
|
+
for (let j = 0; j < chunk.length; j++) {
|
|
30
|
+
const byteVal = BigInt(chunk[j]);
|
|
31
|
+
if (j < 8) {
|
|
32
|
+
k1 |= byteVal << BigInt(8 * j);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
k2 |= byteVal << BigInt(8 * (j - 8));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
k1 = (Murmur3.rotateLeft((k1 * Murmur3.C1) % Murmur3.MOD, Murmur3.R2) * Murmur3.C2) % Murmur3.MOD;
|
|
39
|
+
h1 ^= k1;
|
|
40
|
+
h2 ^= (Murmur3.rotateLeft((k2 * Murmur3.C2) % Murmur3.MOD, Murmur3.R3) * Murmur3.C1) % Murmur3.MOD;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
h1 ^= BigInt(processed);
|
|
44
|
+
h2 ^= BigInt(processed);
|
|
45
|
+
h1 = (h1 + h2) % Murmur3.MOD;
|
|
46
|
+
h2 = (h2 + h1) % Murmur3.MOD;
|
|
47
|
+
h1 = Murmur3.fmix64(h1);
|
|
48
|
+
h2 = Murmur3.fmix64(h2);
|
|
49
|
+
h1 = (h1 + h2) % Murmur3.MOD;
|
|
50
|
+
h2 = (h2 + h1) % Murmur3.MOD;
|
|
51
|
+
return (h2 << BigInt(64)) | h1;
|
|
52
|
+
}
|
|
53
|
+
static rotateLeft(x, k) {
|
|
54
|
+
const index = Number(k);
|
|
55
|
+
const binStr = x.toString(2).padStart(64, '0');
|
|
56
|
+
return BigInt(`0b${binStr.slice(index)}${binStr.slice(0, index)}`);
|
|
57
|
+
}
|
|
58
|
+
static fmix64(k) {
|
|
59
|
+
const C1 = 0xff51afd7ed558ccdn;
|
|
60
|
+
const C2 = 0xc4ceb9fe1a85ec53n;
|
|
61
|
+
const R = 33;
|
|
62
|
+
let tmp = k;
|
|
63
|
+
tmp ^= tmp >> BigInt(R);
|
|
64
|
+
tmp = (tmp * C1) % Murmur3.MOD;
|
|
65
|
+
tmp ^= tmp >> BigInt(R);
|
|
66
|
+
tmp = (tmp * C2) % Murmur3.MOD;
|
|
67
|
+
tmp ^= tmp >> BigInt(R);
|
|
68
|
+
return tmp;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function gen_buvid_fp(uuid, seed) {
|
|
72
|
+
const source = new TextEncoder().encode(uuid);
|
|
73
|
+
const m = Murmur3.hash(source, seed);
|
|
74
|
+
return `${(m & (Murmur3.MOD - 1n)).toString(16)}${(m >> 64n).toString(16)}`;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export { gen_buvid_fp };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**获取dm参数 */
|
|
2
|
+
async function getDmImg() {
|
|
3
|
+
const dm_img_list = [];
|
|
4
|
+
//Buffer.from("WebGL 1", 'utf-8').toString("base64") //webgl version的值 WebGL 1 的base64 编码
|
|
5
|
+
const dm_img_str = 'V2ViR0wgMS';
|
|
6
|
+
//webgl unmasked renderer的值拼接webgl unmasked vendor的值的base64编码
|
|
7
|
+
const dm_cover_img_str = 'QU5HTEUgKEludGVsLCBJbnRlbChSKSBIRCBHcmFwaGljcyBEaXJlY3QzRDExIHZzXzVfMCBwc181XzApLCBvciBzaW1pbGFyR29vZ2xlIEluYy4gKEludGVsKQ';
|
|
8
|
+
const dm_img_inter = { ds: [], wh: [0, 0, 0], of: [0, 0, 0] };
|
|
9
|
+
return {
|
|
10
|
+
dm_img_list: dm_img_list,
|
|
11
|
+
dm_img_str: dm_img_str,
|
|
12
|
+
dm_cover_img_str: dm_cover_img_str,
|
|
13
|
+
dm_img_inter: dm_img_inter
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { getDmImg };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import lodash from 'lodash';
|
|
3
|
+
import { Redis } from 'yunzaijs';
|
|
4
|
+
import BiliApi from './bilibili.main.api.js';
|
|
5
|
+
import { readSyncCookie, cookieWithBiliTicket } from './bilibili.main.models.js';
|
|
6
|
+
|
|
7
|
+
async function getWebId(uid) {
|
|
8
|
+
const w_webid_key = 'Yz:yuki:bili:w_webid';
|
|
9
|
+
const w_webid = await Redis.get(w_webid_key);
|
|
10
|
+
if (w_webid) {
|
|
11
|
+
return w_webid;
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
const url = `https://space.bilibili.com/${uid ? uid : 401742377}/dynamic`;
|
|
15
|
+
let { cookie } = await readSyncCookie();
|
|
16
|
+
cookie = await cookieWithBiliTicket(cookie);
|
|
17
|
+
const res = await axios.get(url, {
|
|
18
|
+
timeout: 8000,
|
|
19
|
+
headers: lodash.merge(BiliApi.BILIBILI_DYNAMIC_SPACE_HEADERS, {
|
|
20
|
+
Cookie: `${cookie}`,
|
|
21
|
+
Host: `space.bilibili.com`
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
const htmlContent = await res.data;
|
|
25
|
+
const htmlContentRegex = /="__RENDER_DATA__"\s*type="application\/json">(.*?)<\/script>/;
|
|
26
|
+
const __RENDER_DATA__ = htmlContent.match(htmlContentRegex);
|
|
27
|
+
if (__RENDER_DATA__ && __RENDER_DATA__[1]) {
|
|
28
|
+
const decoded__RENDER_DATA__JsonString = decodeURIComponent(__RENDER_DATA__[1]);
|
|
29
|
+
const accessIdRegex = /"access_id":"(.*?)"/;
|
|
30
|
+
const access_id = decoded__RENDER_DATA__JsonString.match(accessIdRegex);
|
|
31
|
+
if (access_id && access_id[1]) {
|
|
32
|
+
await Redis.set(w_webid_key, access_id[1], { EX: 43197 * 1000 });
|
|
33
|
+
return access_id[1];
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
console.error('Failed to get access_id from __RENDER_DATA__');
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { getWebId };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import QRCode from 'qrcode';
|
|
2
|
-
import { Redis, Bot, Segment } from '
|
|
2
|
+
import { Redis, Bot, Segment } from 'yunzaijs';
|
|
3
3
|
import Config from '../../utils/config.js';
|
|
4
4
|
import { renderPage } from '../../utils/image.js';
|
|
5
5
|
import { WeiboGetWebData } from './weibo.get.web.data.js';
|
|
@@ -46,14 +46,16 @@ class WeiboTask {
|
|
|
46
46
|
// 检查是否已经请求过该 uid
|
|
47
47
|
if (requestedDataOfUids.has(subInfoOfup.uid)) {
|
|
48
48
|
resp = requestedDataOfUids.get(subInfoOfup.uid); // 从已请求的映射中获取响应数据
|
|
49
|
+
const dynamicData = resp || [];
|
|
50
|
+
dynamicList[subInfoOfup.uid] = dynamicData;
|
|
49
51
|
}
|
|
50
52
|
else {
|
|
51
53
|
resp = await await new WeiboGetWebData().getBloggerDynamicList(subInfoOfup.uid); // 获取指定 uid 的动态列表
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
if (resp) {
|
|
55
|
+
requestedDataOfUids.set(subInfoOfup.uid, resp); // 将响应数据存储到映射中
|
|
56
|
+
const dynamicData = resp || [];
|
|
57
|
+
dynamicList[subInfoOfup.uid] = dynamicData;
|
|
58
|
+
}
|
|
57
59
|
}
|
|
58
60
|
const chatIds = Array.from(new Set([...Object((chatTypeMap.get(subInfoOfup.uid) && chatTypeMap.get(subInfoOfup.uid).chatIds) || []), chatId]));
|
|
59
61
|
const bot_id = subInfoOfup.bot_id || [];
|
package/lib/utils/config.js
CHANGED
|
@@ -61,7 +61,7 @@ class Config {
|
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
63
|
* 通用获取配置文件数据方法
|
|
64
|
-
* @param typeDir 配置文件目录类型对应路径 defaultConfig: defaultConfig 或 config:
|
|
64
|
+
* @param typeDir 配置文件目录类型对应路径 defaultConfig: defaultConfig 或 config: yunzaijs/data/yuki-plugin/config
|
|
65
65
|
* @param appDir 配置app目录
|
|
66
66
|
* @param functionName 配置文件名称,不包含.yaml后缀
|
|
67
67
|
* @returns {object} 配置数据
|
|
@@ -77,7 +77,7 @@ class Config {
|
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
79
|
* 获取配置文件路径
|
|
80
|
-
* @param typeDir 配置文件目录类型对应路径 defaultConfig: defaultConfig 或 config:
|
|
80
|
+
* @param typeDir 配置文件目录类型对应路径 defaultConfig: defaultConfig 或 config: yunzaijs/data/yuki-plugin/config
|
|
81
81
|
* @param appDir 配置app目录
|
|
82
82
|
* @param functionName 配置文件名称,不包含.yaml后缀
|
|
83
83
|
* @returns {string} 配置文件路径
|
|
@@ -93,7 +93,7 @@ class Config {
|
|
|
93
93
|
/**
|
|
94
94
|
* 监听配置文件的变化
|
|
95
95
|
* @param configFilePath 文件路径
|
|
96
|
-
* @param typeDir 配置文件目录类型对应路径 defaultConfig: defaultConfig 或 config:
|
|
96
|
+
* @param typeDir 配置文件目录类型对应路径 defaultConfig: defaultConfig 或 config: yunzaijs/data/yuki-plugin/config
|
|
97
97
|
* @param appDir 配置app目录
|
|
98
98
|
* @param functionName 配置文件名称,不包含.yaml后缀
|
|
99
99
|
*/
|
package/lib/utils/image.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Picture } from '
|
|
2
|
+
import { Picture } from 'jsxp';
|
|
3
3
|
import { YukiPuppeteerRender } from './puppeteer.render.js';
|
|
4
4
|
import * as index from '../components/index.js';
|
|
5
5
|
|
|
@@ -35,9 +35,9 @@ class Image extends Picture {
|
|
|
35
35
|
const Page = index[page];
|
|
36
36
|
// 调用 yukiPuppeteerRender 进行截图操作
|
|
37
37
|
return this.yukiPuppeteerRender.yukiScreenshot(this.Com.compile({
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
path: page,
|
|
39
|
+
name: `${uid}.html`,
|
|
40
|
+
component: React.createElement(Page, { ...props }),
|
|
41
41
|
...ComponentCreateOpsion
|
|
42
42
|
}), ScreenshotOptions);
|
|
43
43
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yz-yuki-plugin",
|
|
3
|
-
"version": "2.0.5-
|
|
3
|
+
"version": "2.0.5-10",
|
|
4
4
|
"description": "优纪插件,yunzaijs 关于 微博推送、B站推送 等功能的拓展插件",
|
|
5
5
|
"author": "snowtafir",
|
|
6
6
|
"type": "module",
|
|
@@ -11,13 +11,15 @@
|
|
|
11
11
|
"url": "https://github.com/snowtafir/yuki-plugin.git"
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
|
-
"app": "
|
|
15
|
-
"
|
|
14
|
+
"app": "node lib/main.js",
|
|
15
|
+
"dev": "lvy dev --yunzai",
|
|
16
|
+
"build": "lvy build",
|
|
17
|
+
"view": "lvy dev --view",
|
|
18
|
+
"img-dev": "npx tsx watch --clear-screen=false jsxp.server.ts",
|
|
16
19
|
"render-test": "npx tsx ./render.test.ts",
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"css-m": "tailwindcss -i ./src/input.css -o ./public/output.css -m",
|
|
20
|
+
"start": "pm2 startOrRestart pm2.config.cjs",
|
|
21
|
+
"stop": "pm2 stop pm2.config.cjs",
|
|
22
|
+
"delete": "pm2 delete pm2.config.cjs",
|
|
21
23
|
"format": "prettier --write .",
|
|
22
24
|
"check-format": "git diff --exit-code",
|
|
23
25
|
"prepare": "husky"
|
|
@@ -29,36 +31,23 @@
|
|
|
29
31
|
"debug": "^4.3.6",
|
|
30
32
|
"jsdom": "^24.1.1",
|
|
31
33
|
"json5": "^2.2.3",
|
|
34
|
+
"jsxp": "^1.0.4",
|
|
32
35
|
"lodash": "^4.17.21",
|
|
33
36
|
"md5": "^2.3.0",
|
|
34
37
|
"moment": "^2.30.1",
|
|
35
38
|
"node-fetch": "^3.3.2",
|
|
36
|
-
"puppeteer": "^23.
|
|
39
|
+
"puppeteer": "^23.6.0",
|
|
37
40
|
"qrcode": "^1.5.4",
|
|
38
41
|
"react": "^18.3.1",
|
|
39
42
|
"react-dom": "^18.3.1",
|
|
40
|
-
"react-puppeteer": "^1.0.7",
|
|
41
43
|
"redis": "^4.7.0",
|
|
42
44
|
"yaml": "^2.5.1",
|
|
43
45
|
"yarn": "^1.19.1"
|
|
44
46
|
},
|
|
45
47
|
"devDependencies": {
|
|
46
|
-
"@babel/core": "^7.25.2",
|
|
47
|
-
"@babel/preset-env": "^7.25.4",
|
|
48
|
-
"@babel/preset-react": "^7.24.7",
|
|
49
|
-
"@babel/preset-typescript": "^7.24.7",
|
|
50
48
|
"@types/chalk": "2.2.0",
|
|
51
|
-
"@rollup/plugin-babel": "^6.0.4",
|
|
52
|
-
"@types/lodash": "^4.17.7",
|
|
53
|
-
"@rollup/plugin-commonjs": "^26.0.1",
|
|
54
|
-
"@rollup/plugin-image": "^3.0.3",
|
|
55
|
-
"@rollup/plugin-json": "^6.1.0",
|
|
56
|
-
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
57
|
-
"@rollup/plugin-replace": "^5.0.7",
|
|
58
|
-
"@rollup/plugin-terser": "^0.4.4",
|
|
59
|
-
"@rollup/plugin-typescript": "^11.1.6",
|
|
60
|
-
"@types/rollup-plugin-auto-external": "^2.0.5",
|
|
61
49
|
"@types/jsdom": "^21.1.7",
|
|
50
|
+
"@types/lodash": "^4.17.7",
|
|
62
51
|
"@types/md5": "^2.3.5",
|
|
63
52
|
"@types/node": "^22.2.0",
|
|
64
53
|
"@types/node-fetch": "^2.6.11",
|
|
@@ -66,33 +55,29 @@
|
|
|
66
55
|
"@types/react": "^18.3.3",
|
|
67
56
|
"@types/react-dom": "^18.3.0",
|
|
68
57
|
"@types/yaml": "1.9.7",
|
|
58
|
+
"autoprefixer": "^10.4.20",
|
|
69
59
|
"axios": "^1.7.7",
|
|
70
|
-
"babel-plugin-module-resolver": "^5.0.2",
|
|
71
60
|
"chokidar": "^3.6.0",
|
|
72
61
|
"husky": "^9.1.6",
|
|
73
62
|
"jsdom": "^24.1.1",
|
|
74
63
|
"json5": "^2.2.3",
|
|
64
|
+
"jsxp": "^1.0.4",
|
|
75
65
|
"lodash": "^4.17.21",
|
|
66
|
+
"lvyjs": "^0.1.0",
|
|
76
67
|
"md5": "^2.3.0",
|
|
77
68
|
"node-fetch": "^3.3.2",
|
|
69
|
+
"postcss": "^8.4.47",
|
|
78
70
|
"prettier": "^3.3.3",
|
|
79
|
-
"puppeteer": "^23.
|
|
71
|
+
"puppeteer": "^23.6.0",
|
|
80
72
|
"qrcode": "^1.5.4",
|
|
81
73
|
"react": "^18.3.1",
|
|
82
74
|
"react-dom": "^18.3.1",
|
|
83
|
-
"react-puppeteer": "^1.0.7",
|
|
84
75
|
"redis": "^4.7.0",
|
|
85
|
-
"
|
|
86
|
-
"rollup-plugin-auto-external": "^2.0.0",
|
|
87
|
-
"rollup-plugin-copy": "^3.5.0",
|
|
88
|
-
"rollup-plugin-dts": "^6.1.1",
|
|
89
|
-
"rollup-plugin-ignore": "^1.0.10",
|
|
90
|
-
"tailwindcss": "^3.4.9",
|
|
76
|
+
"tailwindcss": "^3.4.14",
|
|
91
77
|
"ts-node": "^10.9.2",
|
|
92
78
|
"tsx": "^4.19.0",
|
|
93
79
|
"typescript": "^5.5.4",
|
|
94
|
-
"
|
|
95
|
-
"yunzai-mys": "^1.0.6"
|
|
80
|
+
"yunzaijs": "^1.0.0-rc.5"
|
|
96
81
|
},
|
|
97
82
|
"files": [
|
|
98
83
|
"public",
|
|
@@ -113,7 +98,7 @@
|
|
|
113
98
|
}
|
|
114
99
|
},
|
|
115
100
|
"keywords": [
|
|
116
|
-
"
|
|
101
|
+
"yunzaijs"
|
|
117
102
|
],
|
|
118
103
|
"publishConfig": {
|
|
119
104
|
"registry": "https://registry.npmjs.org"
|
package/lib/apps/bilibili.d.ts
DELETED
package/lib/apps/help.d.ts
DELETED
package/lib/apps/index.d.ts
DELETED
package/lib/apps/version.d.ts
DELETED
package/lib/apps/weibo.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
type AccountProps = {
|
|
3
|
-
data: {
|
|
4
|
-
appName: string;
|
|
5
|
-
face?: string;
|
|
6
|
-
pendant?: string;
|
|
7
|
-
name?: string;
|
|
8
|
-
pubTs?: any;
|
|
9
|
-
category?: string;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
declare const Account: React.FC<AccountProps>;
|
|
13
|
-
export default Account;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export type MainProps = {
|
|
3
|
-
data: {
|
|
4
|
-
appName: string;
|
|
5
|
-
boxGrid?: boolean;
|
|
6
|
-
type?: string;
|
|
7
|
-
face?: string;
|
|
8
|
-
pendant?: string;
|
|
9
|
-
name?: string;
|
|
10
|
-
pubTs: any;
|
|
11
|
-
title?: string;
|
|
12
|
-
content?: string;
|
|
13
|
-
urlImgData?: string;
|
|
14
|
-
created?: any;
|
|
15
|
-
pics?: Array<any>;
|
|
16
|
-
category?: string;
|
|
17
|
-
orig?: {
|
|
18
|
-
data?: {
|
|
19
|
-
type?: string;
|
|
20
|
-
face?: string;
|
|
21
|
-
pendant?: string;
|
|
22
|
-
name?: string;
|
|
23
|
-
pubTs?: any;
|
|
24
|
-
title?: string;
|
|
25
|
-
content?: string;
|
|
26
|
-
urlImgData?: string;
|
|
27
|
-
created?: any;
|
|
28
|
-
pics?: string[];
|
|
29
|
-
category?: string;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
export default function App({ data }: MainProps): React.JSX.Element;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
declare const MainPage: typeof import("@/components/dynamic/MainPage").default;
|
|
2
|
-
declare const Help: typeof import("@/components/help/Help").default;
|
|
3
|
-
declare const LoginQrcodePage: typeof import("@/components/loginQrcode/Page").default;
|
|
4
|
-
declare const Version: typeof import("@/components/version/Version").default;
|
|
5
|
-
export { Help, LoginQrcodePage, MainPage, Version };
|