mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 16:19:18 +00:00
🐞 fix: 解决摘要的顺序问题
This commit is contained in:
parent
ade210bc0e
commit
332c595846
@ -15,7 +15,7 @@ import {
|
||||
XHS_CK,
|
||||
RESTRICTION_DESCRIPTION,
|
||||
} from "../constants/constant.js";
|
||||
import { dataProcessing, formatBiliInfo, getIdVideo, secondsToTime } from "../utils/common.js";
|
||||
import { formatBiliInfo, getIdVideo, secondsToTime } from "../utils/common.js";
|
||||
import config from "../model/index.js";
|
||||
import Translate from "../utils/trans-strategy.js";
|
||||
import * as xBogus from "../utils/x-bogus.cjs";
|
||||
@ -345,16 +345,16 @@ export class tools extends plugin {
|
||||
biliInfo.unshift(segment.image(pic))
|
||||
// 限制视频解析
|
||||
const durationInMinutes = (curDuration / 60).toFixed(0);
|
||||
biliInfo.push(`${RESTRICTION_DESCRIPTION}\n当前视频时长约:${ durationInMinutes }分钟,\n大于管理员设置的最大时长 ${ this.biliDuration / 60 } 分钟!`)
|
||||
e.reply(biliInfo);
|
||||
biliInfo.push(`${ RESTRICTION_DESCRIPTION }\n当前视频时长约:${ durationInMinutes }分钟,\n大于管理员设置的最大时长 ${ this.biliDuration / 60 } 分钟!`)
|
||||
// 总结
|
||||
const summary = await this.getBiliSummary(bvid, cid, owner.mid);
|
||||
summary && e.reply(summary);
|
||||
summary && biliInfo.push(`\n${ summary }`);
|
||||
e.reply(biliInfo);
|
||||
return true;
|
||||
} else {
|
||||
// 总结
|
||||
const summary = await this.getBiliSummary(bvid, cid, owner.mid);
|
||||
summary && biliInfo.push(`\n${summary}`)
|
||||
summary && biliInfo.push(`\n${ summary }`);
|
||||
//
|
||||
e.reply(biliInfo);
|
||||
}
|
||||
@ -441,7 +441,7 @@ export class tools extends plugin {
|
||||
let resReply = "";
|
||||
// 总体总结
|
||||
if (summary) {
|
||||
resReply = `摘要:${ summary }\n`
|
||||
resReply = `\n摘要:${ summary }\n`
|
||||
}
|
||||
// 分段总结
|
||||
if (outline) {
|
||||
@ -983,7 +983,7 @@ export class tools extends plugin {
|
||||
/**
|
||||
* douyin 请求参数
|
||||
* @param url
|
||||
* @returns {Promise<unknown>}
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
async douyinRequest(url) {
|
||||
const params = {
|
||||
@ -1057,6 +1057,25 @@ export class tools extends plugin {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否是海外服务器
|
||||
* @return {Promise<Boolean>}
|
||||
*/
|
||||
async isOverseasServer() {
|
||||
const isOS = "Yz:rconsole:tools:oversea";
|
||||
// 如果第一次使用没有值就设置
|
||||
if (!(await redis.exists(isOS))) {
|
||||
await redis.set(
|
||||
JSON.stringify({
|
||||
os: false,
|
||||
}),
|
||||
);
|
||||
return true;
|
||||
}
|
||||
// 如果有就取出来
|
||||
return JSON.parse(redis.get(isOS)).os;
|
||||
}
|
||||
|
||||
/**
|
||||
* 限制用户调用
|
||||
* @param e
|
||||
|
@ -1,49 +0,0 @@
|
||||
// AES加密
|
||||
import crypto from "crypto";
|
||||
|
||||
const key = crypto.createHash("sha256").update("rconsole").digest();
|
||||
|
||||
/**
|
||||
* AES加密
|
||||
* @param ha1
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
async function ha12store(ha1) {
|
||||
// IV.E
|
||||
const iv = crypto.randomBytes(16);
|
||||
const c = crypto.createCipheriv("aes-256-cbc", key, iv);
|
||||
let e = c.update(ha1, "binary", "hex");
|
||||
e += c.final("hex");
|
||||
return iv.toString("hex") + "." + e;
|
||||
}
|
||||
|
||||
/**
|
||||
* AES解密
|
||||
* @param passstore
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
async function store2ha1(passstore) {
|
||||
try {
|
||||
const parts = passstore.split(".");
|
||||
if (parts.length === 2) {
|
||||
// 新的加密方式 with IV: IV.E
|
||||
const c = crypto.createDecipheriv("aes-256-cbc", key, Buffer.from(parts[0], "hex"));
|
||||
let d = c.update(parts[1], "hex", "binary");
|
||||
d += c.final("binary");
|
||||
return d;
|
||||
} else {
|
||||
// 旧加密方式 without IV: E
|
||||
const c = crypto.createDecipher("aes192", key);
|
||||
let d = c.update(passstore, "hex", "binary");
|
||||
d += c.final("binary");
|
||||
return d;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(
|
||||
"在[default]部分设置的passwordSecret无法解密信息。请确保所有节点的passwordSecret相同。如果您更改了密码保密信息,可能需要重新添加用户。",
|
||||
e,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export { ha12store, store2ha1 };
|
Loading…
x
Reference in New Issue
Block a user