%+header%> <% local fs = require "nixio.fs" local sys = require "luci.sys" -- Get URL parameters for messages local http = require "luci.http" local message = http.formvalue("message") local success = http.formvalue("success") -- Directory paths local config_dir = "/etc/insomclash/config/" local proxy_dir = "/etc/insomclash/proxy_providers/" local rule_dir = "/etc/insomclash/rule_providers/" -- Ensure directories exist fs.mkdirr(config_dir) fs.mkdirr(proxy_dir) fs.mkdirr(rule_dir) -- Function to get files in directory local function get_files(dir) local files = {} if fs.access(dir) then for file in fs.dir(dir) do if file ~= "." and file ~= ".." then local filepath = dir .. file local stat = fs.stat(filepath) if stat and stat.type == "reg" then table.insert(files, { name = file, path = filepath, size = stat.size, mtime = stat.mtime }) end end end end return files end local config_files = get_files(config_dir) local proxy_files = get_files(proxy_dir) local rule_files = get_files(rule_dir) %>
<%:Filename%> | <%:Size%> | <%:Modified%> | <%:Actions%> |
---|---|---|---|
<%=file.name%> | <%=string.format("%.1f KB", file.size/1024)%> | <%=os.date("%Y-%m-%d %H:%M:%S", file.mtime)%> | ?file=<%=luci.http.urlencode(file.path)%>" class="cbi-button cbi-button-edit"><%:Edit%> ?file=<%=luci.http.urlencode(file.path)%>" class="cbi-button cbi-button-apply"><%:Download%> ?file=<%=luci.http.urlencode(file.path)%>" class="cbi-button cbi-button-remove" onclick="return confirm('Delete this file?')"><%:Delete%> |
© 2024 BobbyUnknown - Insomclash