Skip to content

Commit

Permalink
支持用环境变量定义签名服务器地址并在 docker compose 中增加签名服务器
Browse files Browse the repository at this point in the history
  • Loading branch information
clansty committed Oct 17, 2023
1 parent 8c3edf6 commit 252b17c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
10 changes: 10 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,21 @@ services:
container_name: zincsearch
image: 'public.ecr.aws/zinclabs/zinc:latest'
restart: unless-stopped
sign:
image: xzhouqd/qsign:core-1.1.9
restart: unless-stopped
environment:
# 需要与下方的 SIGN_VER 同步
# 配置请参考 https://hub.docker.com/r/xzhouqd/qsign
- BASE_PATH=/srv/qsign/qsign/txlib/8.9.71
q2tg:
image: ghcr.io/clansty/q2tg:rainbowcat
container_name: main_q2tg
restart: unless-stopped
depends_on:
- postgres
- zinclabs
- sign
volumes:
- ./data:/app/data
environment:
Expand All @@ -42,6 +50,8 @@ services:
- ZINC_URL=http://zinclabs:4080
- ZINC_USERNAME=admin
- ZINC_PASSWORD=password
- SIGN_API=http://sign:8080/sign?key=114514
- SIGN_VER=8.9.71 # 与上方 sign 容器的配置同步
# 要支持转发时自动识别语音,请设置以下参数
- BAIDU_APP_ID=
- BAIDU_API_KEY=
Expand Down
19 changes: 12 additions & 7 deletions src/controllers/SetupController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,26 @@ export default class SetupController {
]);
const platform = setupHelper.convertTextToPlatform(platformText);

let signApi = await this.setupService.waitForOwnerInput('请输入签名服务器地址', [
[Button.text('不需要签名服务器', true, true)],
]);
signApi = setupHelper.checkSignApiAddress(signApi);
let signApi: string;

if (!process.env.SIGN_API) {
signApi = await this.setupService.waitForOwnerInput('请输入签名服务器地址', [
[Button.text('不需要签名服务器', true, true)],
]);
signApi = setupHelper.checkSignApiAddress(signApi);
}

let signVer: string;

let signVer = ""
if (signApi !== "") {
if (signApi && !process.env.SIGN_VER) {
signVer = await this.setupService.waitForOwnerInput('请输入签名服务器版本,当前支持安卓(8.9.63、8.9.68、8.9.70)、Tim(3.5.1、3.5.2)', [
[Button.text('8.9.63', true, true)],
[Button.text('8.9.68', true, true)],
[Button.text('8.9.70', true, true)],
[Button.text('3.5.1', true, true)],
[Button.text('3.5.2', true, true)],
]);
};
}

let password = await this.setupService.waitForOwnerInput('请输入密码', undefined, true);
password = md5Hex(password);
Expand Down
4 changes: 2 additions & 2 deletions src/models/Instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ export default class Instance {
uin: Number(this.qq.uin),
password: this.qq.password,
platform: this.qq.platform,
signApi: this.qq.signApi,
signVer: this._qq.signVer,
signApi: this.qq.signApi || process.env.SIGN_API,
signVer: this.qq.signVer || process.env.SIGN_VER,
onQrCode: async (file) => {
await this.ownerChat.sendMessage({
message: '请使用已登录这个账号的手机 QQ 扫描这个二维码授权',
Expand Down

0 comments on commit 252b17c

Please sign in to comment.