luci-app-argon-config: sync upstream

This commit is contained in:
sbwml 2023-08-23 11:00:55 +08:00
parent 7e36d40e58
commit f5a3312827
3 changed files with 14 additions and 7 deletions

View File

@ -6,9 +6,9 @@
'require ui'; 'require ui';
'require view'; 'require view';
var callSystemInfo = rpc.declare({ var callAvailSpace = rpc.declare({
object: 'system', object: 'luci.argon',
method: 'info' method: 'avail'
}); });
var callRemoveArgon = rpc.declare({ var callRemoveArgon = rpc.declare({
@ -34,7 +34,7 @@ return view.extend({
load: function() { load: function() {
return Promise.all([ return Promise.all([
uci.load('argon'), uci.load('argon'),
L.resolveDefault(callSystemInfo(), {}), L.resolveDefault(callAvailSpace(), {}),
L.resolveDefault(fs.list(bg_path), {}) L.resolveDefault(fs.list(bg_path), {})
]); ]);
}, },
@ -112,7 +112,7 @@ return view.extend({
} }
s = m.section(form.TypedSection, null, _('Upload background (available space: %1024.2mB)') s = m.section(form.TypedSection, null, _('Upload background (available space: %1024.2mB)')
.format(data[1].root.avail * 1024), .format(data[1].avail * 1024),
_('You can upload files such as gif/jpg/mp4/png/webm/webp files, to change the login page background.')); _('You can upload files such as gif/jpg/mp4/png/webm/webp files, to change the login page background.'));
s.addremove = false; s.addremove = false;
s.anonymous = true; s.anonymous = true;

View File

@ -9,6 +9,8 @@ readonly tmp_path="/tmp/argon_background.tmp"
case "$1" in case "$1" in
"list") "list")
json_init json_init
json_add_object "avail"
json_close_object
json_add_object "remove" json_add_object "remove"
json_add_string "filename" "filename" json_add_string "filename" "filename"
json_close_object json_close_object
@ -20,6 +22,12 @@ case "$1" in
;; ;;
"call") "call")
case "$2" in case "$2" in
"avail")
json_init
json_add_int "avail" "$(df | grep -E '/$' | awk '{print $4}')"
json_dump
json_cleanup
;;
"remove") "remove")
read -r input read -r input
json_load "$input" json_load "$input"

View File

@ -6,8 +6,7 @@
"/www/luci-static/argon/background/*": [ "list" ] "/www/luci-static/argon/background/*": [ "list" ]
}, },
"ubus": { "ubus": {
"luci.argon": [ "remove", "rename" ], "luci.argon": [ "avail", "remove", "rename" ]
"system": [ "info" ]
}, },
"uci": [ "argon" ] "uci": [ "argon" ]
}, },