mirror of
https://github.com/kenzok8/small-package
synced 2025-09-20 19:11:30 +08:00
update-09.30
This commit is contained in:
@ -14,7 +14,7 @@ PKG_LICENSE:=AGPL-3.0
|
||||
PKG_MAINTAINER:=lisaac <lisaac.cn@gmail.com> \
|
||||
Florian Eckert <fe@dev.tdt.de>
|
||||
|
||||
PKG_VERSION:=v0.5.23-3
|
||||
PKG_VERSION:=v0.5.24
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
|
@ -26,7 +26,8 @@ else
|
||||
|
||||
res = dk.containers:list({
|
||||
query = {
|
||||
all=true
|
||||
all = true,
|
||||
size = true
|
||||
}
|
||||
})
|
||||
if res and res.code and res.code < 300 then
|
||||
@ -89,7 +90,7 @@ function get_containers()
|
||||
data[index]["_image"] = iv.RepoTags and iv.RepoTags[1] or (iv.RepoDigests[1]:gsub("(.-)@.+", "%1") .. ":<none>")
|
||||
end
|
||||
end
|
||||
data[index]["_id_name"] = '<a href='..luci.dispatcher.build_url("admin/docker/container/"..v.Id)..' class="dockerman_link" title="'..translate("Container detail")..'">'.. data[index]["_name"] .. "<br><font color='#9f9f9f'>ID: " .. data[index]["_id"] .. "</font></a><br>Image: " .. (data[index]["_image"] or "<none>")
|
||||
data[index]["_id_name"] = '<a href='..luci.dispatcher.build_url("admin/docker/container/"..v.Id)..' class="dockerman_link" title="'..translate("Container detail")..'">'.. data[index]["_name"] .. "<br><font color='#9f9f9f'>ID: " .. data[index]["_id"] .. "</font></a><br>Image: " .. (data[index]["_image"] or "<none>") .. "<br><font color='#9f9f9f' title='"..translate("RW Size: ").. docker.byte_format(v['SizeRw']).. ' / ' .. translate("RootFS Size(Include image): ").. docker.byte_format(v['SizeRootFs']) .."'>Size: " .. docker.byte_format(v['SizeRw']).. '/'.. docker.byte_format(v['SizeRootFs']) .. "</font>"
|
||||
|
||||
if type(v.Mounts) == "table" and next(v.Mounts) then
|
||||
for _, v2 in pairs(v.Mounts) do
|
||||
|
@ -12,18 +12,10 @@ local m, s, o
|
||||
if dk:_ping().code ~= 200 then
|
||||
lost_state = true
|
||||
else
|
||||
res = dk.images:list()
|
||||
res = dk:df()
|
||||
if res and res.code and res.code < 300 then
|
||||
images = res.body
|
||||
end
|
||||
|
||||
res = dk.containers:list({
|
||||
query = {
|
||||
all=true
|
||||
}
|
||||
})
|
||||
if res and res.code and res.code < 300 then
|
||||
containers = res.body
|
||||
images = res.body.Images
|
||||
containers = res.body.Containers
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -10,22 +10,16 @@ local m, s, o
|
||||
local dk = docker.new()
|
||||
|
||||
local cmd_line = table.concat(arg, '/')
|
||||
local images, networks, containers
|
||||
local images, networks
|
||||
local create_body = {}
|
||||
|
||||
if dk:_ping().code ~= 200 then
|
||||
lost_state = true
|
||||
images = {}
|
||||
networks = {}
|
||||
containers ={}
|
||||
else
|
||||
images = dk.images:list().body
|
||||
networks = dk.networks:list().body
|
||||
containers = dk.containers:list({
|
||||
query = {
|
||||
all=true
|
||||
}
|
||||
}).body
|
||||
end
|
||||
|
||||
local is_quot_complete = function(str)
|
||||
|
@ -13,17 +13,6 @@ if dk:_ping().code ~= 200 then
|
||||
lost_state = true
|
||||
end
|
||||
|
||||
function byte_format(byte)
|
||||
local suff = {"B", "KB", "MB", "GB", "TB"}
|
||||
for i=1, 5 do
|
||||
if byte > 1024 and i < 5 then
|
||||
byte = byte / 1024
|
||||
else
|
||||
return string.format("%.2f %s", byte, suff[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
m = SimpleForm("dockerd",
|
||||
translate("Docker - Overview"),
|
||||
translate("An overview with the relevant data is displayed here with which the LuCI docker client is connected.")
|
||||
@ -114,9 +103,10 @@ s.volumes_total = '-'
|
||||
|
||||
-- local socket = luci.model.uci.cursor():get("dockerd", "dockerman", "socket_path")
|
||||
if not lost_state then
|
||||
local containers_list = dk.containers:list({query = {all=true}}).body
|
||||
local images_list = dk.images:list().body
|
||||
local vol = dk.volumes:list()
|
||||
local res = dk:df()
|
||||
local containers_list = res.body.Containers
|
||||
local images_list = res.body.Images
|
||||
local vol = res.body.Volumes
|
||||
local volumes_list = vol and vol.body and vol.body.Volumes or {}
|
||||
local networks_list = dk.networks:list().body or {}
|
||||
local docker_info = dk:info()
|
||||
@ -127,11 +117,11 @@ if not lost_state then
|
||||
docker_info_table['3ServerVersion']._value = docker_info.body.ServerVersion
|
||||
docker_info_table['4ApiVersion']._value = docker_info.headers["Api-Version"]
|
||||
docker_info_table['5NCPU']._value = tostring(docker_info.body.NCPU)
|
||||
docker_info_table['6MemTotal']._value = byte_format(docker_info.body.MemTotal)
|
||||
docker_info_table['6MemTotal']._value = docker.byte_format(docker_info.body.MemTotal)
|
||||
if docker_info.body.DockerRootDir then
|
||||
local statvfs = nixio.fs.statvfs(docker_info.body.DockerRootDir)
|
||||
local size = statvfs and (statvfs.bavail * statvfs.bsize) or 0
|
||||
docker_info_table['7DockerRootDir']._value = docker_info.body.DockerRootDir .. " (" .. tostring(byte_format(size)) .. " " .. translate("Available") .. ")"
|
||||
docker_info_table['7DockerRootDir']._value = docker_info.body.DockerRootDir .. " (" .. tostring(docker.byte_format(size)) .. " " .. translate("Available") .. ")"
|
||||
end
|
||||
|
||||
docker_info_table['8IndexServerAddress']._value = docker_info.body.IndexServerAddress
|
||||
|
@ -41,26 +41,18 @@ function get_volumes()
|
||||
end
|
||||
end
|
||||
data[index]["_created"] = v.CreatedAt
|
||||
data[index]["_size"] = docker.byte_format(v.UsageData and v.UsageData.Size or nil)
|
||||
end
|
||||
|
||||
return data
|
||||
end
|
||||
|
||||
if dk:_ping().code ~= 200 then
|
||||
lost_state = true
|
||||
else
|
||||
res = dk.volumes:list()
|
||||
res = dk:df()
|
||||
if res and res.code and res.code <300 then
|
||||
volumes = res.body.Volumes
|
||||
end
|
||||
|
||||
res = dk.containers:list({
|
||||
query = {
|
||||
all=true
|
||||
}
|
||||
})
|
||||
if res and res.code and res.code <300 then
|
||||
containers = res.body
|
||||
containers = res.body.Containers
|
||||
end
|
||||
end
|
||||
|
||||
@ -81,14 +73,11 @@ o.write = function(self, section, value)
|
||||
end
|
||||
|
||||
o = s:option(DummyValue, "_name", translate("Name"))
|
||||
|
||||
o = s:option(DummyValue, "_driver", translate("Driver"))
|
||||
|
||||
o = s:option(DummyValue, "_containers", translate("Containers"))
|
||||
o.rawhtml = true
|
||||
|
||||
o = s:option(DummyValue, "_mountpoint", translate("Mount Point"))
|
||||
|
||||
o = s:option(DummyValue, "_size", translate("Size"))
|
||||
o = s:option(DummyValue, "_created", translate("Created"))
|
||||
|
||||
s = m:section(SimpleSection)
|
||||
|
@ -489,4 +489,16 @@ _docker.remove_macvlan_interface = function(name)
|
||||
os.execute("ip link del " .. if_name)
|
||||
end
|
||||
|
||||
_docker.byte_format = function (byte)
|
||||
if not byte then return 'NaN' end
|
||||
local suff = {"B", "KB", "MB", "GB", "TB"}
|
||||
for i=1, 5 do
|
||||
if byte > 1024 and i < 5 then
|
||||
byte = byte / 1024
|
||||
else
|
||||
return string.format("%.2f %s", byte, suff[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return _docker
|
||||
|
@ -88,7 +88,7 @@
|
||||
}
|
||||
|
||||
function show_reslov_dialog() {
|
||||
document.getElementById('dialog_reslov') || document.body.insertAdjacentHTML("beforeend", '<div id="dialog_reslov"><div class="dialog_box"><div class="dialog_line"></div><div class="dialog_line"><span><%:Plese input <docker create/run> command line:%></span><br><span id="cmd-line-status"></span></div><div class="dialog_line"><textarea class="cbi-input-textarea" id="dialog_reslov_text" style="width: 100%; height:100%;" rows="15" onkeyup="clear_text()"></textarea></div><div class="dialog_line" style="text-align: right;"><input type="button" class="btn cbi-button cbi-button-apply" type="submit" value="<%:Submit%>" onclick="reslov_container()" /> <input type="button" class="btn cbi-button cbi-button-reset" type="reset" value="<%:Cancel%>" onclick="close_reslov_dialog()" /></div><div class="dialog_line"></div></div></div>')
|
||||
document.getElementById('dialog_reslov') || document.body.insertAdjacentHTML("beforeend", '<div id="dialog_reslov"><div class="dialog_box"><div class="dialog_line"></div><div class="dialog_line"><span><%:Plese input <docker create/run> command line:%></span><br><span id="cmd-line-status"></span></div><div class="dialog_line"><textarea class="cbi-input-textarea" id="dialog_reslov_text" style="width: 100%; height:100%;" rows="15" onkeyup="clear_text()" placeholder="docker run -d alpine sh"></textarea></div><div class="dialog_line" style="text-align: right;"><input type="button" class="btn cbi-button cbi-button-apply" type="submit" value="<%:Submit%>" onclick="reslov_container()"/> <input type="button" class="btn cbi-button cbi-button-reset" type="reset" value="<%:Cancel%>" onclick="close_reslov_dialog()" /></div><div class="dialog_line"></div></div></div>')
|
||||
document.body.classList.add('dialog-reslov-active')
|
||||
let s = document.getElementById('cmd-line-status')
|
||||
s.innerHTML = ""
|
||||
|
@ -261,7 +261,6 @@ local function processData(szType, content)
|
||||
end
|
||||
elseif szType == "sip008" then
|
||||
result.type = v2_ss
|
||||
result.v2ray_protocol = "shadowsocks"
|
||||
result.server = content.server
|
||||
result.server_port = content.server_port
|
||||
result.password = content.password
|
||||
@ -278,7 +277,6 @@ local function processData(szType, content)
|
||||
end
|
||||
elseif szType == "ssd" then
|
||||
result.type = v2_ss
|
||||
result.v2ray_protocol = "shadowsocks"
|
||||
result.server = content.server
|
||||
result.server_port = content.port
|
||||
result.password = content.password
|
||||
@ -498,7 +496,7 @@ local execute = function()
|
||||
nodes = servers
|
||||
-- SS SIP008 直接使用 Json 格式
|
||||
elseif jsonParse(raw) then
|
||||
nodes = jsonParse(raw)
|
||||
nodes = jsonParse(raw).servers or jsonParse(raw)
|
||||
if nodes[1].server and nodes[1].method then
|
||||
szType = 'sip008'
|
||||
end
|
||||
|
Reference in New Issue
Block a user