luci-app-vlmcsd: tidy up luci (#8150)

This commit is contained in:
Beginner 2021-11-01 09:57:56 +08:00 committed by GitHub
parent eff943777d
commit 0509415173
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 54 additions and 53 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 "<b><font color=green>Vlmcsd is running.</font></b>"
msgstr "<b><font color=green>KMS 服务器运行中</font></b>"
msgid "RUNNING"
msgstr "运行中"
msgid "<b><font color=red>Vlmcsd is not running.</font></b>"
msgstr "<b><font color=red>KMS 服务器未运行</font></b>"
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 下,可以增加新的产品主密钥。"

View File

@ -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))