From 9169c343bc6d1b101d34343088deb5f514766720 Mon Sep 17 00:00:00 2001 From: zhiyu1998 Date: Tue, 14 Feb 2023 16:50:32 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=88=20perf:=20=E5=88=86=E7=A6=BB?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 +++-- apps/tools.js | 10 +++++++--- config/tools.yaml | 3 +++ 3 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 config/tools.yaml diff --git a/README.md b/README.md index f479a44..e3ae376 100644 --- a/README.md +++ b/README.md @@ -125,8 +125,9 @@ async tuiimg (e) { > 百度翻译api:https://fanyi-api.baidu.com/doc/21 注册完填入方式参考上方注释url (app/tools.js) -> 更改proxy地址在tools的71行: -`this.proxyAddr = '10.0.8.10';` +> 更改proxy地址在config/tools.yaml的71行: +`proxyAddr: '127.0.0.1' # 魔法地址` +`proxyPort: '6152' # 魔法端口` ## 📦业务 ![help](./img/help.jpg) diff --git a/apps/tools.js b/apps/tools.js index 27eebfd..322dd1f 100644 --- a/apps/tools.js +++ b/apps/tools.js @@ -12,6 +12,7 @@ import HttpProxyAgent from "https-proxy-agent"; import { mkdirsSync } from "../utils/file.js"; import { downloadBFile, getDownloadUrl, mergeFileToMp4 } from "../utils/bilibili.js"; import { parseUrl, parseM3u8, downloadM3u8Videos, mergeAcFileToMp4 } from "../utils/acfun.js"; +import config from "../model/index.js"; // import { get, remove, add } from "../utils/redisu.js"; const transMap = { 中: "zh", 日: "jp", 文: "wyw", 英: "en" }; @@ -63,15 +64,18 @@ export class tools extends plugin { ], }); // http://api.tuwei.space/girl + // 配置文件 + this.toolsConfig = config.getConfig("tools"); // 视频保存路径 - this.defaultPath = `./data/rcmp4/`; + this.defaultPath = this.toolsConfig.defaultPath; // redis的key this.redisKey = `Yz:tools:cache:${this.group_id}`; // 代理接口 // TODO 填写服务器的内网ID和clash的端口 - this.proxyAddr = "10.0.8.10"; - this.proxyPort = "7890"; + this.proxyAddr = this.toolsConfig.proxyAddr; + this.proxyPort = this.toolsConfig.proxyPort; this.myProxy = `http://${this.proxyAddr}:${this.proxyPort}`; + console.log(this.myProxy) } // 翻译插件 diff --git a/config/tools.yaml b/config/tools.yaml new file mode 100644 index 0000000..bcee6f7 --- /dev/null +++ b/config/tools.yaml @@ -0,0 +1,3 @@ +defaultPath: './data/rcmp4/' # 保存视频的位置 +proxyAddr: '127.0.0.1' # 魔法地址 +proxyPort: '6152' # 魔法端口 \ No newline at end of file