diff --git a/applications/luci-app-ubuntu/luasrc/controller/ubuntu.lua b/applications/luci-app-ubuntu/luasrc/controller/ubuntu.lua index 827f2ed..c5f7103 100755 --- a/applications/luci-app-ubuntu/luasrc/controller/ubuntu.lua +++ b/applications/luci-app-ubuntu/luasrc/controller/ubuntu.lua @@ -3,9 +3,9 @@ module("luci.controller.ubuntu", package.seeall) function index() entry({'admin', 'services', 'ubuntu'}, alias('admin', 'services', 'ubuntu', 'client'), _('Ubuntu'), 10) - entry({"admin", "services", "ubuntu",'client'}, cbi("ubuntu/status"), nil).leaf = true + entry({"admin", "services", "ubuntu",'client'}, cbi("ubuntu/ubuntu"), nil).leaf = true - entry({"admin", "services", "ubuntu","status"}, call("get_container_status")) + entry({"admin", "services", "ubuntu","status"}, call("action_status")).leaf = true entry({"admin", "services", "ubuntu","stop"}, post("stop_container")) entry({"admin", "services", "ubuntu","start"}, post("start_container")) entry({"admin", "services", "ubuntu","install"}, post("install_container")) @@ -147,6 +147,14 @@ function uninstall_container() util.exec("docker container rm '"..container_id.."'") end +function action_status() + local e = {} + e.running = luci.sys.call("pidof aliyundrive-webdav >/dev/null") == 0 + e.application = luci.sys.exec("aliyundrive-webdav --version") + luci.http.prepare_content("application/json") + luci.http.write_json(e) +end + -- 总结: -- docker是否安装 -- 容器是否安装 @@ -159,4 +167,4 @@ end --[[ todo 网络请求提示框 - --]] \ No newline at end of file + --]] diff --git a/applications/luci-app-ubuntu/luasrc/model/cbi/ubuntu/status.lua b/applications/luci-app-ubuntu/luasrc/model/cbi/ubuntu/status.lua deleted file mode 100755 index 99936af..0000000 --- a/applications/luci-app-ubuntu/luasrc/model/cbi/ubuntu/status.lua +++ /dev/null @@ -1,26 +0,0 @@ -local m, s -local uci = luci.model.uci.cursor() -local sys = require 'luci.sys' -local docker = require "luci.model.docker" - -m = SimpleForm("ubuntu", translate("ubuntu"), translate("带Web远程桌面的Docker版Ubuntu。默认<用户名:kasm_user 密码:password>") -.. translatef(" " -.. "" -.. "访问官网", "https://www.kasmweb.com")) -m.submit=false -m.reset=false - -s = m:section(SimpleSection) -s.template = "dockerman/apply_widget" -s.err = docker:read_status() -s.err = s.err and s.err:gsub("\n","
"):gsub(" "," ") -if s.err then - docker:clear_status() -end - - -s=m:section(SimpleSection) -s.template = "ubuntu/ubuntu" - - -return m \ No newline at end of file diff --git a/applications/luci-app-ubuntu/luasrc/model/cbi/ubuntu/ubuntu.lua b/applications/luci-app-ubuntu/luasrc/model/cbi/ubuntu/ubuntu.lua new file mode 100755 index 0000000..0113808 --- /dev/null +++ b/applications/luci-app-ubuntu/luasrc/model/cbi/ubuntu/ubuntu.lua @@ -0,0 +1,17 @@ +local m, s +local uci = luci.model.uci.cursor() +local sys = require 'luci.sys' +local docker = require "luci.model.docker" + +m = Map("Ubuntu") +m.title = translate("Ubuntu") +m.description = translate("Project GitHub URL") +m.submit=false +m.reset=false + +m:section(SimpleSection).template = "ubuntu/ubuntu_status" + +s=m:section(SimpleSection) +s.template = "ubuntu/ubuntu" + +return m diff --git a/applications/luci-app-ubuntu/luasrc/view/ubuntu/ubuntu.htm b/applications/luci-app-ubuntu/luasrc/view/ubuntu/ubuntu.htm index bffb7b1..f7b0a9c 100755 --- a/applications/luci-app-ubuntu/luasrc/view/ubuntu/ubuntu.htm +++ b/applications/luci-app-ubuntu/luasrc/view/ubuntu/ubuntu.htm @@ -1,127 +1,81 @@ - + +
<%:Collecting data...%> +
+ + diff --git a/applications/luci-app-ubuntu/luasrc/view/ubuntu/ubuntu_status.htm b/applications/luci-app-ubuntu/luasrc/view/ubuntu/ubuntu_status.htm new file mode 100644 index 0000000..163a505 --- /dev/null +++ b/applications/luci-app-ubuntu/luasrc/view/ubuntu/ubuntu_status.htm @@ -0,0 +1,21 @@ + + +
+

+ <%:Collecting data...%> +

+
diff --git a/applications/luci-app-ubuntu/simple-install.sh b/applications/luci-app-ubuntu/simple-install.sh new file mode 100755 index 0000000..5baccd9 --- /dev/null +++ b/applications/luci-app-ubuntu/simple-install.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +# run in router + +mkdir -p /usr/lib/lua/luci/view/ubuntu/cbi +cp ./luasrc/controller/ubuntu.lua /usr/lib/lua/luci/controller/ +cp ./luasrc/model/cbi/ubuntu/ubuntu.lua /usr/lib/lua/luci/model/cbi/ubuntu/ +cp ./luasrc/view/ubuntu/* /usr/lib/lua/luci/view/ubuntu/ +cp -rf ./root /