🎈 perf: 分离配置

This commit is contained in:
zhiyu1998 2023-02-14 16:50:32 +08:00
parent ea81c265a3
commit 9169c343bc
3 changed files with 13 additions and 5 deletions

View File

@ -125,8 +125,9 @@ async tuiimg (e) {
> 百度翻译api:https://fanyi-api.baidu.com/doc/21 > 百度翻译api:https://fanyi-api.baidu.com/doc/21
注册完填入方式参考上方注释url (app/tools.js) 注册完填入方式参考上方注释url (app/tools.js)
> 更改proxy地址在tools的71行 > 更改proxy地址在config/tools.yaml的71行
`this.proxyAddr = '10.0.8.10';` `proxyAddr: '127.0.0.1' # 魔法地址`
`proxyPort: '6152' # 魔法端口`
## 📦业务 ## 📦业务
![help](./img/help.jpg) ![help](./img/help.jpg)

View File

@ -12,6 +12,7 @@ import HttpProxyAgent from "https-proxy-agent";
import { mkdirsSync } from "../utils/file.js"; import { mkdirsSync } from "../utils/file.js";
import { downloadBFile, getDownloadUrl, mergeFileToMp4 } from "../utils/bilibili.js"; import { downloadBFile, getDownloadUrl, mergeFileToMp4 } from "../utils/bilibili.js";
import { parseUrl, parseM3u8, downloadM3u8Videos, mergeAcFileToMp4 } from "../utils/acfun.js"; import { parseUrl, parseM3u8, downloadM3u8Videos, mergeAcFileToMp4 } from "../utils/acfun.js";
import config from "../model/index.js";
// import { get, remove, add } from "../utils/redisu.js"; // import { get, remove, add } from "../utils/redisu.js";
const transMap = { : "zh", : "jp", : "wyw", : "en" }; const transMap = { : "zh", : "jp", : "wyw", : "en" };
@ -63,15 +64,18 @@ export class tools extends plugin {
], ],
}); });
// http://api.tuwei.space/girl // http://api.tuwei.space/girl
// 配置文件
this.toolsConfig = config.getConfig("tools");
// 视频保存路径 // 视频保存路径
this.defaultPath = `./data/rcmp4/`; this.defaultPath = this.toolsConfig.defaultPath;
// redis的key // redis的key
this.redisKey = `Yz:tools:cache:${this.group_id}`; this.redisKey = `Yz:tools:cache:${this.group_id}`;
// 代理接口 // 代理接口
// TODO 填写服务器的内网ID和clash的端口 // TODO 填写服务器的内网ID和clash的端口
this.proxyAddr = "10.0.8.10"; this.proxyAddr = this.toolsConfig.proxyAddr;
this.proxyPort = "7890"; this.proxyPort = this.toolsConfig.proxyPort;
this.myProxy = `http://${this.proxyAddr}:${this.proxyPort}`; this.myProxy = `http://${this.proxyAddr}:${this.proxyPort}`;
console.log(this.myProxy)
} }
// 翻译插件 // 翻译插件

3
config/tools.yaml Normal file
View File

@ -0,0 +1,3 @@
defaultPath: './data/rcmp4/' # 保存视频的位置
proxyAddr: '127.0.0.1' # 魔法地址
proxyPort: '6152' # 魔法端口