🐶 Sync 2026-04-18 02:04:09

This commit is contained in:
github-actions[bot] committed 2026-04-18 02:04:09 +08:00
1 parent 411261cf2a
commit 50677d77a8
207 files changed
+3148 -3426

No files matched your search

@@ -6,7 +6,6 @@ function index()
page = entry({"admin", "system", "fileassistant"}, template("fileassistant"), _("文件管理"), 50)
page.i18n = "base"
page.dependent = true
page.acl_depends = { "luci-app-fileassistant" }
page = entry({"admin", "nas", "fileassistant", "list"}, call("fileassistant_list"), nil)
page.leaf = true
@@ -26,6 +25,14 @@ function index()
page = entry({"admin", "nas", "fileassistant", "install"}, call("fileassistant_install"), nil)
page.leaf = true
page = entry({"admin", "nas", "fileassistant", "mkdir"}, call("fileassistant_mkdir"), nil)
page.leaf = true
page = entry({"admin", "nas", "fileassistant", "chmod"}, call("fileassistant_chmod"), nil)
page.leaf = true
page = entry({"admin", "nas", "fileassistant", "chown"}, call("fileassistant_chown"), nil)
page.leaf = true
end
function list_response(path, success)
@@ -109,15 +116,18 @@ function installIPK(filepath)
end
function fileassistant_upload()
local filecontent = luci.http.formvalue("upload-file")
local filename = luci.http.formvalue("upload-filename")
local uploaddir = luci.http.formvalue("upload-dir")
local filepath = uploaddir..filename
local fp
-- MUST setfilehandler before formvalue,
-- beacuse formvalue will parse form and write body to /tmp if filehandler not present
luci.http.setfilehandler(
function(meta, chunk, eof)
if not fp and meta and meta.name == "upload-file" then
local filename = luci.http.formvalue("upload-filename")
local uploaddir = luci.http.formvalue("upload-dir")
if not uploaddir or not filename then
error("uploaddir or filename is nil")
end
local filepath = uploaddir..filename
fp = io.open(filepath, "w")
end
if fp and chunk then
@@ -129,7 +139,28 @@ function fileassistant_upload()
end
)
list_response(uploaddir, true)
list_response(luci.http.formvalue("upload-dir"), true)
end
function fileassistant_mkdir()
local path = luci.http.formvalue("path")
local dirname = luci.http.formvalue("dirname")
local success = os.execute('sh -c \'cd "'..path..'" && mkdir -p "'..dirname..'"\'')
list_response(path, success)
end
function fileassistant_chmod()
local path = luci.http.formvalue("filepath")
local newmod = luci.http.formvalue("newmod")
local success = os.execute('chmod '..newmod..' "'..path..'"')
list_response(nixio.fs.dirname(path), success)
end
function fileassistant_chown()
local path = luci.http.formvalue("filepath")
local newown = luci.http.formvalue("newown")
local success = os.execute('chown '..newown..' "'..path..'"')
list_response(nixio.fs.dirname(path), success)
end
function scandir(directory)