update 2024-11-27 11:44:24

This commit is contained in:
actions-user 2024-11-27 11:44:24 +08:00
parent 11660fafed
commit 2d3b6ebe4a
11 changed files with 167 additions and 0 deletions

View File

@ -0,0 +1,17 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-design-config
PKG_MAINTAINER:=gngpp <gngppz@gmail.com>
LUCI_TITLE:=LuCI page for Design Config
LUCI_PKGARCH:=all
LUCI_DEPENDS:=+luci-compat
define Package/$(PKG_NAME)/conffiles
/etc/config/design
endef
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1 @@
# luci-app-design-config

View File

@ -0,0 +1,10 @@
module("luci.controller.design-config", package.seeall)
function index()
if not nixio.fs.access('/www/luci-static/design/css/style.css') then
return
end
local page = entry({"admin", "system", "design-config"}, form("design-config"), _("Design Config"), 90)
page.acl_depends = { "luci-app-design-config" }
end

View File

@ -0,0 +1,58 @@
local nxfs = require 'nixio.fs'
local nutil = require 'nixio.util'
local name = 'design'
local uci = require 'luci.model.uci'.cursor()
local mode, navbar, navbar_proxy
if nxfs.access('/etc/config/design') then
mode = uci:get_first('design', 'global', 'mode')
navbar = uci:get_first('design', 'global', 'navbar')
navbar_proxy = uci:get_first('design', 'global', 'navbar_proxy')
end
-- [[ 设置 ]]--
br = SimpleForm('config', translate('Design Config'), translate('Here you can set the mode of the theme and change the proxy tool icon in the navigation bar. [Recommend Chrome]'))
br.reset = false
br.submit = false
s = br:section(SimpleSection)
o = s:option(ListValue, 'mode', translate('Theme mode'))
o:value('normal', translate('Follow System'))
o:value('light', translate('Force Light'))
o:value('dark', translate('Force Dark'))
o.default = mode
o.rmempty = false
o.description = translate('You can choose Theme color mode here')
o = s:option(ListValue, 'navbar', translate('Navigation bar setting'))
o:value('display', translate('Display navigation bar'))
o:value('close', translate('Close navigation bar'))
o.default = navbar
o.rmempty = false
o.description = translate('The navigation bar is display by default')
o = s:option(ListValue, 'navbar_proxy', translate('Navigation bar proxy'))
o:value('openclash', 'openclash')
o:value('shadowsocksr', 'shadowsocksr')
o:value('vssr', 'vssr')
o:value('passwall', 'passwall')
o:value('passwall2', 'passwall2')
o.default = navbar_proxy
o.rmempty = false
o.description = translate('OpenClash by default')
o = s:option(Button, 'save', translate('Save Changes'))
o.inputstyle = 'reload'
function br.handle(self, state, data)
if (state == FORM_VALID and data.mode ~= nil and data.navbar ~= nil and data.navbar_proxy ~= nil) then
nxfs.writefile('/tmp/aaa', data)
for key, value in pairs(data) do
uci:set('design','@global[0]',key,value)
end
uci:commit('design')
end
return true
end
return br

View File

@ -0,0 +1,7 @@
<%+cbi/valueheader%>
<% if self:cfgvalue(section) ~= false then %>
<input class="cbi-button cbi-input-<%=self.inputstyle or "button" %>" style="display: <%= display %>" type="submit"<%= attr("name", cbid) .. attr("id", cbid) .. attr("value", self.inputtitle or self.title)%> />
<% else %>
-
<% end %>
<%+cbi/valuefooter%>

View File

@ -0,0 +1,8 @@
<%+cbi/valueheader%>
<span style="color: red">
<%
local val = self:cfgvalue(section) or self.default or ""
write(pcdata(val))
%>
</span>
<%+cbi/valuefooter%>

View File

@ -0,0 +1,44 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8\n"
msgid "Design Config"
msgstr "Design 主题设置"
msgid "Here you can set the mode of the theme and change the proxy tool icon in the navigation bar. [Recommend Chrome]"
msgstr "这里可以设置主题的模式和更换导航栏的代理工具图标。[建议使用 Chrome]"
msgid "Theme mode"
msgstr "主题模式"
msgid "Follow System"
msgstr "跟随系统"
msgid "Force Light"
msgstr "强制亮色"
msgid "Force Dark"
msgstr "强制暗色"
msgid "You can choose Theme color mode here"
msgstr "你可以选择喜欢的主题模式"
msgid "Navigation bar setting"
msgstr "导航栏设置"
msgid "Display navigation bar"
msgstr "显示导航栏"
msgid "Close navigation bar"
msgstr "关闭导航栏"
msgid "The navigation bar is display by default"
msgstr "默认显示导航栏"
msgid "Navigation bar proxy"
msgstr "导航栏代理"
msgid "OpenClash by default"
msgstr "默认 OpenClash"
msgid "Save Changes"
msgstr "保存更改"

View File

@ -0,0 +1 @@
zh-cn

View File

@ -0,0 +1,4 @@
config global
option mode 'dark'
option navbar 'display'
option navbar_proxy 'openclash'

View File

@ -0,0 +1,6 @@
#!/bin/sh
sed -i 's/cbi.submit\"] = true/cbi.submit\"] = \"1\"/g' /usr/lib/lua/luci/dispatcher.lua
rm -f /tmp/luci-indexcache
exit 0

View File

@ -0,0 +1,11 @@
{
"luci-app-design-config": {
"description": "Grant UCI access for luci-app-design-config",
"read": {
"uci": [ "design" ]
},
"write": {
"uci": [ "design" ]
}
}
}