From 050941517318628d974a0b2331d562164cc7aaff Mon Sep 17 00:00:00 2001 From: Beginner <70857188+Beginner-Go@users.noreply.github.com> Date: Mon, 1 Nov 2021 09:57:56 +0800 Subject: [PATCH] luci-app-vlmcsd: tidy up luci (#8150) --- package/lean/luci-app-vlmcsd/Makefile | 6 ++-- .../luasrc/controller/vlmcsd.lua | 4 ++- .../luasrc/model/cbi/vlmcsd.lua | 35 ------------------- .../luasrc/model/cbi/vlmcsd/basic.lua | 17 +++++++++ .../luasrc/model/cbi/vlmcsd/config.lua | 22 ++++++++++++ .../lean/luci-app-vlmcsd/po/zh-cn/vlmcsd.po | 21 +++++------ package/lean/vlmcsd/Makefile | 2 +- 7 files changed, 54 insertions(+), 53 deletions(-) delete mode 100644 package/lean/luci-app-vlmcsd/luasrc/model/cbi/vlmcsd.lua create mode 100644 package/lean/luci-app-vlmcsd/luasrc/model/cbi/vlmcsd/basic.lua create mode 100644 package/lean/luci-app-vlmcsd/luasrc/model/cbi/vlmcsd/config.lua diff --git a/package/lean/luci-app-vlmcsd/Makefile b/package/lean/luci-app-vlmcsd/Makefile index 2bb1feb9c..99613cc8d 100644 --- a/package/lean/luci-app-vlmcsd/Makefile +++ b/package/lean/luci-app-vlmcsd/Makefile @@ -6,13 +6,11 @@ include $(TOPDIR)/rules.mk -LUCI_TITLE:=LuCI page for KMS +LUCI_TITLE:=LuCI support for KMS LUCI_DEPENDS:=+vlmcsd PKG_VERSION:=1.0 -PKG_RELEASE:=5 +PKG_RELEASE:=6 include $(TOPDIR)/feeds/luci/luci.mk # call BuildPackage - OpenWrt buildroot signature - - diff --git a/package/lean/luci-app-vlmcsd/luasrc/controller/vlmcsd.lua b/package/lean/luci-app-vlmcsd/luasrc/controller/vlmcsd.lua index 2a8ab5b13..97d48941d 100644 --- a/package/lean/luci-app-vlmcsd/luasrc/controller/vlmcsd.lua +++ b/package/lean/luci-app-vlmcsd/luasrc/controller/vlmcsd.lua @@ -5,7 +5,9 @@ function index() return end - entry({"admin", "services", "vlmcsd"}, cbi("vlmcsd"), _("KMS Server"), 100).dependent = true + entry({"admin", "services", "vlmcsd"}, alias("admin", "services", "vlmcsd", "basic"), _("KMS Server"), 100).dependent = true + entry({"admin", "services", "vlmcsd", "basic"}, cbi("vlmcsd/basic"), _("Basic Setting"), 1).leaf = true + entry({"admin", "services", "vlmcsd", "config"}, cbi("vlmcsd/config"), _("Config File"), 2).leaf = true entry({"admin", "services", "vlmcsd", "status"}, call("act_status")).leaf = true end diff --git a/package/lean/luci-app-vlmcsd/luasrc/model/cbi/vlmcsd.lua b/package/lean/luci-app-vlmcsd/luasrc/model/cbi/vlmcsd.lua deleted file mode 100644 index 1cb06b7ce..000000000 --- a/package/lean/luci-app-vlmcsd/luasrc/model/cbi/vlmcsd.lua +++ /dev/null @@ -1,35 +0,0 @@ - - -m = Map("vlmcsd") -m.title = translate("vlmcsd config") -m.description = translate("A KMS Server Emulator to active your Windows or Office") - -m:section(SimpleSection).template = "vlmcsd/vlmcsd_status" - -s = m:section(TypedSection, "vlmcsd") -s.addremove = false -s.anonymous = true - -s:tab("basic", translate("Basic Setting")) -enable = s:taboption("basic",Flag, "enabled", translate("Enable")) -enable.rmempty = false - -autoactivate = s:taboption("basic", Flag, "autoactivate", translate("Auto activate")) -autoactivate.rmempty = false - -s:tab("config", translate("Config File")) -config = s:taboption("config", Value, "config", translate("configfile"), translate("This file is /etc/vlmcsd.ini."), "") -config.template = "cbi/tvalue" -config.rows = 13 -config.wrap = "off" - -function config.cfgvalue(self, section) - return nixio.fs.readfile("/etc/vlmcsd.ini") -end - -function config.write(self, section, value) - value = value:gsub("\r\n?", "\n") - nixio.fs.writefile("/etc/vlmcsd.ini", value) -end - -return m diff --git a/package/lean/luci-app-vlmcsd/luasrc/model/cbi/vlmcsd/basic.lua b/package/lean/luci-app-vlmcsd/luasrc/model/cbi/vlmcsd/basic.lua new file mode 100644 index 000000000..d39338c78 --- /dev/null +++ b/package/lean/luci-app-vlmcsd/luasrc/model/cbi/vlmcsd/basic.lua @@ -0,0 +1,17 @@ +m = Map("vlmcsd") +m.title = translate("KMS Server") +m.description = translate("A KMS Server Emulator to active your Windows or Office") + +m:section(SimpleSection).template = "vlmcsd/vlmcsd_status" + +s = m:section(TypedSection, "vlmcsd") +s.addremove = false +s.anonymous = true + +enable = s:option(Flag, "enabled", translate("Enable")) +enable.rmempty = false + +autoactivate = s:option(Flag, "autoactivate", translate("Auto activate")) +autoactivate.rmempty = false + +return m diff --git a/package/lean/luci-app-vlmcsd/luasrc/model/cbi/vlmcsd/config.lua b/package/lean/luci-app-vlmcsd/luasrc/model/cbi/vlmcsd/config.lua new file mode 100644 index 000000000..6a62c4066 --- /dev/null +++ b/package/lean/luci-app-vlmcsd/luasrc/model/cbi/vlmcsd/config.lua @@ -0,0 +1,22 @@ +m = Map("vlmcsd") + +s = m:section(TypedSection, "vlmcsd") +s.addremove = false +s.anonymous = true + +config = s:option(Value, "config", translate("Config File")) +config.description = translate("This file is /etc/vlmcsd/vlmcsd.ini.") +config.template = "cbi/tvalue" +config.rows = 30 +config.wrap = "off" + +function config.cfgvalue(self, section) + return nixio.fs.readfile("/etc/vlmcsd/vlmcsd.ini") +end + +function config.write(self, section, value) + value = value:gsub("\r\n?", "\n") + nixio.fs.writefile("/etc/vlmcsd/vlmcsd.ini", value) +end + +return m diff --git a/package/lean/luci-app-vlmcsd/po/zh-cn/vlmcsd.po b/package/lean/luci-app-vlmcsd/po/zh-cn/vlmcsd.po index 75cb46be4..9767f52b3 100644 --- a/package/lean/luci-app-vlmcsd/po/zh-cn/vlmcsd.po +++ b/package/lean/luci-app-vlmcsd/po/zh-cn/vlmcsd.po @@ -1,6 +1,3 @@ -msgid "vlmcsd config" -msgstr "KMS 服务器设置" - msgid "KMS Server" msgstr "KMS 服务器" @@ -13,11 +10,14 @@ msgstr "配置文件" msgid "A KMS Server Emulator to active your Windows or Office" msgstr "KMS服务器可用于激活Windows或Office" -msgid "Vlmcsd is running." -msgstr "KMS 服务器运行中" +msgid "RUNNING" +msgstr "运行中" -msgid "Vlmcsd is not running." -msgstr "KMS 服务器未运行" +msgid "NOT RUNNING" +msgstr "未运行" + +msgid "Collecting data..." +msgstr "收集数据..." msgid "Enable" msgstr "启用" @@ -25,8 +25,5 @@ msgstr "启用" msgid "Auto activate" msgstr "自动激活局域网客户端" -msgid "configfile" -msgstr "配置文件" - -msgid "This file is /etc/vlmcsd.ini." -msgstr "这个文件在 /etc/vlmcsd.ini 下,可以增加新的产品主密钥。" +msgid "This file is /etc/vlmcsd/vlmcsd.ini." +msgstr "这个文件在 /etc/vlmcsd/vlmcsd.ini 下,可以增加新的产品主密钥。" diff --git a/package/lean/vlmcsd/Makefile b/package/lean/vlmcsd/Makefile index c00507e21..96fd35ed7 100644 --- a/package/lean/vlmcsd/Makefile +++ b/package/lean/vlmcsd/Makefile @@ -35,7 +35,7 @@ define Package/vlmcsd/install $(INSTALL_DIR) $(1)/usr/bin $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/vlmcsd $(1)/usr/bin/vlmcsd $(INSTALL_DIR) $(1)/etc - $(INSTALL_BIN) ./files/vlmcsd.ini $(1)/etc/vlmcsd.ini + $(INSTALL_BIN) ./files/vlmcsd.ini $(1)/etc/vlmcsd/vlmcsd.ini endef $(eval $(call BuildPackage,vlmcsd))