From 69701f1d46a00f9c5e18294f853ed036d6f28752 Mon Sep 17 00:00:00 2001 From: amumu <3201371660@qq.com> Date: Tue, 9 Jan 2024 02:22:16 +0800 Subject: [PATCH 1/2] =?UTF-8?q?1.=20config/config.yaml=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E8=BE=93=E5=87=BA=E7=BB=99BOT=E7=9A=84URL=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=EF=BC=88=E5=8F=8D=E5=90=91=E4=BB=A3=E7=90=86=E9=9C=80?= =?UTF-8?q?=E8=A6=81=EF=BC=89=202.=20plugins/example/mysSign.js=20?= =?UTF-8?q?=E5=AF=B9=E5=BA=94=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/config.yaml | 6 +++++- plugins/example/mysSign.js | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/config/config.yaml b/config/config.yaml index 7eb91c4..671836f 100755 --- a/config/config.yaml +++ b/config/config.yaml @@ -13,4 +13,8 @@ HTTP_TO_HTTPS: true # ssl证书crt文件路径 CA_CERTIFICATE: './config/SSL/certificate.crt' # ssl证书key文件路径 -CA_PRIVATE: './config/SSL/private.key' \ No newline at end of file +CA_PRIVATE: './config/SSL/private.key' + +# 输出给BOT的URL配置(反向代理需要) +PUBLIC_PORT: 80 +PUBLIC_PROTOCOL: 'https' diff --git a/plugins/example/mysSign.js b/plugins/example/mysSign.js index db85bde..607d954 100644 --- a/plugins/example/mysSign.js +++ b/plugins/example/mysSign.js @@ -154,8 +154,9 @@ export class MysSign extends plugin { get address () { let { Host } = this.cfg - let protocol = Server.cfg.http.HTTPS ? 'https' : 'http' - let port = Server.cfg.http_listen[0] + let { PUBLIC_PROTOCOL, PUBLIC_PORT } = Server.cfg.config.config + let port = PUBLIC_PORT || Server.cfg.http_listen[0] + let protocol = PUBLIC_PROTOCOL || (Server.cfg.http.HTTPS ? 'https' : 'http') if (![80, 443].includes(port)) Host += `:${port}` return `${protocol}://${Host}${this.route}` } @@ -169,4 +170,4 @@ export class MysSign extends plugin { checkObj[key] = data || {} return key } -} \ No newline at end of file +} -- Gitee From 21f23d8736bebc0b75f3d2733e6c0dda0691b644 Mon Sep 17 00:00:00 2001 From: amumu <3201371660@qq.com> Date: Tue, 9 Jan 2024 02:42:37 +0800 Subject: [PATCH 2/2] =?UTF-8?q?plugins/example/GTest.js=20=E5=AF=B9?= =?UTF-8?q?=E5=BA=94=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/example/GTest.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/example/GTest.js b/plugins/example/GTest.js index d3d93cb..66f53f2 100755 --- a/plugins/example/GTest.js +++ b/plugins/example/GTest.js @@ -109,9 +109,10 @@ export class GTest extends plugin { } get address () { - let { Host, Key } = this.cfg - let protocol = Server.cfg.http.HTTPS ? 'https' : 'http' - let port = Server.cfg.http_listen[0] + let { Host } = this.cfg + let { PUBLIC_PROTOCOL, PUBLIC_PORT } = Server.cfg.config.config + let port = PUBLIC_PORT || Server.cfg.http_listen[0] + let protocol = PUBLIC_PROTOCOL || (Server.cfg.http.HTTPS ? 'https' : 'http') if (![80, 443].includes(port)) Host += `:${port}` return `${protocol}://${Host}${this.route}` } @@ -125,4 +126,4 @@ export class GTest extends plugin { checkObj[key] = data || {} return key } -} \ No newline at end of file +} -- Gitee