Skip to content

Commit

Permalink
Add domain_id option to OpenWrt UI
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed Oct 28, 2021
1 parent d43169e commit bd3564d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
1 change: 1 addition & 0 deletions openwrt/aliyundrive-webdav/files/aliyundrive-webdav.config
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ config server
option cache_ttl '600'
option root '/'
option no_trash '0'
option domain_id ''
19 changes: 12 additions & 7 deletions openwrt/aliyundrive-webdav/files/aliyundrive-webdav.init
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,20 @@ start_service() {
local host=$(uci_get_by_type server host 127.0.0.1)
local port=$(uci_get_by_type server port 8080)
local root=$(uci_get_by_type server root /)
local no_trash=$(uci_get_by_type server no_trash 0)
local domain_id=$(uci_get_by_type server domain_id)

local extra_options="-I"
case "$no_trash" in
1|on|true|yes|enabled)
extra_options="$extra_options --no-trash"
;;
*) ;;
esac

if [[ ! -z "$domain_id" ]]; then
extra_options="$extra_options --domain-id $domain_id"
else
case "$(uci_get_by_type server no_trash 0)" in
1|on|true|yes|enabled)
extra_options="$extra_options --no-trash"
;;
*) ;;
esac
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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ cache_ttl.datatype = "uinteger"
no_trash = e:option(Flag, "no_trash", translate("Delete file permanently instead of trashing"))
no_trash.rmempty = false

domain_id = e:option(Value, "domain_id", translate("Domain ID"),
translate("Input domain_id option will use <a href=\"https://www.aliyun.com/product/storage/pds\" target=\"_blank\">Aliyun PDS</a> instead of <a href=\"https://www.aliyundrive.com\" target=\"_blank\">AliyunDrive</a>"))

debug = e:option(Flag, "debug", translate("Debug Mode"))
debug.rmempty = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,9 @@ msgstr "限制只能访问该云盘目录,默认为 / 表示不限制,注意

msgid "Delete file permanently instead of trashing"
msgstr "删除文件不放入回收站"

msgid "Domain ID"
msgstr "阿里云相册与云盘服务 domainId"

msgid "Input domain_id option will use <a href=\"https://www.aliyun.com/product/storage/pds\" target=\"_blank\">Aliyun PDS</a> instead of <a href=\"https://www.aliyundrive.com\" target=\"_blank\">AliyunDrive</a>"
msgid "填写此选项将使用<a href=\"https://www.aliyun.com/product/storage/pds\" target=\"_blank\">阿里云相册与网盘服务</a>而不是<a href=\"https://www.aliyundrive.com\" target=\"_blank\">阿里云盘</a>"

0 comments on commit bd3564d

Please sign in to comment.