yz-yuki-plugin 1.0.1
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/LICENSE +21 -0
- package/README.md +195 -0
- package/defaultConfig/bilibili/config.yaml +41 -0
- package/defaultConfig/bilibili/push.yaml +0 -0
- package/defaultConfig/help/help.yaml +86 -0
- package/defaultConfig/weibo/config.yaml +41 -0
- package/defaultConfig/weibo/push.yaml +0 -0
- package/lib/apps/bilibili.js +402 -0
- package/lib/apps/help.js +37 -0
- package/lib/apps/index.js +4 -0
- package/lib/apps/version.js +34 -0
- package/lib/apps/weibo.js +252 -0
- package/lib/components/dynamic/Account.js +26 -0
- package/lib/components/dynamic/Content.js +118 -0
- package/lib/components/dynamic/Footer.js +36 -0
- package/lib/components/dynamic/ForwardContent.js +15 -0
- package/lib/components/dynamic/LogoText.js +10 -0
- package/lib/components/dynamic/MainPage.js +22 -0
- package/lib/components/help/Help.js +33 -0
- package/lib/components/index.js +6 -0
- package/lib/components/loginQrcode/Page.js +21 -0
- package/lib/components/version/Version.js +27 -0
- package/lib/index.js +29 -0
- package/lib/models/bilibili/bilibili.api.js +49 -0
- package/lib/models/bilibili/bilibili.get.web.data.js +80 -0
- package/lib/models/bilibili/bilibili.models.js +484 -0
- package/lib/models/bilibili/bilibili.query.js +393 -0
- package/lib/models/bilibili/bilibili.task.js +256 -0
- package/lib/models/bilibili/bilibili.wbi.js +49 -0
- package/lib/models/help/help.js +20 -0
- package/lib/models/version/version.js +62 -0
- package/lib/models/weibo/weibo.api.js +19 -0
- package/lib/models/weibo/weibo.get.web.data.js +55 -0
- package/lib/models/weibo/weibo.query.js +323 -0
- package/lib/models/weibo/weibo.task.js +215 -0
- package/lib/types/apps/bilibili.d.ts +6 -0
- package/lib/types/apps/help.d.ts +6 -0
- package/lib/types/apps/index.d.ts +4 -0
- package/lib/types/apps/version.d.ts +6 -0
- package/lib/types/apps/weibo.d.ts +6 -0
- package/lib/types/components/dynamic/Account.d.ts +13 -0
- package/lib/types/components/dynamic/Content.d.ts +12 -0
- package/lib/types/components/dynamic/Footer.d.ts +11 -0
- package/lib/types/components/dynamic/ForwardContent.d.ts +6 -0
- package/lib/types/components/dynamic/LogoText.d.ts +9 -0
- package/lib/types/components/dynamic/MainPage.d.ts +34 -0
- package/lib/types/components/help/Help.d.ts +12 -0
- package/lib/types/components/index.d.ts +5 -0
- package/lib/types/components/loginQrcode/Page.d.ts +7 -0
- package/lib/types/components/version/Version.d.ts +8 -0
- package/lib/types/index.d.ts +5 -0
- package/lib/types/models/bilibili/bilibili.api.d.ts +47 -0
- package/lib/types/models/bilibili/bilibili.buid.fp.d.ts +2 -0
- package/lib/types/models/bilibili/bilibili.get.web.data.d.ts +6 -0
- package/lib/types/models/bilibili/bilibili.models.d.ts +20 -0
- package/lib/types/models/bilibili/bilibili.query.d.ts +13 -0
- package/lib/types/models/bilibili/bilibili.task.d.ts +18 -0
- package/lib/types/models/bilibili/bilibili.wbi.d.ts +5 -0
- package/lib/types/models/help/help.d.ts +8 -0
- package/lib/types/models/version/version.d.ts +7 -0
- package/lib/types/models/weibo/weibo.api.d.ts +17 -0
- package/lib/types/models/weibo/weibo.get.web.data.d.ts +8 -0
- package/lib/types/models/weibo/weibo.query.d.ts +18 -0
- package/lib/types/models/weibo/weibo.task.d.ts +17 -0
- package/lib/types/utils/config.d.ts +21 -0
- package/lib/types/utils/image.d.ts +10 -0
- package/lib/types/utils/paths.d.ts +10 -0
- package/lib/types/utils/puppeteer.render.d.ts +23 -0
- package/lib/utils/config.js +108 -0
- package/lib/utils/image.js +26 -0
- package/lib/utils/paths.js +18 -0
- package/lib/utils/puppeteer.render.js +102 -0
- package/package.json +106 -0
- package/public/output.css +1 -0
- package/resources/css/dynamic/Account.css +68 -0
- package/resources/css/dynamic/Content.box.grid.4.css +4 -0
- package/resources/css/dynamic/Content.box.grid.9.css +4 -0
- package/resources/css/dynamic/Content.css +87 -0
- package/resources/css/dynamic/Footer.css +44 -0
- package/resources/css/dynamic/ForwardContent.css +11 -0
- package/resources/css/dynamic/LogoText.css +15 -0
- package/resources/css/dynamic/MainPage.css +93 -0
- package/resources/css/help/help.css +182 -0
- package/resources/css/loginQrcode/Page.css +55 -0
- package/resources/css/version/version.css +116 -0
- package/resources/fonts/iconfont.16acc2.ttf +0 -0
- package/resources/img/background/Girl.png +0 -0
- package/resources/img/icon/dynamic/bili-rich-text-module-goods-taobao.svg +1 -0
- package/resources/img/icon/dynamic/bili-rich-text-module-lottery.svg +1 -0
- package/resources/img/icon/dynamic/bilibili.svg +6 -0
- package/resources/img/icon/dynamic/weibo.svg +43 -0
- package/resources/img/icon/puplic/archaic_stone.png +0 -0
- package/resources/img/icon/puplic/condessence_crystal.png +0 -0
- package/resources/img/icon/puplic/delightful_encounter.png +0 -0
- package/resources/img/icon/puplic/diagram.png +0 -0
- package/resources/img/icon/puplic/essence_of_pure_sacred_dewdrop.png +0 -0
- package/resources/img/icon/puplic/everamber.png +0 -0
- package/resources/img/icon/puplic/flower_1.png +0 -0
- package/resources/img/icon/puplic/flower_2.png +0 -0
- package/resources/img/icon/puplic/kamera.png +0 -0
- package/resources/img/icon/puplic/lumidouce_bell.png +0 -0
- package/resources/img/icon/puplic/mora.png +0 -0
- package/resources/img/icon/puplic/pluie_lotus.png +0 -0
- package/resources/img/icon/puplic/restaurant_smoothie.png +0 -0
- package/resources/img/icon/puplic/romaritime_flower.png +0 -0
- package/resources/img/icon/puplic/shell.png +0 -0
- package/resources/img/icon/puplic/spring_of_pure_sacred_dewdrop.png +0 -0
- package/resources/img/icon/puplic/surging_sacred_chalice.png +0 -0
- package/resources/img/icon/puplic/tourbillon_device.png +0 -0
- package/resources/img/icon/puplic/unfading_silky_grace.png +0 -0
- package/resources/img/icon/puplic/wisdom.png +0 -0
- package/resources/img/icon/puplic/wondrous_lovely_flower.png +0 -0
- package/resources/img/icon/puplic//345/262/251/347/245/236/347/236/263/345/205/261/351/270/243/347/237/263.png +0 -0
- package/resources/img/icon/puplic//346/260/264/347/245/236/347/236/263/345/205/261/351/270/243/347/237/263.png +0 -0
- package/resources/img/icon/puplic//350/215/211/347/245/236/347/236/263/345/205/261/351/270/243/347/237/263.png +0 -0
- package/resources/img/icon/puplic//351/222/223/351/261/274.png +0 -0
- package/resources/img/icon/puplic//351/233/267/347/245/236/347/236/263/345/205/261/351/270/243/347/237/263.png +0 -0
- package/resources/img/icon/puplic//351/243/216/347/245/236/347/236/263/345/205/261/351/270/243/347/237/263.png +0 -0
- package/resources/img/icon/puplic//351/243/216/350/275/246.png +0 -0
- package/resources/img/readme/girl.png +0 -0
- package/resources/img/readme/min-Girl.png +0 -0
- package/resources/img/readme/mini-help.jpg +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Puppeteer } from 'react-puppeteer';
|
|
2
|
+
export type ScreenshotOptions = {
|
|
3
|
+
SOptions?: {
|
|
4
|
+
type: 'jpeg' | 'png' | 'webp';
|
|
5
|
+
quality: number;
|
|
6
|
+
};
|
|
7
|
+
tab?: string;
|
|
8
|
+
timeout?: number;
|
|
9
|
+
isSplit?: boolean;
|
|
10
|
+
addStyle?: string;
|
|
11
|
+
header?: {
|
|
12
|
+
[key: string]: string;
|
|
13
|
+
};
|
|
14
|
+
pageSplitHeight?: number;
|
|
15
|
+
pageWidth?: number;
|
|
16
|
+
modelName?: string;
|
|
17
|
+
saveHtmlfile?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export declare class YukiPuppeteerRender extends Puppeteer {
|
|
20
|
+
yukiScreenshot(htmlPath: string, Options?: ScreenshotOptions): Promise<false | {
|
|
21
|
+
img: Buffer[];
|
|
22
|
+
}>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import YAML from 'yaml';
|
|
3
|
+
import chokidar from 'chokidar';
|
|
4
|
+
import lodash from 'lodash';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import { _paths } from './paths.js';
|
|
7
|
+
|
|
8
|
+
class Config {
|
|
9
|
+
versionPath;
|
|
10
|
+
defaultConfigPath;
|
|
11
|
+
userConfigPath;
|
|
12
|
+
defaultConfig;
|
|
13
|
+
userConfig;
|
|
14
|
+
watcher;
|
|
15
|
+
constructor() {
|
|
16
|
+
this.versionPath = path.join(_paths.pluginPath, 'CHANGELOG.md');
|
|
17
|
+
this.defaultConfigPath = path.join(_paths.pluginPath, 'defaultConfig');
|
|
18
|
+
this.defaultConfig = {};
|
|
19
|
+
this.userConfigPath = path.join(_paths.pluginPath, 'config');
|
|
20
|
+
this.userConfig = {};
|
|
21
|
+
this.watcher = {};
|
|
22
|
+
this.initConfigFiles();
|
|
23
|
+
}
|
|
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
|
+
const configFiles = [
|
|
30
|
+
{ file: bilibiliSetFile, defaultFile: path.join(_paths.pluginPath, 'defaultConfig/bilibili/config.yaml'), dir: 'config/bilibili' },
|
|
31
|
+
{ file: bilibiliPushFile, defaultFile: path.join(_paths.pluginPath, 'defaultConfig/bilibili/push.yaml'), dir: 'config/bilibili' },
|
|
32
|
+
{ file: weiboSetFile, defaultFile: path.join(_paths.pluginPath, 'defaultConfig/weibo/config.yaml'), dir: 'config/weibo' },
|
|
33
|
+
{ file: weiboPushFile, defaultFile: path.join(_paths.pluginPath, 'defaultConfig/weibo/push.yaml'), dir: 'config/weibo' }
|
|
34
|
+
];
|
|
35
|
+
for (const { file, defaultFile, dir } of configFiles) {
|
|
36
|
+
if (!fs.existsSync(file)) {
|
|
37
|
+
const configDir = path.join(_paths.pluginPath, dir);
|
|
38
|
+
if (!fs.existsSync(configDir)) {
|
|
39
|
+
fs.mkdirSync(configDir, { recursive: true });
|
|
40
|
+
}
|
|
41
|
+
fs.copyFileSync(defaultFile, file);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
getConfigData(typeDir, appDir, functionName) {
|
|
46
|
+
const configFilePath = this.getConfigFilePath(typeDir, appDir, functionName);
|
|
47
|
+
const key = `${typeDir}_${appDir}_${functionName}`;
|
|
48
|
+
if (this[key])
|
|
49
|
+
return this[key];
|
|
50
|
+
this[key] = YAML.parse(fs.readFileSync(configFilePath, "utf8"));
|
|
51
|
+
this.watch(configFilePath, typeDir, appDir, functionName);
|
|
52
|
+
return this[key];
|
|
53
|
+
}
|
|
54
|
+
getConfigFilePath(typeDir, appDir, functionName) {
|
|
55
|
+
return path.join(_paths.pluginPath, `${typeDir}`, `${appDir}`, `${functionName}.yaml`);
|
|
56
|
+
}
|
|
57
|
+
watch(configFilePath, typeDir, appDir, functionName) {
|
|
58
|
+
const key = `${typeDir}_${appDir}_${functionName}`;
|
|
59
|
+
if (this.watcher[key])
|
|
60
|
+
return;
|
|
61
|
+
const watcher = chokidar.watch(configFilePath);
|
|
62
|
+
watcher.on("change", () => {
|
|
63
|
+
delete this[key];
|
|
64
|
+
logger.mark(`[修改配置文件][${typeDir}][${appDir}][${functionName}]`);
|
|
65
|
+
if (this[`change_${appDir}${functionName}`]) {
|
|
66
|
+
this[`change_${appDir}${functionName}`]();
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
this.watcher[key] = watcher;
|
|
70
|
+
}
|
|
71
|
+
getDefaultConfig(appDir, functionName) {
|
|
72
|
+
return this.getConfigData("defaultConfig", appDir, functionName);
|
|
73
|
+
}
|
|
74
|
+
getUserConfig(appDir, functionName) {
|
|
75
|
+
const userConfigData = this.getConfigData("config", appDir, functionName);
|
|
76
|
+
const defaultConfigData = this.getDefaultConfig(appDir, functionName);
|
|
77
|
+
return lodash.merge({}, defaultConfigData, userConfigData);
|
|
78
|
+
}
|
|
79
|
+
saveConfig(typeDir, appDir, functionName, data) {
|
|
80
|
+
const filePath = this.getConfigFilePath(typeDir, appDir, functionName);
|
|
81
|
+
if (lodash.isEmpty(data)) {
|
|
82
|
+
fs.existsSync(filePath) && fs.unlinkSync(filePath);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
const yamlContent = YAML.stringify(data);
|
|
86
|
+
fs.writeFileSync(filePath, yamlContent, "utf8");
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
updateConfigItem(appDir, functionName, key, value) {
|
|
90
|
+
const config = this.getUserConfig(appDir, functionName);
|
|
91
|
+
config[key] = value;
|
|
92
|
+
this.saveConfig("config", appDir, functionName, config);
|
|
93
|
+
}
|
|
94
|
+
getLatestVersion() {
|
|
95
|
+
const content = fs.readFileSync(this.versionPath, 'utf-8');
|
|
96
|
+
const versionPattern = /#\s(\d+\.\d+\.\d+)/g;
|
|
97
|
+
const match = versionPattern.exec(content);
|
|
98
|
+
if (match) {
|
|
99
|
+
return match[1];
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
var Config$1 = new Config();
|
|
107
|
+
|
|
108
|
+
export { Config$1 as default };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Component, Picture, Puppeteer } from 'react-puppeteer';
|
|
3
|
+
import { YukiPuppeteerRender } from './puppeteer.render.js';
|
|
4
|
+
import * as index from '../components/index.js';
|
|
5
|
+
|
|
6
|
+
const com = new Component();
|
|
7
|
+
const yukiPuppeteerRender = new YukiPuppeteerRender();
|
|
8
|
+
class Image extends Picture {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
this.Pup = new Puppeteer();
|
|
12
|
+
this.Pup.start();
|
|
13
|
+
}
|
|
14
|
+
async renderPage(uid, page, props = {}, ScreenshotOptions, ComponentCreateOpsion) {
|
|
15
|
+
const Page = index[page];
|
|
16
|
+
return yukiPuppeteerRender.yukiScreenshot(com.compile({
|
|
17
|
+
join_dir: page,
|
|
18
|
+
html_name: `${uid}.html`,
|
|
19
|
+
html_body: React.createElement(Page, { ...props }),
|
|
20
|
+
...ComponentCreateOpsion
|
|
21
|
+
}), ScreenshotOptions);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
var Image$1 = new Image();
|
|
25
|
+
|
|
26
|
+
export { Image, Image$1 as default };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { dirname, join, basename } from 'path';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
3
|
+
|
|
4
|
+
const _path = process.cwd();
|
|
5
|
+
const thisFilePath = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
const pluginPath = join(thisFilePath, '..', '..');
|
|
7
|
+
const pluginName = basename(pluginPath);
|
|
8
|
+
const _paths = {
|
|
9
|
+
root: _path,
|
|
10
|
+
botData: join(_path, 'data'),
|
|
11
|
+
botYukiData: join(_path, 'data/yuki-plugin'),
|
|
12
|
+
botTempPath: join(_path, 'temp'),
|
|
13
|
+
pluginPath,
|
|
14
|
+
pluginResources: join(pluginPath, 'resources'),
|
|
15
|
+
pluginName,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { _paths, pluginName };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { Puppeteer } from 'react-puppeteer';
|
|
2
|
+
import fs__default from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { _paths } from './paths.js';
|
|
5
|
+
|
|
6
|
+
class YukiPuppeteerRender extends Puppeteer {
|
|
7
|
+
async yukiScreenshot(htmlPath, Options) {
|
|
8
|
+
if (!(await this.isStart()))
|
|
9
|
+
return false;
|
|
10
|
+
let name = Options?.modelName ?? 'yuki-plugin';
|
|
11
|
+
let pageHeight = Options?.pageSplitHeight ?? 8000;
|
|
12
|
+
try {
|
|
13
|
+
const page = await this.browser?.newPage().catch(err => {
|
|
14
|
+
logger.error(err);
|
|
15
|
+
});
|
|
16
|
+
if (!page)
|
|
17
|
+
return false;
|
|
18
|
+
await page.setViewport({
|
|
19
|
+
width: Options?.pageWidth ?? 900,
|
|
20
|
+
height: 7500
|
|
21
|
+
});
|
|
22
|
+
if (Options?.header) {
|
|
23
|
+
await page.setExtraHTTPHeaders(Options.header);
|
|
24
|
+
}
|
|
25
|
+
await page.goto(`file://${htmlPath}`, { timeout: Options?.timeout ?? 120000, waitUntil: 'networkidle2' });
|
|
26
|
+
const body = await page.$(Options?.tab ?? 'body');
|
|
27
|
+
if (!body)
|
|
28
|
+
return false;
|
|
29
|
+
const boundingBox = await body.boundingBox();
|
|
30
|
+
const num = Options?.isSplit ? Math.ceil(boundingBox.height / pageHeight) : 1;
|
|
31
|
+
pageHeight = Math.round(boundingBox.height / num);
|
|
32
|
+
await page.setViewport({
|
|
33
|
+
width: boundingBox.width + 50,
|
|
34
|
+
height: pageHeight + 100
|
|
35
|
+
});
|
|
36
|
+
if (Options?.addStyle) {
|
|
37
|
+
await page.addStyleTag({
|
|
38
|
+
content: Options.addStyle,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
await page.addStyleTag({
|
|
42
|
+
content: `img[src$=".gif"] {animation-play-state: paused !important;}`
|
|
43
|
+
});
|
|
44
|
+
if (Options?.saveHtmlfile === true) {
|
|
45
|
+
const htmlContent = await page.content();
|
|
46
|
+
const Dir = path.join(_paths.root, `/temp/html/yuki-plugin/${name}/`);
|
|
47
|
+
if (!fs__default.existsSync(Dir)) {
|
|
48
|
+
fs__default.mkdirSync(Dir, { recursive: true });
|
|
49
|
+
}
|
|
50
|
+
fs__default.writeFileSync(`${Dir}${Date.now()}.html`, htmlContent);
|
|
51
|
+
}
|
|
52
|
+
logger.info('[puppeteer] success');
|
|
53
|
+
let numSun = 0;
|
|
54
|
+
let start = Date.now();
|
|
55
|
+
const ret = new Array();
|
|
56
|
+
let buff;
|
|
57
|
+
for (let i = 1; i <= num; i++) {
|
|
58
|
+
if (i > 1) {
|
|
59
|
+
await page.evaluate(pageHeight => {
|
|
60
|
+
window.scrollBy(0, pageHeight);
|
|
61
|
+
}, pageHeight);
|
|
62
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
63
|
+
}
|
|
64
|
+
let renderOptions = Options?.SOptions ?? { type: 'png' };
|
|
65
|
+
const screenshotOptions = {
|
|
66
|
+
...renderOptions,
|
|
67
|
+
clip: {
|
|
68
|
+
x: 0,
|
|
69
|
+
y: pageHeight * (i - 1),
|
|
70
|
+
width: Math.round(boundingBox.width),
|
|
71
|
+
height: Math.min(pageHeight, boundingBox.height - pageHeight * (i - 1)),
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
buff = await page.screenshot(screenshotOptions).catch(err => {
|
|
75
|
+
logger.error('[puppeteer]', 'screenshot', err);
|
|
76
|
+
return false;
|
|
77
|
+
});
|
|
78
|
+
numSun++;
|
|
79
|
+
if (buff !== false) {
|
|
80
|
+
const kb = (buff?.length / 1024).toFixed(2) + "kb";
|
|
81
|
+
logger.mark(`[图片生成][${name}][${numSun}次] ${kb} ${logger.green(`${Date.now() - start}ms`)}`);
|
|
82
|
+
ret.push(buff);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
logger.error(`[puppeteer]`, '截图失败');
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (ret.length === 0 || !ret[0]) {
|
|
89
|
+
logger.error(`[图片生成][${name}] 图片生成为空`);
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
await page.close().catch(err => logger.error(err));
|
|
93
|
+
return { img: ret };
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
logger.error('[puppeteer] newPage', err);
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export { YukiPuppeteerRender };
|
package/package.json
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "yz-yuki-plugin",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "优纪插件,yunzaijs 关于 微博推送、B站推送 等功能的拓展插件",
|
|
5
|
+
"author": "snowtafir",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"main": "main.js",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"app": "npm run css && node --no-warnings=ExperimentalWarning --loader ts-node/esm src/main.js",
|
|
11
|
+
"dev": "npm run css && nodemon",
|
|
12
|
+
"img": "npm run css && nodemon --config routes.nodemon.json",
|
|
13
|
+
"build": "npm run css:m && rollup --config rollup.config.js",
|
|
14
|
+
"css": "tailwindcss -i ./src/input.css -o ./public/output.css",
|
|
15
|
+
"css:m": "tailwindcss -i ./src/input.css -o ./public/output.css -m",
|
|
16
|
+
"css:watch": "tailwindcss -i ./src/input.css -o ./public/output.css --watch",
|
|
17
|
+
"format": "prettier --write ."
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"axios": "^1.7.2",
|
|
21
|
+
"chokidar": "^3.6.0",
|
|
22
|
+
"jsdom": "^24.1.0",
|
|
23
|
+
"json5": "^2.2.3",
|
|
24
|
+
"md5": "^2.3.0",
|
|
25
|
+
"moment": "^2.30.1",
|
|
26
|
+
"node-fetch": "^3.3.2",
|
|
27
|
+
"puppeteer": "^22.14.0",
|
|
28
|
+
"qrcode": "^1.5.3",
|
|
29
|
+
"react": "^18.3.1",
|
|
30
|
+
"react-dom": "^18.3.1",
|
|
31
|
+
"react-puppeteer": "1.0.0-rc.7",
|
|
32
|
+
"redis": "^4.6.13",
|
|
33
|
+
"yaml": "^2.5.0",
|
|
34
|
+
"yarn": "^1.19.1"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@rollup/plugin-commonjs": "^26.0.1",
|
|
38
|
+
"@rollup/plugin-image": "^3.0.3",
|
|
39
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
40
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
41
|
+
"@rollup/plugin-replace": "^5.0.7",
|
|
42
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
43
|
+
"@rollup/plugin-typescript": "^11.1.3",
|
|
44
|
+
"@types/jsdom": "^21.1.7",
|
|
45
|
+
"@types/lodash": "^4.17.7",
|
|
46
|
+
"@types/md5": "^2.3.5",
|
|
47
|
+
"@types/node": "^20.8.5",
|
|
48
|
+
"@types/node-fetch": "^2.6.11",
|
|
49
|
+
"@types/qrcode": "^1.5.5",
|
|
50
|
+
"@types/react": "^18.3.3",
|
|
51
|
+
"@types/react-dom": "^18.3.0",
|
|
52
|
+
"@types/rollup-plugin-auto-external": "^2.0.5",
|
|
53
|
+
"@types/yaml": "1.9.7",
|
|
54
|
+
"axios": "^1.7.2",
|
|
55
|
+
"chokidar": "^3.6.0",
|
|
56
|
+
"jsdom": "^24.1.0",
|
|
57
|
+
"json5": "^2.2.3",
|
|
58
|
+
"md5": "^2.3.0",
|
|
59
|
+
"node-fetch": "^3.3.2",
|
|
60
|
+
"nodemon": "^3.0.1",
|
|
61
|
+
"prettier": "^3.2.5",
|
|
62
|
+
"puppeteer": "^22.14.0",
|
|
63
|
+
"qrcode": "^1.5.3",
|
|
64
|
+
"react": "^18.3.1",
|
|
65
|
+
"react-dom": "^18.3.1",
|
|
66
|
+
"react-puppeteer": "1.0.0-rc.7",
|
|
67
|
+
"redis": "^4.6.13",
|
|
68
|
+
"rollup": "^4.16.4",
|
|
69
|
+
"rollup-plugin-auto-external": "^2.0.0",
|
|
70
|
+
"rollup-plugin-copy": "^3.5.0",
|
|
71
|
+
"rollup-plugin-dts": "^6.1.1",
|
|
72
|
+
"rollup-plugin-ignore": "^1.0.10",
|
|
73
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
74
|
+
"tailwindcss": "^3.4.3",
|
|
75
|
+
"ts-node": "^10.9.2",
|
|
76
|
+
"typescript": "^5.4.5",
|
|
77
|
+
"yunzai": "^1.0.1-rc.2",
|
|
78
|
+
"yunzai-mys": "^1.0.0-rc.0"
|
|
79
|
+
},
|
|
80
|
+
"files": [
|
|
81
|
+
"public",
|
|
82
|
+
"resources",
|
|
83
|
+
"lib",
|
|
84
|
+
"defaultConfig",
|
|
85
|
+
"CHANGELOG.md",
|
|
86
|
+
"README.md",
|
|
87
|
+
"package.json",
|
|
88
|
+
"LICENSE"
|
|
89
|
+
],
|
|
90
|
+
"types": "lib/types",
|
|
91
|
+
"exports": {
|
|
92
|
+
".": {
|
|
93
|
+
"import": "./lib/index.js",
|
|
94
|
+
"types": "./lib/types/index.d.ts"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"keywords": [
|
|
98
|
+
"yunzai"
|
|
99
|
+
],
|
|
100
|
+
"publishConfig": {
|
|
101
|
+
"registry": "https://registry.npmjs.org/"
|
|
102
|
+
},
|
|
103
|
+
"engines": {
|
|
104
|
+
"node": ">=16.14.0"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! tailwindcss v3.4.7 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid #e5e7eb}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:initial}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:initial;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:initial}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,::backdrop,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.m-auto{margin:auto}.mb-3{margin-bottom:.75rem}.ml-7{margin-left:1.75rem}.mt-3{margin-top:.75rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-72{height:18rem}.max-h-96{max-height:24rem}.w-32{width:8rem}.w-72{width:18rem}.w-96{width:24rem}.p-1{padding:.25rem}.p-5{padding:1.25rem}.text-center{text-align:center}.text-lg{font-size:1.125rem;line-height:1.75rem}.italic{font-style:italic}.text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity))}.text-red-600{--tw-text-opacity:1;color:rgb(220 38 38/var(--tw-text-opacity))}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
.account {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: flex;
|
|
4
|
+
margin-bottom: 20px;
|
|
5
|
+
padding: 20px;
|
|
6
|
+
border-bottom-width: 1px;
|
|
7
|
+
border-bottom-color: #ffcee6;
|
|
8
|
+
border-bottom-style: dashed;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: space-between;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.avatar-container {
|
|
14
|
+
position: relative;
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
margin-left: 10px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.avatar {
|
|
21
|
+
width: 95px;
|
|
22
|
+
height: 95px;
|
|
23
|
+
border-radius: 50%;
|
|
24
|
+
margin-right: 10px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.pendant {
|
|
28
|
+
width: 160px;
|
|
29
|
+
height: 160px;
|
|
30
|
+
position: absolute;
|
|
31
|
+
top: -32px;
|
|
32
|
+
left: -32px;
|
|
33
|
+
z-index: 1;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.account-info {
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
margin-left: 10px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.nickname {
|
|
43
|
+
font-size: 25px;
|
|
44
|
+
font-weight: bold;
|
|
45
|
+
color: #333;
|
|
46
|
+
margin-left: 10px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.timestamp {
|
|
50
|
+
font-size: 16px;
|
|
51
|
+
color: #666;
|
|
52
|
+
margin-top: 5px;
|
|
53
|
+
margin-left: 10px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.logo-container {
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.bilibili-logo,
|
|
62
|
+
.weibo-logo {
|
|
63
|
+
margin-left: 10px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.weibo-logo {
|
|
67
|
+
max-width: 55px;
|
|
68
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
@font-face {
|
|
2
|
+
font-family: "iconfont";
|
|
3
|
+
src: url("./../../fonts/iconfont.16acc2.ttf");
|
|
4
|
+
font-weight: normal;
|
|
5
|
+
font-style: normal;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.content {
|
|
9
|
+
font-size: 20px;
|
|
10
|
+
color: #333;
|
|
11
|
+
margin-bottom: 20px;
|
|
12
|
+
padding-left: 20px;
|
|
13
|
+
padding-right: 20px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.content-text {
|
|
17
|
+
font-family: "iconfont", Arial, sans-serif;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.content img {
|
|
21
|
+
max-width: 100%;
|
|
22
|
+
height: auto;
|
|
23
|
+
border-radius: 8px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/*自适应九宫格*/
|
|
27
|
+
.pic-content {
|
|
28
|
+
margin-top: 15px;
|
|
29
|
+
width: 100%;
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-wrap: wrap;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.pic-item {
|
|
35
|
+
/* flex: 1 0 calc(33.3333% - 10px); */
|
|
36
|
+
margin: 2px;
|
|
37
|
+
background-size: contain;
|
|
38
|
+
background-repeat: no-repeat;
|
|
39
|
+
background-position: center center;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.pic-item:after {
|
|
43
|
+
display: block;
|
|
44
|
+
padding-bottom: 100%;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/******/
|
|
48
|
+
|
|
49
|
+
/**微博content图标*/
|
|
50
|
+
.url-icon img {
|
|
51
|
+
left: 10px;
|
|
52
|
+
position: absolute;
|
|
53
|
+
visibility: hidden;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.bili-rich-text-module,
|
|
57
|
+
.surl-text {
|
|
58
|
+
color: #008ac5;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* 定义B站互动抽奖标签的样式 */
|
|
62
|
+
.bili-rich-text-module.lottery {
|
|
63
|
+
display: inline-block;
|
|
64
|
+
padding-left: 20px;
|
|
65
|
+
/* 为图标留出空间 */
|
|
66
|
+
position: relative;
|
|
67
|
+
background-repeat: no-repeat;
|
|
68
|
+
background-position: left center;
|
|
69
|
+
background-size: 20px 20px;
|
|
70
|
+
/* 根据你的SVG图标大小调整 */
|
|
71
|
+
background-image: url('./../../img/icon/dynamic/bili-rich-text-module-lottery.svg');
|
|
72
|
+
/* 引入SVG图标 */
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* 定义B站淘宝商品推广标签样式 */
|
|
76
|
+
.bili-rich-text-module.goods.taobao {
|
|
77
|
+
display: inline-block;
|
|
78
|
+
padding-left: 20px;
|
|
79
|
+
/* 为图标留出空间 */
|
|
80
|
+
position: relative;
|
|
81
|
+
background-repeat: no-repeat;
|
|
82
|
+
background-position: left center;
|
|
83
|
+
background-size: 20px 20px;
|
|
84
|
+
/* 根据你的SVG图标大小调整 */
|
|
85
|
+
background-image: url('./../../img/icon/dynamic/bili-rich-text-module-goods-taobao.svg');
|
|
86
|
+
/* 引入SVG图标 */
|
|
87
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
@font-face {
|
|
2
|
+
font-family: "iconfont";
|
|
3
|
+
src: url("./../../fonts/iconfont.16acc2.ttf");
|
|
4
|
+
font-weight: normal;
|
|
5
|
+
font-style: normal;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.footer {
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: space-between;
|
|
11
|
+
align-items: center;
|
|
12
|
+
color: #000;
|
|
13
|
+
padding: 10px 20px;
|
|
14
|
+
border-top-width: 1px;
|
|
15
|
+
border-top-color: #ff69b4;
|
|
16
|
+
border-top-style: dashed;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.qr-code {
|
|
20
|
+
width: 148px;
|
|
21
|
+
height: 148px;
|
|
22
|
+
border-radius: 8px;
|
|
23
|
+
border: 2px dashed #ff69b4;
|
|
24
|
+
margin-left: 20px;
|
|
25
|
+
margin-top: 20px;
|
|
26
|
+
align-items: center;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.footer-text-container {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
align-items: flex-start;
|
|
33
|
+
font-size: 20px;
|
|
34
|
+
font-family: "iconfont", Arial, sans-serif;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.bili-logo-0 {
|
|
38
|
+
margin-bottom: 6px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.weibo-logo-0 {
|
|
42
|
+
margin-left: 15px;
|
|
43
|
+
margin-bottom: 10px;
|
|
44
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
.bilibili-logo-text {
|
|
2
|
+
margin-left: 40px;
|
|
3
|
+
margin-top: 2px;
|
|
4
|
+
color: #FB7299;
|
|
5
|
+
font-size: 18px;
|
|
6
|
+
font-weight: bold;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.weibo-logo-text {
|
|
10
|
+
margin-left: 2px;
|
|
11
|
+
margin-top: 2px;
|
|
12
|
+
color: rgba(232 146 20);
|
|
13
|
+
font-size: 18px;
|
|
14
|
+
font-weight: bold;
|
|
15
|
+
}
|