Skip to content

Commit

Permalink
Add TLS options to OpenWrt LuCI
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed Jan 19, 2022
1 parent ac0d624 commit 4018690
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions openwrt/aliyundrive-webdav/files/aliyundrive-webdav.config
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ config server
option no_trash '0'
option domain_id ''
option read_only '0'
option tls_cert ''
option tls_key ''
6 changes: 6 additions & 0 deletions openwrt/aliyundrive-webdav/files/aliyundrive-webdav.init
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ start_service() {
local port=$(uci_get_by_type server port 8080)
local root=$(uci_get_by_type server root /)
local domain_id=$(uci_get_by_type server domain_id)
local tls_cert=$(uci_get_by_type server tls_cert)
local tls_key=$(uci_get_by_type server tls_key)

local extra_options="-I"

Expand All @@ -47,6 +49,10 @@ start_service() {
esac
fi

if [[ ! -z "$tls_cert" && ! -z "$tls_key" ]]; then
extra_options="$extra_options --tls-cert $tls_cert --tls-key $tls_key"
fi

procd_open_instance
procd_set_param command /bin/sh -c "/usr/bin/$NAME $extra_options --host $host --port $port --root $root -S $read_buf_size --cache-size $cache_size --cache-ttl $cache_ttl --workdir /var/run/$NAME >>/var/log/$NAME.log 2>&1"
procd_set_param pidfile /var/run/$NAME.pid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ port = e:option(Value, "port", translate("Port"))
port.default = "8080"
port.datatype = "port"

tls_cert = e:option(Value, "tls_cert", translate("TLS certificate file path"))
tls_key = e:option(Value, "tls_key", translate("TLS private key file path"))

auth_user = e:option(Value, "auth_user", translate("Username"))
auth_password = e:option(Value, "auth_password", translate("Password"))
auth_password.password = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ msgstr "监听主机"
msgid "Port"
msgstr "监听端口"

msgid "TLS certificate file path"
msgstr "TLS 证书文件路径"

msgid "TLS private key file path"
msgstr "TLS 私钥文件路径"

msgid "Username"
msgstr "用户名"

Expand Down

0 comments on commit 4018690

Please sign in to comment.