yz-yuki-plugin 1.0.3-rc.5 → 1.0.4
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/CHANGELOG.md +7 -0
- package/README.md +7 -2
- package/lib/apps/index.d.ts +4 -0
- package/lib/components/index.d.ts +5 -0
- package/lib/{types/index.d.ts → index.d.ts} +1 -1
- package/lib/index.js +28 -12
- package/lib/main.d.ts +1 -0
- package/lib/{types/models → models}/bilibili/bilibili.task.d.ts +2 -2
- package/lib/{types/models → models}/weibo/weibo.task.d.ts +2 -2
- package/lib/utils/config.js +30 -13
- package/lib/{types/utils → utils}/image.d.ts +1 -1
- package/lib/utils/puppeteer.render.js +3 -5
- package/package.json +24 -15
- package/lib/types/apps/index.d.ts +0 -4
- package/lib/types/components/index.d.ts +0 -5
- /package/lib/{types/apps → apps}/bilibili.d.ts +0 -0
- /package/lib/{types/apps → apps}/help.d.ts +0 -0
- /package/lib/{types/apps → apps}/version.d.ts +0 -0
- /package/lib/{types/apps → apps}/weibo.d.ts +0 -0
- /package/lib/{types/components → components}/dynamic/Account.d.ts +0 -0
- /package/lib/{types/components → components}/dynamic/Content.d.ts +0 -0
- /package/lib/{types/components → components}/dynamic/Footer.d.ts +0 -0
- /package/lib/{types/components → components}/dynamic/ForwardContent.d.ts +0 -0
- /package/lib/{types/components → components}/dynamic/LogoText.d.ts +0 -0
- /package/lib/{types/components → components}/dynamic/MainPage.d.ts +0 -0
- /package/lib/{types/components → components}/help/Help.d.ts +0 -0
- /package/lib/{types/components → components}/loginQrcode/Page.d.ts +0 -0
- /package/lib/{types/components → components}/version/Version.d.ts +0 -0
- /package/lib/{types/models → models}/bilibili/bilibili.api.d.ts +0 -0
- /package/lib/{types/models → models}/bilibili/bilibili.buid.fp.d.ts +0 -0
- /package/lib/{types/models → models}/bilibili/bilibili.get.web.data.d.ts +0 -0
- /package/lib/{types/models → models}/bilibili/bilibili.models.d.ts +0 -0
- /package/lib/{types/models → models}/bilibili/bilibili.query.d.ts +0 -0
- /package/lib/{types/models → models}/bilibili/bilibili.wbi.d.ts +0 -0
- /package/lib/{types/models → models}/help/help.d.ts +0 -0
- /package/lib/{types/models → models}/version/version.d.ts +0 -0
- /package/lib/{types/models → models}/weibo/weibo.api.d.ts +0 -0
- /package/lib/{types/models → models}/weibo/weibo.get.web.data.d.ts +0 -0
- /package/lib/{types/models → models}/weibo/weibo.query.d.ts +0 -0
- /package/lib/{types/utils → utils}/config.d.ts +0 -0
- /package/lib/{types/utils → utils}/paths.d.ts +0 -0
- /package/lib/{types/utils → utils}/puppeteer.render.d.ts +0 -0
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -123,14 +123,19 @@ https://m.weibo.cn/u/7643376782 # 7643376782 为崩坏星穹铁道博主uid
|
|
|
123
123
|
- [x] 微博动态
|
|
124
124
|
|
|
125
125
|
|
|
126
|
-
##
|
|
126
|
+
## 🚀指令列表
|
|
127
127
|
|
|
128
128
|
<details><summary>点击展开</summary>
|
|
129
129
|
|
|
130
|
+
> [!IMPORTANT]
|
|
131
|
+
> 统一的配置文件路径:
|
|
132
|
+
|
|
133
|
+
`Yunzai/data/yuki-plugin/config/`,启动一次后,即可查看配置文件。
|
|
134
|
+
|
|
130
135
|
> [!TIP]
|
|
131
136
|
> 指令前缀:`#优纪`、`#yuki`、`/优纪`、`/yuki`,
|
|
132
137
|
|
|
133
|
-
|
|
138
|
+
示例:`#优纪订阅B站推送uid`、`#yuki订阅B站推送uid`、`/优纪订阅B站推送uid`、`/yuki订阅B站推送uid`。
|
|
134
139
|
|
|
135
140
|
| 用途 | 描述 | 指令 |
|
|
136
141
|
| --------- | ----------- | ------------ |
|
|
@@ -0,0 +1,5 @@
|
|
|
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 };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const _default: () => {
|
|
2
2
|
create(): void;
|
|
3
|
-
mounted<T extends keyof import("yunzai").EventEmun = "message.group">(
|
|
3
|
+
mounted<T extends keyof import("yunzai").EventEmun = "message.group">(e: Parameters<import("yunzai").EventEmun[T]>[0]): Promise<any[]>;
|
|
4
4
|
};
|
|
5
5
|
export default _default;
|
package/lib/index.js
CHANGED
|
@@ -1,27 +1,43 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
import {
|
|
2
|
+
import { applicationOptions, useEvent } from 'yunzai';
|
|
3
3
|
import Config from './utils/config.js';
|
|
4
4
|
import * as index$1 from './apps/index.js';
|
|
5
5
|
|
|
6
|
-
const Data = useAppStorage();
|
|
7
6
|
var index = () => {
|
|
7
|
+
const rules = [];
|
|
8
8
|
return applicationOptions({
|
|
9
9
|
create() {
|
|
10
|
-
let count = 0;
|
|
11
10
|
for (const key in index$1) {
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const app = new index$1[key]();
|
|
12
|
+
for (const rule of app.rule) {
|
|
13
|
+
rules.push({
|
|
14
|
+
reg: rule.reg,
|
|
15
|
+
key: key
|
|
16
|
+
});
|
|
17
|
+
}
|
|
14
18
|
}
|
|
15
19
|
logger.info(chalk.rgb(0, 190, 255)(`-----------------------------------------`));
|
|
16
|
-
logger.info(chalk.rgb(255, 225, 255)(
|
|
17
|
-
logger.info(chalk.rgb(255, 245, 255)(
|
|
18
|
-
logger.info(chalk.rgb(255, 225, 255)(
|
|
19
|
-
logger.info(chalk.rgb(255, 245, 255)(
|
|
20
|
+
logger.info(chalk.rgb(255, 225, 255)(`优纪插件 ${Config.getLatestVersion()} 初始化~`));
|
|
21
|
+
logger.info(chalk.rgb(255, 245, 255)(`作者:snowtafir`));
|
|
22
|
+
logger.info(chalk.rgb(255, 225, 255)(`仓库地址:`));
|
|
23
|
+
logger.info(chalk.rgb(255, 245, 255)(`https://github.com/snowtafir/yuki-plugin`));
|
|
20
24
|
logger.info(chalk.rgb(0, 190, 255)(`-----------------------------------------`));
|
|
21
|
-
logger.info(chalk.rgb(0, 190, 255)(`★
|
|
25
|
+
logger.info(chalk.rgb(0, 190, 255)(`★ 优纪插件加载完成了喵~`));
|
|
22
26
|
},
|
|
23
|
-
mounted() {
|
|
24
|
-
|
|
27
|
+
async mounted(e) {
|
|
28
|
+
const data = [];
|
|
29
|
+
const cache = {};
|
|
30
|
+
await useEvent(e => {
|
|
31
|
+
for (const item of rules) {
|
|
32
|
+
if (new RegExp(item.reg).test(e.msg) &&
|
|
33
|
+
index$1[item.key] &&
|
|
34
|
+
!cache[item.key]) {
|
|
35
|
+
cache[item.key] = true;
|
|
36
|
+
data.push(new index$1[item.key]());
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}, [e, 'message']);
|
|
40
|
+
return data;
|
|
25
41
|
}
|
|
26
42
|
});
|
|
27
43
|
};
|
package/lib/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventType } from 'yunzai';
|
|
2
|
-
import { MainProps } from "
|
|
3
|
-
import { ScreenshotOptions } from '
|
|
2
|
+
import { MainProps } from "@/components/dynamic/MainPage";
|
|
3
|
+
import { ScreenshotOptions } from '@/utils/puppeteer.render';
|
|
4
4
|
export declare class BiliTask {
|
|
5
5
|
taskName: string;
|
|
6
6
|
groupKey: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventType } from 'yunzai';
|
|
2
|
-
import { MainProps } from "
|
|
3
|
-
import { ScreenshotOptions } from '
|
|
2
|
+
import { MainProps } from "@/components/dynamic/MainPage";
|
|
3
|
+
import { ScreenshotOptions } from '@/utils/puppeteer.render';
|
|
4
4
|
export declare class WeiboTask {
|
|
5
5
|
taskName: string;
|
|
6
6
|
groupKey: string;
|
package/lib/utils/config.js
CHANGED
|
@@ -22,23 +22,35 @@ class Config {
|
|
|
22
22
|
this.initConfigFiles();
|
|
23
23
|
}
|
|
24
24
|
initConfigFiles() {
|
|
25
|
-
let bilibiliSetFile = path.join(_paths.pluginPath, 'config/bilibili/config.yaml');
|
|
26
|
-
let bilibiliPushFile = path.join(_paths.pluginPath, 'config/bilibili/push.yaml');
|
|
27
|
-
let weiboSetFile = path.join(_paths.pluginPath, 'config/weibo/config.yaml');
|
|
28
|
-
let weiboPushFile = path.join(_paths.pluginPath, 'config/weibo/push.yaml');
|
|
29
25
|
const configFiles = [
|
|
30
|
-
{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
{
|
|
27
|
+
configFile: path.join(_paths.botYukiData, 'config/bilibili/config.yaml'),
|
|
28
|
+
defaultFile: path.join(_paths.pluginPath, 'defaultConfig/bilibili/config.yaml'),
|
|
29
|
+
dir: 'config/bilibili'
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
configFile: path.join(_paths.botYukiData, 'config/bilibili/push.yaml'),
|
|
33
|
+
defaultFile: path.join(_paths.pluginPath, 'defaultConfig/bilibili/push.yaml'),
|
|
34
|
+
dir: 'config/bilibili'
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
configFile: path.join(_paths.botYukiData, 'config/weibo/config.yaml'),
|
|
38
|
+
defaultFile: path.join(_paths.pluginPath, 'defaultConfig/weibo/config.yaml'),
|
|
39
|
+
dir: 'config/weibo'
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
configFile: path.join(_paths.botYukiData, 'config/weibo/push.yaml'),
|
|
43
|
+
defaultFile: path.join(_paths.pluginPath, 'defaultConfig/weibo/push.yaml'),
|
|
44
|
+
dir: 'config/weibo'
|
|
45
|
+
}
|
|
34
46
|
];
|
|
35
|
-
for (const {
|
|
36
|
-
if (!fs.existsSync(
|
|
37
|
-
const configDir = path.join(_paths.
|
|
47
|
+
for (const { configFile, defaultFile, dir } of configFiles) {
|
|
48
|
+
if (!fs.existsSync(configFile)) {
|
|
49
|
+
const configDir = path.join(_paths.botYukiData, dir);
|
|
38
50
|
if (!fs.existsSync(configDir)) {
|
|
39
51
|
fs.mkdirSync(configDir, { recursive: true });
|
|
40
52
|
}
|
|
41
|
-
fs.copyFileSync(defaultFile,
|
|
53
|
+
fs.copyFileSync(defaultFile, configFile);
|
|
42
54
|
}
|
|
43
55
|
}
|
|
44
56
|
}
|
|
@@ -52,7 +64,12 @@ class Config {
|
|
|
52
64
|
return this[key];
|
|
53
65
|
}
|
|
54
66
|
getConfigFilePath(typeDir, appDir, functionName) {
|
|
55
|
-
|
|
67
|
+
if (typeDir === "defaultConfig") {
|
|
68
|
+
return path.join(_paths.pluginPath, `${typeDir}`, `${appDir}`, `${functionName}.yaml`);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
return path.join(_paths.botYukiData, `${typeDir}`, `${appDir}`, `${functionName}.yaml`);
|
|
72
|
+
}
|
|
56
73
|
}
|
|
57
74
|
watch(configFilePath, typeDir, appDir, functionName) {
|
|
58
75
|
const key = `${typeDir}_${appDir}_${functionName}`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Picture, ComponentCreateOpsionType } from 'react-puppeteer';
|
|
2
|
-
import { ScreenshotOptions } from '
|
|
2
|
+
import { ScreenshotOptions } from '@/utils/puppeteer.render';
|
|
3
3
|
export declare class Image extends Picture {
|
|
4
4
|
constructor();
|
|
5
5
|
renderPage<T = any>(uid: number | string, page: string, props?: T, ScreenshotOptions?: ScreenshotOptions, ComponentCreateOpsion?: ComponentCreateOpsionType): Promise<false | {
|
|
@@ -77,12 +77,10 @@ class YukiPuppeteerRender extends Puppeteer {
|
|
|
77
77
|
});
|
|
78
78
|
numSun++;
|
|
79
79
|
if (buff !== false) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
const kb = (buff?.length / 1024).toFixed(2) + "kb";
|
|
80
|
+
let imgBuff = !Buffer.isBuffer(buff) ? Buffer.from(buff) : buff;
|
|
81
|
+
const kb = (imgBuff?.length / 1024).toFixed(2) + "kb";
|
|
84
82
|
logger.mark(`[图片生成][${name}][${numSun}次] ${kb} ${logger.green(`${Date.now() - start}ms`)}`);
|
|
85
|
-
ret.push(
|
|
83
|
+
ret.push(imgBuff);
|
|
86
84
|
}
|
|
87
85
|
else {
|
|
88
86
|
logger.error(`[puppeteer]`, '截图失败');
|
package/package.json
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yz-yuki-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "优纪插件,yunzaijs 关于 微博推送、B站推送 等功能的拓展插件",
|
|
5
5
|
"author": "snowtafir",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"
|
|
8
|
+
"private": false,
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/snowtafir/yuki-plugin.git"
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
|
-
"app": "
|
|
15
|
-
"dev": "
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"css": "tailwindcss -i ./src/input.css -o ./public/output.css",
|
|
19
|
-
"css
|
|
20
|
-
"css:watch": "tailwindcss -i ./src/input.css -o ./public/output.css --watch",
|
|
14
|
+
"app": "npx tsx src/main.ts",
|
|
15
|
+
"img-dev": "npx tsx watch --clear-screen=false routes.server.ts",
|
|
16
|
+
"build": "npm run css-m && rollup --config rollup.config.js",
|
|
17
|
+
"css-app": "tailwindcss -i ./src/input.css -o ./public/output.css",
|
|
18
|
+
"css-dev": "tailwindcss -i ./src/input.css -o ./public/output.css --watch",
|
|
19
|
+
"css-m": "tailwindcss -i ./src/input.css -o ./public/output.css -m",
|
|
21
20
|
"format": "prettier --write ."
|
|
22
21
|
},
|
|
23
22
|
"dependencies": {
|
|
24
23
|
"axios": "^1.7.3",
|
|
24
|
+
"chalk": "^5.3.0",
|
|
25
25
|
"chokidar": "^3.6.0",
|
|
26
|
+
"debug": "^4.3.6",
|
|
26
27
|
"jsdom": "^24.1.1",
|
|
27
28
|
"json5": "^2.2.3",
|
|
28
29
|
"md5": "^2.3.0",
|
|
@@ -38,6 +39,13 @@
|
|
|
38
39
|
"yarn": "^1.19.1"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
42
|
+
"@babel/core": "^7.25.2",
|
|
43
|
+
"@babel/preset-env": "^7.25.4",
|
|
44
|
+
"@babel/preset-react": "^7.24.7",
|
|
45
|
+
"@babel/preset-typescript": "^7.24.7",
|
|
46
|
+
"@types/chalk": "2.2.0",
|
|
47
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
48
|
+
"@types/lodash": "^4.17.7",
|
|
41
49
|
"@rollup/plugin-commonjs": "^26.0.1",
|
|
42
50
|
"@rollup/plugin-image": "^3.0.3",
|
|
43
51
|
"@rollup/plugin-json": "^6.1.0",
|
|
@@ -47,7 +55,6 @@
|
|
|
47
55
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
48
56
|
"@types/rollup-plugin-auto-external": "^2.0.5",
|
|
49
57
|
"@types/jsdom": "^21.1.7",
|
|
50
|
-
"@types/lodash": "^4.17.7",
|
|
51
58
|
"@types/md5": "^2.3.5",
|
|
52
59
|
"@types/node": "^22.2.0",
|
|
53
60
|
"@types/node-fetch": "^2.6.11",
|
|
@@ -56,6 +63,7 @@
|
|
|
56
63
|
"@types/react-dom": "^18.3.0",
|
|
57
64
|
"@types/yaml": "1.9.7",
|
|
58
65
|
"axios": "^1.7.3",
|
|
66
|
+
"babel-plugin-module-resolver": "^5.0.2",
|
|
59
67
|
"chokidar": "^3.6.0",
|
|
60
68
|
"jsdom": "^24.1.1",
|
|
61
69
|
"json5": "^2.2.3",
|
|
@@ -76,9 +84,10 @@
|
|
|
76
84
|
"rollup-plugin-ignore": "^1.0.10",
|
|
77
85
|
"tailwindcss": "^3.4.9",
|
|
78
86
|
"ts-node": "^10.9.2",
|
|
87
|
+
"tsx": "^4.18.0",
|
|
79
88
|
"typescript": "^5.5.4",
|
|
80
|
-
"yunzai": "^1.0.
|
|
81
|
-
"yunzai-mys": "^1.0.
|
|
89
|
+
"yunzai": "^1.0.6",
|
|
90
|
+
"yunzai-mys": "^1.0.5"
|
|
82
91
|
},
|
|
83
92
|
"files": [
|
|
84
93
|
"public",
|
|
@@ -91,18 +100,18 @@
|
|
|
91
100
|
"LICENSE",
|
|
92
101
|
".puppeteerrc.cjs"
|
|
93
102
|
],
|
|
94
|
-
"types": "lib
|
|
103
|
+
"types": "lib",
|
|
95
104
|
"exports": {
|
|
96
105
|
".": {
|
|
97
106
|
"import": "./lib/index.js",
|
|
98
|
-
"types": "./lib/
|
|
107
|
+
"types": "./lib/index.d.ts"
|
|
99
108
|
}
|
|
100
109
|
},
|
|
101
110
|
"keywords": [
|
|
102
111
|
"yunzai"
|
|
103
112
|
],
|
|
104
113
|
"publishConfig": {
|
|
105
|
-
"registry": "https://registry.npmjs.org
|
|
114
|
+
"registry": "https://registry.npmjs.org"
|
|
106
115
|
},
|
|
107
116
|
"engines": {
|
|
108
117
|
"node": ">=16.14.0"
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
declare const MainPage: typeof import("./dynamic/MainPage").default;
|
|
2
|
-
declare const Help: typeof import("./help/Help").default;
|
|
3
|
-
declare const LoginQrcodePage: typeof import("./loginQrcode/Page").default;
|
|
4
|
-
declare const Version: typeof import("./version/Version").default;
|
|
5
|
-
export { Help, LoginQrcodePage, MainPage, Version };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|