Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New Features]请求增加 独立 HTTPS 端口 设置 #71

Closed
chengnan049 opened this issue Jun 27, 2023 · 4 comments
Closed

[New Features]请求增加 独立 HTTPS 端口 设置 #71

chengnan049 opened this issue Jun 27, 2023 · 4 comments
Labels
wontfix This will not be worked on

Comments

@chengnan049
Copy link

背景

根据 alist-org/alist#3943 要求,Alist 已在 https://github.com/alist-org/alist/pull/4536/files 加入 同时监听 HTTPHTTPS 端口功能,在最新的 3.19.0 中获得支持,默认端口为 5245

现象

luci-app-alist 中启动 Alist 后,/etc/alist/config.json 中 位于第五行的 https_port 参数会被覆盖为 5244 ,导致该功能无法生效

需求

Luci 中加入独立 HTTPS 端口设置选项

@sbwml
Copy link
Owner

sbwml commented Jun 27, 2023

目前仅激活单协议是刻意为之 a86f0ee ,你可以给一个有说服力的理由和它使用场景,再考虑是否需要增加独立 https 端口选项。因为我想不到在openwrt 上是有http/s 独立分开的使用方法(尽管luci 已被反向代理或配置tls 协议访问)

@chengnan049
Copy link
Author

场景的确不大,内网情况下会更加方便,且免除了 TLS 过程,有时候容器多了也会用到,反过来想仅使用单协议似乎也没有什么好处吧,毕竟内网环境下应该没有 HTTPS 的必要

@sbwml sbwml added the wontfix This will not be worked on label Jul 3, 2023
@felix-klk
Copy link

因为在外网下 希望可以独立更改 alist https端口避免被扫 同时通过反代过后的alist302 我这里会出现性能问题 直接不反代映射端口 就不存在这个问题

@sbwml
Copy link
Owner

sbwml commented Jul 3, 2023

如果你们认为这个东西是刚需,你可以自己编译来用,但它肯定不会在这个仓库上出现。修改补丁如下:

From b78bd251a91f8f2cb9f9c35a5b94c1fbc82f4141 Mon Sep 17 00:00:00 2001
From: sbwml <admin@cooluc.com>
Date: Mon, 3 Jul 2023 21:52:49 +0800
Subject: [PATCH] luci-app-alist: add https listening port support

---
 luci-app-alist/luasrc/model/cbi/alist/basic.lua | 5 +++++
 luci-app-alist/po/zh-cn/alist.po                | 3 +++
 luci-app-alist/root/etc/init.d/alist            | 3 ++-
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/luci-app-alist/luasrc/model/cbi/alist/basic.lua b/luci-app-alist/luasrc/model/cbi/alist/basic.lua
index 5b7723b..1e95832 100644
--- a/luci-app-alist/luasrc/model/cbi/alist/basic.lua
+++ b/luci-app-alist/luasrc/model/cbi/alist/basic.lua
@@ -23,6 +23,11 @@ o.rmempty = false
 o = s:option(Flag, "ssl", translate("Enable SSL"))
 o.rmempty=false
 
+o = s:option(Value, "https_port", translate("HTTPS Port"))
+o.datatype = "and(port,min(1))"
+o.default = "5245"
+o:depends("ssl", "1")
+
 o = s:option(Value,"ssl_cert", translate("SSL cert"), translate("SSL certificate file path"))
 o.datatype = "file"
 o:depends("ssl", "1")
diff --git a/luci-app-alist/po/zh-cn/alist.po b/luci-app-alist/po/zh-cn/alist.po
index 1f996d9..1d625a1 100644
--- a/luci-app-alist/po/zh-cn/alist.po
+++ b/luci-app-alist/po/zh-cn/alist.po
@@ -19,6 +19,9 @@ msgstr "启用"
 msgid "Port"
 msgstr "端口"
 
+msgid "HTTPS Port"
+msgstr "HTTPS 端口"
+
 msgid "Enable SSL"
 msgstr "启用 SSL"
 
diff --git a/luci-app-alist/root/etc/init.d/alist b/luci-app-alist/root/etc/init.d/alist
index c6de70f..0fc8867 100755
--- a/luci-app-alist/root/etc/init.d/alist
+++ b/luci-app-alist/root/etc/init.d/alist
@@ -12,6 +12,7 @@ get_config() {
 	config_get data_dir $1 data_dir "/etc/alist"
 	config_get temp_dir $1 temp_dir "/tmp/alist"
 	config_get ssl $1 ssl 0
+	config_get https_port $1 https_port 5245
 	config_get ssl_cert $1 ssl_cert ""
 	config_get ssl_key $1 ssl_key ""
 	config_get token_expires_in $1 token_expires_in 48
@@ -79,7 +80,7 @@ start_service() {
 	set_firewall
 	cat /dev/null > $temp_dir/alist.log
 	cat > $data_dir/config.json <<EOF
-{"force":false,"address":"$listen_addr","port":$port,"https_port":$port,"site_url":"$site_url","cdn":"","jwt_secret":"","token_expires_in":$token_expires_in,"database":{"type":"$database","host":"$mysql_host","port":$mysql_port,"user":"$mysql_username","password":"$mysql_password","name":"$mysql_database","db_file":"$data_dir/data.db","table_prefix":"x_","ssl_mode":""},"scheme":{"disable_http":$SSL,"https":$SSL,"cert_file":"$ssl_cert","key_file":"$ssl_key"},"temp_dir":"$temp_dir","log":{"enable":$LOG,"name":"$temp_dir/alist.log","max_size":10,"max_backups":5,"max_age":28,"compress":false},"delayed_start":$delayed_start,"max_connections":$max_connections}
+{"force":false,"address":"$listen_addr","port":$port,"https_port":$https_port,"site_url":"$site_url","cdn":"","jwt_secret":"","token_expires_in":$token_expires_in,"database":{"type":"$database","host":"$mysql_host","port":$mysql_port,"user":"$mysql_username","password":"$mysql_password","name":"$mysql_database","db_file":"$data_dir/data.db","table_prefix":"x_","ssl_mode":""},"scheme":{"disable_http":false,"https":$SSL,"cert_file":"$ssl_cert","key_file":"$ssl_key"},"temp_dir":"$temp_dir","log":{"enable":$LOG,"name":"$temp_dir/alist.log","max_size":10,"max_backups":5,"max_age":28,"compress":false},"delayed_start":$delayed_start,"max_connections":$max_connections}
 EOF
 	procd_open_instance alist
 	procd_set_param command $PROG
-- 
2.34.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants