🌴 Sync 2026-03-05 23:51:42

This commit is contained in:
github-actions[bot] committed 2026-03-05 23:51:42 +08:00
1 parent 0d155c70be
commit 32600acc60
14258 files changed
+3954570

No files matched your search

+67
View File
@@ -0,0 +1,67 @@
#
# Copyright (C) 2015-2016 OpenWrt.org
# Copyright (C) 2024 xiaobao@linkease.com
#
# This is free software, licensed under the GNU General Public License v3.
#
include $(TOPDIR)/rules.mk
PKG_ARCH_sunpanel:=$(ARCH)
PKG_NAME:=sunpanel
PKG_VERSION:=1.3.1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-binary-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/linkease/istore-packages/releases/download/prebuilt/
PKG_HASH:=skip
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-binary-$(PKG_VERSION)
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
SECTION:=net
CATEGORY:=Network
SUBMENU:=Web Servers/Proxies
TITLE:=SunPanel, NAS navigation panel.
DEPENDS:=@(x86_64||aarch64||arm) +ubus +uci +bash
URL:=https://sun-panel-doc.enianteam.com/
endef
define Package/$(PKG_NAME)/description
Server, NAS navigation panel, Homepage, Browser homepage.
endef
define Package/$(PKG_NAME)/conffiles
/etc/config/sunpanel
endef
define Package/$(PKG_NAME)/postinst
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
[ -f /etc/uci-defaults/sunpanel ] && /etc/uci-defaults/sunpanel && rm -f /etc/uci-defaults/sunpanel
exit 0
fi
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d $(1)/etc/config $(1)/usr/libexec/istorec $(1)/usr/share/sunpanel $(1)/etc/uci-defaults
$(INSTALL_BIN) $(PKG_BUILD_DIR)/sunpanelbin.$(PKG_ARCH_sunpanel) $(1)/usr/sbin/sunpanelbin
$(INSTALL_BIN) ./files/sunpanel.init $(1)/etc/init.d/sunpanel
$(CP) ./files/sunpanel_conf.lua $(1)/usr/libexec/istorec/
$(CP) ./files/conf.temp $(1)/usr/share/sunpanel/
$(INSTALL_CONF) ./files/sunpanel.config $(1)/etc/config/sunpanel
$(INSTALL_BIN) ./files/sunpanel.uci-default $(1)/etc/uci-defaults/sunpanel
endef
$(eval $(call BuildPackage,$(PKG_NAME)))
+45
View File
@@ -0,0 +1,45 @@
# ======================
# Basic configuration
# ======================
[base]
# Web run port. Default:3002
http_port=<%=port%>
# Database driver [mysql/sqlite(Default)]
database_drive=sqlite
# Cache driver [redis/memory(Default)]
cache_drive=memory
# Queue driver [redis/memory(Default)]
queue_drive=memory
# Web Paths
web_path=/www/luci-static/sunpanel
# File cache path (Please start with the current path './')
# Warning: The files that have been uploaded after the modification cannot be accessed
source_path=<%=config_path%>/uploads
# File cache path.
source_temp_path=<%=config_path%>/runtime/temp
# ======================
# Mysql database driver
# ======================
[mysql]
host=127.0.0.1
port=3306
username=root
password=root
db_name=sun_panel
wait_timeout=100
# ======================
# sqlite database driver
# ======================
[sqlite]
file_path=<%=config_path%>/database/database.db
# ======================
# redis database driver
# ======================
[redis]
address=127.0.0.1:6379
password=
prefix=sun_panel:
db=0
+4
View File
@@ -0,0 +1,4 @@
config sunpanel
option enabled '0'
option port '3002'
option config_path ''
+30
View File
@@ -0,0 +1,30 @@
#!/bin/sh /etc/rc.common
START=99
USE_PROCD=1
NAME=sunpanel
get_config() {
config_get_bool enabled $1 enabled 0
config_get config_path $1 config_path
}
start_service() {
config_load "$NAME"
config_foreach get_config "$NAME"
[ $enabled != 1 ] && return 1
mkdir -p "$config_path"
lua /usr/libexec/istorec/sunpanel_conf.lua $NAME /usr/share/$NAME/conf.temp $config_path/conf.ini
procd_open_instance
procd_set_param file $config_path/conf.ini
procd_set_param command /usr/sbin/sunpanelbin -cfgPath $config_path
procd_set_param stderr 1
procd_set_param respawn
procd_close_instance
}
service_triggers() {
procd_add_reload_trigger "$NAME"
}
+21
View File
@@ -0,0 +1,21 @@
#!/bin/sh
[ ! -f "/usr/share/ucitrack/luci-app-sunpanel.json" ] && {
cat > /usr/share/ucitrack/luci-app-sunpanel.json << EEOF
{
"config": "sunpanel",
"init": "sunpanel"
}
EEOF
}
uci -q batch <<-EOF >/dev/null
delete ucitrack.@sunpanel[-1]
add ucitrack sunpanel
set ucitrack.@sunpanel[-1].init=sunpanel
commit ucitrack
EOF
/etc/init.d/sunpanel enable
exit 0
+96
View File
@@ -0,0 +1,96 @@
local util = require "luci.util"
local tparser = require "luci.template.parser"
local uci = require "luci.model.uci"
local nixio = require "nixio"
local tostring, pairs, loadstring = tostring, pairs, loadstring
local setmetatable, loadfile = setmetatable, loadfile
local getfenv, setfenv, rawget = getfenv, setfenv, rawget
local assert, type, error = assert, type, error
local default_ctx = {tostring = tostring}
local from_string = function(template)
return Template(default_ctx, nil, template)
end
local from_file = function(template_file)
return Template(default_ctx, template_file)
end
-- Template class
Template = util.class()
-- Constructor - Reads and compiles the template on-demand
function Template.__init__(self, viewns, name, template)
if name then
self.name = name
else
self.name = "[string]"
end
-- Create a new namespace for this template
self.viewns = viewns
-- Compile template
local err
local sourcefile
if name then
sourcefile = name
self.template, _, err = tparser.parse(sourcefile)
else
sourcefile = "[string]"
self.template, _, err = tparser.parse_string(template)
end
-- If we have no valid template throw error, otherwise cache the template
if not self.template then
error("Failed to load template '" .. self.name .. "'.\n" ..
"Error while parsing template '" .. sourcefile .. "':\n" ..
(err or "Unknown syntax error"))
end
end
-- Renders a template
function Template.render(self, scope)
-- Put our predefined objects in the scope of the template
setfenv(self.template, setmetatable({}, {__index =
function(tbl, key)
return rawget(tbl, key) or self.viewns[key] or scope[key]
end}))
-- Now finally render the thing
local stat, err = util.copcall(self.template)
if not stat then
error("Failed to execute template '" .. self.name .. "'.\n" ..
"A runtime error occurred: " .. tostring(err or "(nil)"))
end
end
if #arg == 3 then
local cur = uci.cursor()
local configs = {}
cur:foreach(arg[1], arg[1], function(s)
for k, v in pairs(s) do
configs[k] = v
end
end)
if not nixio.fs.access(arg[2]) then
print(arg[2] .. " not found")
os.exit(10)
end
local target = io.open(arg[3], "w")
if not target then
print(arg[3] .. " can not write")
end
configs.write = function(data)
target:write(data)
end
from_file(arg[2]):render(configs)
target:close()
else
print("penpot_template.lua [appname] [template-in] [template-out]")
end