update 2024-08-31 19:04:54

This commit is contained in:
kenzok8 2024-08-31 19:04:54 +08:00
parent b20a85dbed
commit 7dd4a4c887
119 changed files with 9161 additions and 0 deletions

52
ffmpeg-static/Makefile Normal file
View File

@ -0,0 +1,52 @@
#
# Copyright (C) 2015-2016 OpenWrt.org
# Copyright (C) 2020 jjm2473@gmail.com
#
# This is free software, licensed under the GNU General Public License v3.
#
include $(TOPDIR)/rules.mk
PKG_ARCH_ffmpeg:=$(ARCH)
PKG_NAME:=ffmpeg-static
PKG_VERSION:=0.0.1
PKG_RELEASE:=
PKG_SOURCE:=ffmpeg-binary-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/Carseason/openwrt-packages/releases/download/prebuilt/
PKG_HASH:=4dad394ac404672810ffa57d5d79d3ec0c3475f4b6bb788e967df195ca80d3a0
PKG_BUILD_DIR:=$(BUILD_DIR)/ffmpeg-binary-$(PKG_VERSION)
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
SECTION:=net
CATEGORY:=System
SUBMENU:=
TITLE:=FFMPEG
URL:=https://github.com/Carseason/openwrt-packages
endef
define Package/$(PKG_NAME)/description
A complete, cross-platform solution to record, convert and stream audio and video.
endef
define Package/$(PKG_NAME)/postinst
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ffmpeg.$(PKG_ARCH_ffmpeg) $(1)/usr/sbin/ffmpeg
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ffprobe.$(PKG_ARCH_ffmpeg) $(1)/usr/sbin/ffprobe
endef
$(eval $(call BuildPackage,$(PKG_NAME)))

View File

@ -0,0 +1,22 @@
# Copyright (C) 2016 Openwrt.org
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI support for istorego
LUCI_DEPENDS:=+docker +dockerd +luci-lib-taskd
LUCI_PKGARCH:=all
PKG_VERSION:=0.0.3
# PKG_RELEASE MUST be empty for luci.mk
PKG_RELEASE:=
LUCI_MINIFY_CSS:=0
LUCI_MINIFY_JS:=0
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,334 @@
local http = require "luci.http"
module("luci.controller.istorego", package.seeall)
function index()
if nixio.fs.access("/usr/lib/lua/luci/view/istorego/main.htm") then
entry({"admin", "istorego"}, call("istorego_index"), _("iStoreGo"), 32).leaf = true
end
entry({"admin", "istorego_api", "containers"}, call("istorego_api_containers"))
entry({"admin", "istorego_api", "images"}, call("istorego_api_images"))
entry({"admin", "istorego_api", "install"}, call("istorego_api_install"))
entry({"admin", "istorego_api", "uninstall"}, call("istorego_api_uninstall"))
entry({"admin", "istorego_api", "restart"}, call("istorego_api_restar"))
entry({"admin", "istorego_api", "start"}, call("istorego_api_start"))
entry({"admin", "istorego_api", "stop"}, call("istorego_api_stop"))
entry({"admin", "istorego_api", "pull"}, call("istorego_api_pull"))
entry({"admin", "istorego_api", "logs"}, call("istorego_api_logs"))
end
function istorego_index()
luci.template.render("istorego/main", {
prefix=luci.dispatcher.build_url(unpack({"admin", "istorego"}))
})
end
function istorego_api_images()
local http = require "luci.http"
http.prepare_content("application/json")
local method = http.getenv("REQUEST_METHOD")
local result;
result = luci.util.exec("docker images --format '{{json . }}'")
local response = {
success = 0,
result = result,
}
luci.http.write_json(response)
end
function istorego_api_containers()
local http = require "luci.http"
http.prepare_content("application/json")
local method = http.getenv("REQUEST_METHOD")
local result;
-- 展示全部容器,需要在前端格式化
-- 当监测到 Name 为 iStore_xxx 的则认为是 我们创建的插件
result = luci.util.exec("docker ps -a --format '{{json . }}'")
local response = {
success = 0,
result = result,
}
luci.http.write_json(response)
end
local function is_exec(cmd, async)
local nixio = require "nixio"
local os = require "os"
local fs = require "nixio.fs"
local rshift = nixio.bit.rshift
local oflags = nixio.open_flags("wronly", "creat")
local lock, code, msg = nixio.open("/var/lock/istorego.lock", oflags)
if not lock then
return 255, "", "Open lock failed: " .. msg
end
-- Acquire lock
local stat, code, msg = lock:lock("tlock")
if not stat then
lock:close()
return 255, "", "Lock failed: " .. msg
end
if async then
cmd = "/etc/init.d/tasks task_add istorego " .. luci.util.shellquote(cmd)
end
local r = os.execute(cmd .. " >/var/log/istorego.stdout 2>/var/log/istorego.stderr")
local e = fs.readfile("/var/log/istorego.stderr")
local o = fs.readfile("/var/log/istorego.stdout")
fs.unlink("/var/log/istorego.stderr")
fs.unlink("/var/log/istorego.stdout")
lock:lock("ulock")
lock:close()
e = e or ""
if r == 256 and e == "" then
e = "os.execute exit code 1"
end
return rshift(r,8), o or "", e or ""
end
function istorego_api_install()
local http = require "luci.http"
http.prepare_content("application/json")
local method = http.getenv("REQUEST_METHOD")
local result = "";
if method == "post" or method == "POST" then
local content = http.content()
local jsonc = require "luci.jsonc"
local json_parse = jsonc.parse
local req = json_parse(content)
if req == nil or next(req) == nil then
luci.http.write_json({
error = "invalid request"
})
return
end
if req.name == nil then
luci.http.write_json({
error = "not found name"
})
return
end
if req.cmds == nil then
luci.http.write_json({
error = "not found cmds"
})
return
end
--
local cmds = "docker run -d --name=iStore_"..req.name .. " ".. table.concat(req.cmds, " ")
result = cmds
local r,o,e = is_exec(cmds, true)
if r ~= 0 then
luci.http.write_json({
success = -1,
error = e,
})
return
end
end
local response = {
success = 0,
result = luci.util.shellquote(result),
}
luci.http.write_json(response)
end
function istorego_api_uninstall()
local http = require "luci.http"
http.prepare_content("application/json")
local method = http.getenv("REQUEST_METHOD")
if method == "post" or method == "POST" then
local content = http.content()
local jsonc = require "luci.jsonc"
local json_parse = jsonc.parse
local req = json_parse(content)
if req == nil or next(req) == nil then
luci.http.write_json({
error = "invalid request"
})
return
end
-- 卸载插件
if req.id ~= nil then
local force = "";
-- 强制删除
if req.force ~= nil and req.force == true then
force = "-f "
end
local r,o,e = is_exec("docker rm "..force..req.id, true)
if r ~= 0 then
luci.http.write_json({
error = e,
})
return
end
end
end
local response = {
success = 0,
}
luci.http.write_json(response)
end
function istorego_api_start()
local http = require "luci.http"
http.prepare_content("application/json")
local method = http.getenv("REQUEST_METHOD")
if method == "post" or method == "POST" then
local content = http.content()
local jsonc = require "luci.jsonc"
local json_parse = jsonc.parse
local req = json_parse(content)
if req == nil or next(req) == nil then
luci.http.write_json({
error = "invalid request"
})
return
end
-- 启动插件
if req.id ~= nil then
local r,o,e = is_exec("docker start "..req.id, true)
if r ~= 0 then
luci.http.write_json({
error = e,
})
return
end
end
end
local response = {
success = 0,
}
luci.http.write_json(response)
end
function istorego_api_restart()
local http = require "luci.http"
http.prepare_content("application/json")
local method = http.getenv("REQUEST_METHOD")
if method == "post" or method == "POST" then
local content = http.content()
local jsonc = require "luci.jsonc"
local json_parse = jsonc.parse
local req = json_parse(content)
if req == nil or next(req) == nil then
luci.http.write_json({
error = "invalid request"
})
return
end
-- 启动插件
if req.id ~= nil then
local r,o,e = is_exec("docker restart "..req.id, true)
if r ~= 0 then
luci.http.write_json({
error = e,
})
return
end
end
end
local response = {
success = 0,
}
luci.http.write_json(response)
end
function istorego_api_stop()
local http = require "luci.http"
http.prepare_content("application/json")
local method = http.getenv("REQUEST_METHOD")
if method == "post" or method == "POST" then
local content = http.content()
local jsonc = require "luci.jsonc"
local json_parse = jsonc.parse
local req = json_parse(content)
if req == nil or next(req) == nil then
luci.http.write_json({
error = "invalid request"
})
return
end
-- 停止插件
if req.id ~= nil then
local r,o,e = is_exec("docker stop "..req.id, true)
if r ~= 0 then
luci.http.write_json({
error = e,
})
return
end
end
end
local response = {
success = 0,
}
luci.http.write_json(response)
end
function istorego_api_logs()
local http = require "luci.http"
http.prepare_content("application/json")
local method = http.getenv("REQUEST_METHOD")
if method == "post" or method == "POST" then
local content = http.content()
local jsonc = require "luci.jsonc"
local json_parse = jsonc.parse
local req = json_parse(content)
if req == nil or next(req) == nil then
luci.http.write_json({
error = "invalid request"
})
return
end
if req.id ~= nil then
local r,o,e = is_exec("docker logs "..req.id, true)
if r ~= 0 then
luci.http.write_json({
error = e,
})
return
end
end
end
local response = {
success = 0,
}
luci.http.write_json(response)
end
function istorego_api_pull()
local http = require "luci.http"
http.prepare_content("application/json")
local method = http.getenv("REQUEST_METHOD")
if method == "post" or method == "POST" then
local content = http.content()
local jsonc = require "luci.jsonc"
local json_parse = jsonc.parse
local req = json_parse(content)
if req == nil or next(req) == nil then
luci.http.write_json({
error = "invalid request"
})
return
end
if req.image ~= nil then
local r,o,e = is_exec("docker pull "..req.image, true)
if r ~= 0 then
luci.http.write_json({
error = e,
})
return
end
end
end
local response = {
success = 0,
}
luci.http.write_json(response)
end

View File

@ -0,0 +1,19 @@
<%+header%>
<%+tasks/embed%>
<script>
(function(){
window.token = "<%=token%>";
var vue_prefix="<%=prefix%>";
window.vue_base = vue_prefix + '/';
})();
</script>
<h2 name="content">
Docker应用市场
<a onclick="void(0)" href="https://github.com/Carseason/openwrt-packages/tree/main/luci/luci-app-istorego" target="_blank" style="text-decoration: none;">
<%# v=PKG_VERSION %>
</a>
</h2>
<div id="app"></div>
<script type="module" crossorigin src="/luci-static/istorego/index.js<%# ?v=PKG_VERSION %>"></script>
<link rel="stylesheet" href="/luci-static/istorego/style.css<%# ?v=PKG_VERSION %>">
<%+footer%>

View File

@ -0,0 +1,2 @@
msgid "iStoreGo"
msgstr "Docker应用市场"

View File

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

18
luci-app-mfun/Makefile Normal file
View File

@ -0,0 +1,18 @@
include $(TOPDIR)/rules.mk
PKG_VERSION:=0.0.1
PKG_RELEASE:=
LUCI_TITLE:=LuCI support for mfun
LUCI_PKGARCH:=all
LUCI_DEPENDS:=+docker +dockerd +luci-lib-taskd
define Package/luci-app-mfun/conffiles
/etc/config/mfun
endef
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,7 @@
module("luci.controller.mfun", package.seeall)
function index()
entry({"admin", "services", "mfun"}, alias("admin", "services", "mfun", "config"), _("Mfun"), 31).dependent = true
entry({"admin", "services", "mfun", "config"}, cbi("mfun"))
end

View File

@ -0,0 +1,51 @@
--[[
LuCI - Lua Configuration Interface
]]--
local taskd = require "luci.model.tasks"
local mfun_model = require "luci.model.mfun"
local m, s, o
m = taskd.docker_map("mfun", "mfun", "/usr/libexec/istorec/mfun.sh",
translate("Mfun"),
translate("Mfun is an multimedia program.")
.. '<br/>'
.. translate("Default User")
.. ': admin password')
s = m:section(SimpleSection, translate("Service Status"), translate("Mfun status:"))
s:append(Template("mfun/status"))
s = m:section(TypedSection, "mfun", translate("Setup"), translate("The following parameters will only take effect during installation or upgrade:"))
s.addremove=false
s.anonymous=true
o = s:option(Value, "port", translate("HTTP Port").."<b>*</b>")
o.rmempty = false
o.default = "8990"
o.datatype = "port"
local blocks = mfun_model.blocks()
local home = mfun_model.home()
o = s:option(Value, "config_path", translate("Config path").."<b>*</b>")
o.rmempty = false
o.datatype = "string"
local paths, default_path = mfun_model.find_paths(blocks, home, "Configs")
for _, val in pairs(paths) do
o:value(val, val)
end
o.default = default_path
o = s:option(Value, "tmp_path", translate("Tmp path").."<b>*</b>")
o.rmempty = false
o.datatype = "string"
local paths, default_path = mfun_model.find_paths(blocks, home, "Caches")
for _, val in pairs(paths) do
o:value(val, val)
end
o.default = default_path
return m

View File

@ -0,0 +1,55 @@
local util = require "luci.util"
local jsonc = require "luci.jsonc"
local mfun = {}
mfun.blocks = function()
local f = io.popen("lsblk -s -f -b -o NAME,FSSIZE,MOUNTPOINT --json", "r")
local vals = {}
if f then
local ret = f:read("*all")
f:close()
local obj = jsonc.parse(ret)
for _, val in pairs(obj["blockdevices"]) do
local fsize = val["fssize"]
if fsize ~= nil and string.len(fsize) > 10 and val["mountpoint"] then
-- fsize > 1G
vals[#vals+1] = val["mountpoint"]
end
end
end
return vals
end
mfun.home = function()
local uci = require "luci.model.uci".cursor()
local home_dirs = {}
home_dirs["main_dir"] = uci:get_first("quickstart", "main", "main_dir", "/root")
home_dirs["Configs"] = uci:get_first("quickstart", "main", "conf_dir", home_dirs["main_dir"].."/Configs")
home_dirs["Public"] = uci:get_first("quickstart", "main", "pub_dir", home_dirs["main_dir"].."/Public")
home_dirs["Downloads"] = uci:get_first("quickstart", "main", "dl_dir", home_dirs["Public"].."/Downloads")
home_dirs["Caches"] = uci:get_first("quickstart", "main", "tmp_dir", home_dirs["main_dir"].."/Caches")
return home_dirs
end
mfun.find_paths = function(blocks, home_dirs, path_name)
local default_path = ''
local configs = {}
default_path = home_dirs[path_name] .. "/Mfun"
if #blocks == 0 then
table.insert(configs, default_path)
else
for _, val in pairs(blocks) do
table.insert(configs, val .. "/" .. path_name .. "/Mfun")
end
local without_conf_dir = "/root/" .. path_name .. "/Mfun"
if default_path == without_conf_dir then
default_path = configs[1]
end
end
return configs, default_path
end
return mfun

View File

@ -0,0 +1,31 @@
<%
local util = require "luci.util"
local container_status = util.trim(util.exec("/usr/libexec/istorec/mfun.sh status"))
local container_install = (string.len(container_status) > 0)
local container_running = container_status == "running"
-%>
<div class="cbi-value">
<label class="cbi-value-title"><%:Status%></label>
<div class="cbi-value-field">
<% if container_running then %>
<button class="cbi-button cbi-button-success" disabled="true"><%:Mfun is running%></button>
<% else %>
<button class="cbi-button cbi-button-negative" disabled="true"><%:Mfun is not running%></button>
<% end %>
</div>
</div>
<%
if container_running then
local port=util.trim(util.exec("/usr/libexec/istorec/mfun.sh port"))
if port == "" then
port="8990"
end
-%>
<div class="cbi-value cbi-value-last">
<label class="cbi-value-title">&nbsp;</label>
<div class="cbi-value-field">
<input type="button" class="btn cbi-button cbi-button-apply" name="start" value="<%:Open Mfun%>" onclick="window.open('http://'+location.hostname+':<%=port%>/', '_blank')">
</div>
</div>
<% end %>

View File

@ -0,0 +1,44 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "Mfun is an multimedia program."
msgstr "Mfun 是一个轻量的影音媒体程序"
msgid "Config path"
msgstr "配置文件路径"
msgid "Tmp path"
msgstr "缓存文件路径"
msgid "Port"
msgstr "端口"
msgid "HTTP Port"
msgstr "HTTP 端口"
msgid "Service Status"
msgstr "服务状态"
msgid "Default User"
msgstr "默认用户"
msgid "Mfun status:"
msgstr "Mfun 的状态信息如下:"
msgid "Setup"
msgstr "安装配置"
msgid "The following parameters will only take effect during installation or upgrade:"
msgstr "以下参数只在安装或者升级时才会生效:"
msgid "Status"
msgstr "状态"
msgid "Mfun is running"
msgstr "Mfun 运行中"
msgid "Mfun is not running"
msgstr "Mfun 未运行"
msgid "Open Mfun"
msgstr "打开 Mfun"

1
luci-app-mfun/po/zh_Hans Symbolic link
View File

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

View File

@ -0,0 +1,4 @@
config mfun
option 'port' '8990'
# option 'config_path' ''
# option 'tmp_path' ''

View File

@ -0,0 +1,101 @@
#!/bin/sh
ACTION=${1}
shift 1
get_image() {
IMAGE_NAME="carseason/mfun:laster"
}
do_install() {
get_image
echo "docker pull ${IMAGE_NAME}"
docker pull ${IMAGE_NAME}
docker rm -f mfun
do_install_detail
}
do_install_detail() {
local config_path=`uci get mfun.@mfun[0].config_path 2>/dev/null`
local tmp_path=`uci get mfun.@mfun[0].tmp_path 2>/dev/null`
local port=`uci get mfun.@mfun[0].port 2>/dev/null`
local dev
if [ -z "$config_path" ]; then
echo "config path is empty!"
exit 1
fi
if [ -z "$tmp_path" ]; then
echo "tmp path is empty!"
exit 1
fi
[ -z "$port" ] && port=8990
local cmd="docker run --restart=unless-stopped -d \
-v \"$config_path:/mfun/store\" \
-v \"$tmp_path:/mfun/tmp\" \
--dns=172.17.0.1 \
-p $port:8990"
if [ -e "/dev/rga" ]; then
cmd="$cmd \
-t \
--privileged "
for dev in iep rga dri dma_heap mali mali0 mpp_service mpp-service vpu_service vpu-service \
hevc_service hevc-service rkvdec rkvenc avsd vepu h265e ; do
[ -e "/dev/$dev" ] && cmd="$cmd --device /dev/$dev"
done
elif [ -d /dev/dri ]; then
cmd="$cmd \
--device /dev/dri:/dev/dri \
--privileged "
fi
local tz="`uci get system.@system[0].zonename | sed 's/ /_/g'`"
[ -z "$tz" ] || cmd="$cmd -e TZ=$tz"
cmd="$cmd -v /mnt:/mnt"
mountpoint -q /mnt && cmd="$cmd:rslave"
cmd="$cmd --name mfun \"$IMAGE_NAME\""
echo "$cmd"
eval "$cmd"
}
usage() {
echo "usage: $0 sub-command"
echo "where sub-command is one of:"
echo " install Install the mfun"
echo " upgrade Upgrade the mfun"
echo " rm/start/stop/restart Remove/Start/Stop/Restart the mfun"
echo " status Mfun status"
echo " port Mfun port"
}
case ${ACTION} in
"install")
do_install
;;
"upgrade")
do_install
;;
"rm")
docker rm -f mfun
;;
"start" | "stop" | "restart")
docker ${ACTION} mfun
;;
"status")
docker ps --all -f 'name=mfun' --format '{{.State}}'
;;
"port")
docker ps --all -f 'name=mfun' --format '{{.Ports}}' | grep -om1 '0.0.0.0:[0-9]*' | sed 's/0.0.0.0://'
;;
*)
usage
exit 1
;;
esac

View File

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

30
luci-app-routerdog/Makefile Executable file
View File

@ -0,0 +1,30 @@
#
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
include $(TOPDIR)/rules.mk
LUCI_TITLE:=RouterDog
PKG_VERSION:=1.4.10
PKG_RELEASE:=
LUCI_DEPENDS:=+routergo +luci-app-store +luci-lib-taskd
LUCI_MINIFY_CSS:=0
LUCI_MINIFY_JS:=0
define Package/luci-app-routerdog/conffiles
/etc/config/routerdog
/www/luci-static/routerdog/image/bg.gif
/www/luci-static/routerdog/image/login.gif
endef
define Package/luci-nginxer/postrm
#!/bin/sh
rm -f /tmp/luci-indexcache
exit 0
endef
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 B

View File

@ -0,0 +1,309 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
sodipodi:docname="No-Image-Placeholder.svg"
inkscape:version="1.0 (4035a4fb49, 2020-05-01)"
version="1.1"
id="svg2"
viewBox="0 0 329.77792 406.00738"
height="406.00739"
width="329.77792">
<defs
id="defs4">
<linearGradient
id="linearGradient967"
inkscape:collect="always">
<stop
id="stop963"
offset="0"
style="stop-color:#c2c2c2;stop-opacity:1" />
<stop
id="stop965"
offset="1"
style="stop-color:#9f9f9f;stop-opacity:1" />
</linearGradient>
<inkscape:path-effect
lpeversion="0"
is_visible="true"
id="path-effect3414"
effect="spiro" />
<inkscape:path-effect
lpeversion="0"
effect="spiro"
id="path-effect3410"
is_visible="true" />
<inkscape:path-effect
lpeversion="0"
is_visible="true"
id="path-effect3406"
effect="spiro" />
<inkscape:path-effect
lpeversion="0"
effect="spiro"
id="path-effect3402"
is_visible="true" />
<inkscape:path-effect
lpeversion="0"
is_visible="true"
id="path-effect3398"
effect="spiro" />
<inkscape:path-effect
lpeversion="0"
effect="spiro"
id="path-effect3392"
is_visible="true" />
<inkscape:path-effect
lpeversion="0"
is_visible="true"
id="path-effect3388"
effect="spiro" />
<inkscape:path-effect
lpeversion="0"
is_visible="true"
id="path-effect3372"
effect="spiro" />
<inkscape:path-effect
lpeversion="0"
is_visible="true"
id="path-effect3368"
effect="spiro" />
<inkscape:path-effect
lpeversion="0"
is_visible="true"
id="path-effect3364"
effect="spiro" />
<inkscape:path-effect
lpeversion="0"
effect="spiro"
id="path-effect3360"
is_visible="true" />
<inkscape:path-effect
lpeversion="0"
is_visible="true"
id="path-effect3346"
effect="spiro" />
<inkscape:path-effect
lpeversion="0"
effect="spiro"
id="path-effect3392-8"
is_visible="true" />
<linearGradient
gradientTransform="translate(-45.254833,0.35355338)"
gradientUnits="userSpaceOnUse"
y2="108.77648"
x2="658.45801"
y1="6.5995569"
x1="660.06653"
id="linearGradient969"
xlink:href="#linearGradient967"
inkscape:collect="always" />
</defs>
<sodipodi:namedview
inkscape:document-rotation="0"
inkscape:window-maximized="1"
inkscape:window-y="42"
inkscape:window-x="0"
inkscape:window-height="1004"
inkscape:window-width="1920"
units="px"
fit-margin-bottom="0"
fit-margin-right="0"
fit-margin-left="0"
fit-margin-top="0"
inkscape:guide-bbox="true"
inkscape:snap-smooth-nodes="true"
showguides="false"
inkscape:object-nodes="true"
showgrid="false"
inkscape:current-layer="layer1"
inkscape:document-units="px"
inkscape:cy="109.10202"
inkscape:cx="148.40044"
inkscape:zoom="0.7071068"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
borderopacity="1.0"
bordercolor="#666666"
pagecolor="#ffffff"
id="base">
<inkscape:grid
originy="-510.42818"
originx="-399.13435"
id="grid3336"
type="xygrid" />
<sodipodi:guide
id="guide3375"
orientation="0,1"
position="-117.13437,-25.564321" />
<sodipodi:guide
id="guide3377"
orientation="0,1"
position="-114.13437,-23.564321" />
<sodipodi:guide
id="guide3380"
orientation="0,1"
position="-121.13437,-27.564321" />
<sodipodi:guide
id="guide3382"
orientation="0,1"
position="-114.13437,-22.564321" />
<sodipodi:guide
id="guide3384"
orientation="0,1"
position="-114.13437,-21.564321" />
<sodipodi:guide
id="guide3416"
orientation="-2,0.5"
position="-115.13437,-25.564311" />
<sodipodi:guide
id="guide3420"
orientation="-2,0.5"
position="-115.13437,-25.564311" />
<sodipodi:guide
id="guide4180"
orientation="0.24382204,-0.96981999"
position="206.80442,220.41193" />
<sodipodi:guide
id="guide4182"
orientation="1,0"
position="86.804424,280.52227" />
<sodipodi:guide
id="guide4186"
orientation="1,0"
position="206.80442,250.52231" />
<sodipodi:guide
id="guide4188"
orientation="-0.24382199,0.96982"
position="206.80442,190.30156" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(-399.13437,-122.79051)"
id="layer1"
inkscape:groupmode="layer"
inkscape:label="Layer 1">
<rect
ry="7.0136137"
y="122.79051"
x="399.13437"
height="406.00739"
width="329.77792"
id="rect1017"
style="fill:#eeeeee;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.59331;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<g
transform="translate(43.778173,191.04163)"
id="g1015">
<rect
style="fill:#9f9f9f;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.2995;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect1002"
width="82.489967"
height="90.470001"
x="398.75827"
y="178.74706"
ry="8.3970251"
transform="rotate(-16.342822)" />
<g
id="g1000"
transform="rotate(16.320529,538.13563,-184.89727)">
<rect
ry="4.5961938"
y="1.6498091"
x="547.18585"
height="115.96551"
width="107.83378"
id="rect961"
style="fill:url(#linearGradient969);fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:5.398;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none" />
<g
style="stroke:#ffffff;stroke-width:13.0708;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
transform="matrix(0.17265471,0,0,0.17265471,512.49324,-6.3296456)"
id="g875">
<rect
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#cccccc;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:13.0708;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
id="rect3338"
width="491.10556"
height="449.99814"
x="270"
y="107.36227" />
<rect
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:13.0708;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
id="rect3342"
width="491.10559"
height="209.99976"
x="270"
y="107.36227" />
<path
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#cccccc;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:13.0708;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:stroke;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
d="m 300,317.36255 38.46147,-53.53818 60.53097,-45.16084 15.88277,18.57394 13.61285,-38.68356 8.20133,-2.98188 13.3106,-28.2093 180,179.99979"
id="path3344"
inkscape:path-effect="#path-effect3346"
inkscape:original-d="m 300,317.36255 38.46147,-53.53818 60.53097,-45.16084 15.88277,18.57394 13.61285,-38.68356 8.20133,-2.98188 13.3106,-28.2093 180,179.99979"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccc" />
<path
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#b3b3b3;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:13.0708;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:stroke;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
d="m 180,60 c 4.09311,16.474688 7.71219,33.067277 10.85156,49.75 2.38256,12.66097 4.48857,25.37408 6.31641,38.12695 l -22.06445,-7.16015 -46.11133,-29.41602 5.32422,46.42578 -1.61524,24.78711 10.05274,30.37695 73.18554,-11.75585 L 300,180 252.19922,102.56641 242.5,117.5 215.375,95.375 Z"
transform="translate(270,107.36227)"
id="path3390-0"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cscccccccccccc" />
<path
inkscape:connector-curvature="0"
inkscape:original-d="m 419.99999,347.36252 81.89918,-74.42959 18.50574,-9.68009 23.6512,-44.18894 25.94388,-21.70121 179.99999,179.99979"
inkscape:path-effect="#path-effect3360"
id="path3358"
d="m 419.99999,347.36252 81.89918,-74.42959 18.50574,-9.68009 23.6512,-44.18894 25.94388,-21.70121 179.99999,179.99979"
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#cccccc;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:13.0708;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:stroke;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
sodipodi:nodetypes="cccccc" />
<path
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#b3b3b3;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:13.0708;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:stroke;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
d="m 569.99999,197.36269 35.9388,80.91289 v 30.11038 30.11038 l 22.45864,19.46652 c 6.52453,-6.45031 14.14893,-11.78526 22.44431,-15.70477 14.8245,-7.00447 31.33823,-9.35959 47.17057,-13.6217 6.42776,-1.73037 12.90672,-3.85419 18.21343,-7.87277 1.35174,-1.02362 2.61592,-2.16281 3.77424,-3.40107 h -30 l -40.52149,-40.55006 -29.85645,-48.91972 -10.25307,8.83886 z"
id="path3386"
inkscape:path-effect="#path-effect3388"
inkscape:original-d="m 569.99999,197.36269 35.9388,80.91289 v 30.11038 30.11038 l 22.45864,19.46652 c 5.77311,-6.36416 13.54339,-11.40815 22.44431,-15.70477 13.00316,-6.27685 32.0432,-8.74899 47.17057,-13.6217 6.8762,-2.21491 12.68001,-4.81998 18.21343,-7.87277 1.55883,-0.86001 1.99765,-2.671 3.77424,-3.40107 h -30 l -40.52149,-40.55006 -29.85645,-48.91972 -10.25307,8.83886 z"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccssscccccc" />
<path
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:13.0708;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:stroke;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
d="m 419.99999,557.36227 c -0.41699,-9.60089 -8.81759,-17.60878 17.1252,-30.66806 31.8318,-16.02389 125.895,-35.88836 152.1537,-59.98434 19.42709,-17.82687 -70.4154,-37.66945 -55.0191,-59.07323 6.981,-9.70528 59.037,-19.96947 82.1463,-30.27386 21.90569,-9.76799 15.14129,-19.80328 31.4046,-29.97507 15.7092,-9.82558 68.3499,-19.77358 72.18929,-30.02516 -10.41359,10.52188 -68.83379,20.40327 -89.99999,30.00026 -22.3377,10.128 -21.4689,19.93018 -49.4313,29.48367 -30.1245,10.29239 -89.142,20.55268 -102.7077,30.51626 -28.4133,20.86858 46.863,42.59995 16.2024,59.99993 C 452.54309,490.92554 344.7219,510.65712 300,527.3626 c -30.9039,11.54369 -28.4079,17.74799 -30,29.99967"
id="path3370"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cssssscsssssc" />
</g>
</g>
</g>
<text
id="text1021"
y="412.12527"
x="562.00677"
style="font-style:normal;font-weight:normal;font-size:32px;line-height:1.25;font-family:sans-serif;fill:#767676;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:32px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';text-align:center;text-anchor:middle"
y="412.12527"
x="562.00677"
id="tspan1019"
sodipodi:role="line">NO IMAGE</tspan><tspan
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:32px;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';text-align:center;text-anchor:middle"
id="tspan1023"
y="452.12527"
x="562.00677"
sodipodi:role="line">AVAILABLE</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 16 KiB

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,187 @@
module("luci.controller.routerdog", package.seeall)
function index()
if nixio.fs.access("/usr/lib/lua/luci/view/routerdog/main.htm") then
entry({"admin", "routerdog"}, template("routerdog/index"), _("RouterDog"), 1).leaf = true
end
entry({"admin", "routerdog_api"}, call("redirect_index"))
entry({"admin", "routerdog_api", "status"}, call("routerdog_api_status"))
entry({"admin", "routerdog_api", "upload-bg"}, call("routerdog_api_uploadbg"))
entry({"admin", "routerdog_api", "setting"}, call("routerdog_api_setting"))
entry({"admin", "routerdog_api", "routergo"}, call("routerdog_api_routergo"))
end
local function user_id()
local jsonc = require "luci.jsonc"
local json_parse = jsonc.parse
local fs = require "nixio.fs"
local data = fs.readfile("/etc/.app_store.id")
local id
if data ~= nil then
id = json_parse(data)
end
if id == nil then
fs.unlink("/etc/.app_store.id")
id = {arch="",uid=""}
end
id.version = (fs.readfile("/etc/.app_store.version") or "?"):gsub("[\r\n]", "")
return id
end
function get_params()
local data = {
prefix=luci.dispatcher.build_url(unpack({"admin", "routerdog"})),
id=user_id(),
}
return data
end
function redirect_index()
luci.http.redirect(luci.dispatcher.build_url("admin/routerdog"))
end
function routerdog_template()
luci.template.render("routerdog/main", get_params())
end
function routerdog_api_status()
local success = 0
local response = {
success = success,
}
luci.http.prepare_content("application/json")
luci.http.write_json(response)
end
function routerdog_api_uploadbg()
local uci = require "uci"
local x = uci.cursor()
local fd
local path
local success = 0
local tmpdir = "/www/luci-static/routerdog/image"
local filename = ""
local opf = io.open(tmpdir,"r+")
if opf then
opf:close()
else
local sys = require "luci.sys"
sys.exec("mkdir "..tmpdir)
end
luci.http.setfilehandler(
function(meta, chunk, eof)
if not fd then
filename = meta.file
path = tmpdir .. "/bg.gif"
fd = io.open(path, "w")
end
if chunk then
fd:write(chunk)
end
if eof then
fd:close()
finished = true
end
end
)
luci.http.formvalue("file")
local response = {
success = success,
}
luci.http.prepare_content("application/json")
luci.http.write_json(response)
end
function getRouterdogSettingData()
local uci = require "luci.model.uci".cursor()
local bgBlur = uci:get_first("routerdog", "routerdog", "bgBlur")
local hiddenApp = uci:get_first("routerdog", "routerdog", "hiddenApp")
local hiddenDockerApp = uci:get_first("routerdog", "routerdog", "hiddenDockerApp")
local hiddenUseApp = uci:get_first("routerdog", "routerdog", "hiddenUseApp")
local result = {
bgBlur = (bgBlur == "1"),
hiddenApp = (hiddenApp == "1"),
hiddenDockerApp = (hiddenDockerApp == "1"),
hiddenUseApp = (hiddenUseApp == "1"),
}
return result
end
function submitRouterdogSettingData(req)
local uci = require "luci.model.uci".cursor()
if req.bgBlur ~= nil then
uci:set("routerdog","@routerdog[0]","bgBlur",req.bgBlur)
end
if req.hiddenApp ~= nil then
uci:set("routerdog","@routerdog[0]","hiddenApp",req.hiddenApp)
end
if req.hiddenUseApp ~= nil then
uci:set("routerdog","@routerdog[0]","hiddenUseApp",req.hiddenUseApp)
end
if req.hiddenDockerApp ~= nil then
uci:set("routerdog","@routerdog[0]","hiddenDockerApp",req.hiddenDockerApp)
end
uci:commit("routerdog")
end
function routerdog_api_setting()
local http = require "luci.http"
http.prepare_content("application/json")
local method = http.getenv("REQUEST_METHOD")
if method == "post" or method == "POST" then
local content = http.content()
local jsonc = require "luci.jsonc"
local json_parse = jsonc.parse
local req = json_parse(content)
if req == nil or next(req) == nil then
luci.http.write_json({
error = "invalid request"
})
return
end
submitRouterdogSettingData(req)
end
local result = getRouterdogSettingData()
local response = {
success = 0,
result = result,
}
luci.http.write_json(response)
end
function routerdog_api_routergo()
local http = require "luci.http"
local uci = require "luci.model.uci".cursor()
http.prepare_content("application/json")
local method = http.getenv("REQUEST_METHOD")
if method == "post" or method == "POST" then
local content = http.content()
local jsonc = require "luci.jsonc"
local json_parse = jsonc.parse
local req = json_parse(content)
if req == nil or next(req) == nil then
luci.http.write_json({
error = "invalid request"
})
return
end
if req.path ~= nil then
uci:set("routergo","@routergo[0]","path",req.path)
end
uci:commit("routergo")
luci.util.exec("/etc/init.d/routergo stop")
luci.util.exec("/etc/init.d/routergo start")
end
local path = uci:get_first("routergo", "routergo", "path")
local result = {
path = path,
}
local response = {
success = 0,
result = result,
}
luci.http.write_json(response)
end

View File

@ -0,0 +1,189 @@
-- Copyright 2022 xiaobao <xiaobao@linkease.com>
-- Licensed to the public under the MIT License
local http = require "luci.http"
local nixio = require "nixio"
local ltn12 = require "luci.ltn12"
local table = require "table"
local util = require "luci.util"
module("luci.controller.routergo_backend", package.seeall)
local BLOCKSIZE = 2048
local ROUTERGO_PORT = 9950
function index()
entry({"routergo"}, call("routergo_backend")).leaf=true
end
local function sink_socket(sock, io_err)
if sock then
return function(chunk, err)
if not chunk then
return 1
else
return sock:send(chunk)
end
end
else
return ltn12.sink.error(io_err or "unable to send socket")
end
end
local function session_retrieve(sid, allowed_users)
local sdat = util.ubus("session", "get", { ubus_rpc_session = sid })
if type(sdat) == "table" and
type(sdat.values) == "table" and
type(sdat.values.token) == "string" and
(not allowed_users or
util.contains(allowed_users, sdat.values.username))
then
return sid, sdat.values
end
return nil, nil
end
local function get_session()
local sid
local key
local sdat
for _, key in ipairs({"sysauth_https", "sysauth_http", "sysauth"}) do
sid = http.getcookie(key)
if sid then
sid, sdat = session_retrieve(sid, nil)
if sid and sdat then
return sid, sdat
end
end
end
return nil, nil
end
local function chunksource(sock, buffer)
buffer = buffer or ""
return function()
local output
local _, endp, count = buffer:find("^([0-9a-fA-F]+);?.-\r\n")
while not count and #buffer <= 1024 do
local newblock, code = sock:recv(1024 - #buffer)
if not newblock then
return nil, code
end
buffer = buffer .. newblock
_, endp, count = buffer:find("^([0-9a-fA-F]+);?.-\r\n")
end
count = tonumber(count, 16)
if not count then
return nil, -1, "invalid encoding"
elseif count == 0 then
return nil
elseif count + 2 <= #buffer - endp then
output = buffer:sub(endp+1, endp+count)
buffer = buffer:sub(endp+count+3)
return output
else
output = buffer:sub(endp+1, endp+count)
buffer = ""
if count - #output > 0 then
local remain, code = sock:recvall(count-#output)
if not remain then
return nil, code
end
output = output .. remain
count, code = sock:recvall(2)
else
count, code = sock:recvall(count+2-#buffer+endp)
end
if not count then
return nil, code
end
return output
end
end
end
function routergo_backend()
local sock = nixio.connect("127.0.0.1", ROUTERGO_PORT)
if not sock then
http.status(500, "connect failed")
return
end
local input = {}
input[#input+1] = http.getenv("REQUEST_METHOD") .. " " .. http.getenv("REQUEST_URI") .. " HTTP/1.1"
local req = http.context.request
local start = "HTTP_"
local start_len = string.len(start)
local ctype = http.getenv("CONTENT_TYPE")
if ctype then
input[#input+1] = "Content-Type: " .. ctype
end
for k, v in pairs(req.message.env) do
if string.sub(k, 1, start_len) == start and not string.find(k, "FORWARDED") then
input[#input+1] = string.sub(k, start_len+1, string.len(k)) .. ": " .. v
end
end
local sid, sdat = get_session()
if sdat ~= nil then
input[#input+1] = "X-Forwarded-Sid: " .. sid
input[#input+1] = "X-Forwarded-Token: " .. sdat.token
end
-- input[#input+1] = "X-Forwarded-For: " .. http.getenv("REMOTE_HOST") ..":".. http.getenv("REMOTE_PORT")
local num = tonumber(http.getenv("CONTENT_LENGTH")) or 0
input[#input+1] = "Content-Length: " .. tostring(num)
input[#input+1] = "\r\n"
local source = ltn12.source.cat(ltn12.source.string(table.concat(input, "\r\n")), http.source())
local ret = ltn12.pump.all(source, sink_socket(sock, "write sock error"))
if ret ~= 1 then
sock:close()
http.status(500, "proxy error")
return
end
local linesrc = sock:linesource()
local line, code, error = linesrc()
if not line then
sock:close()
http.status(500, "response parse failed")
return
end
local protocol, status, msg = line:match("^([%w./]+) ([0-9]+) (.*)")
if not protocol then
sock:close()
http.status(500, "response protocol error")
return
end
num = tonumber(status) or 0
http.status(num, msg)
local chunked = 0
line = linesrc()
while line and line ~= "" do
local key, val = line:match("^([%w-]+)%s?:%s?(.*)")
if key and key ~= "Status" then
if key == "Transfer-Encoding" and val == "chunked" then
chunked = 1
end
if key ~= "Connection" and key ~= "Transfer-Encoding" then
http.header(key, val)
end
end
line = linesrc()
end
if not line then
sock:close()
http.status(500, "parse header failed")
return
end
local body_buffer = linesrc(true)
if chunked == 1 then
ltn12.pump.all(chunksource(sock, body_buffer), http.write)
else
local body_source = ltn12.source.cat(ltn12.source.string(body_buffer), sock:blocksource())
ltn12.pump.all(body_source, http.write)
end
sock:close()
end

View File

@ -0,0 +1,4 @@
<%
local routerdog = require "luci.controller.routerdog"
routerdog.routerdog_template()
%>

View File

@ -0,0 +1,6 @@
<%+routerdog/template%>
<div id="app"></div>
<link rel="stylesheet" href="/luci-static/routerdog/style.css<%# ?v=PKG_VERSION %>">
<script type="module" crossorigin src="/luci-static/routerdog/index.js<%# ?v=PKG_VERSION %>"></script>
</body>
</html>

View File

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#181c20" />
<title><%=luci.sys.hostname()%></title>
</head>
<body>
<script src="<%=url('admin/translations', luci.i18n.context.lang)%><%# ?v=PKG_VERSION %>"></script>
<script src="<%=resource%>/cbi.js<%# ?v=PKG_VERSION %>"></script>
<script type="text/javascript" src="<%=resource%>/promis.min.js<%# ?v=PKG_VERSION %>"></script>
<script type="text/javascript" src="<%=resource%>/luci.js<%# ?v=PKG_VERSION %>"></script>
<%+tasks/embed%>
<script>
(function(){
window.Hostname = "<%=luci.sys.hostname()%>"
var pathe_prefix = "<%=prefix%>"
window.path_base = pathe_prefix
window.pkg_version = "<%# PKG_VERSION %>"
window.token = "<%=token%>"
window.model = "<%=model%>"
window.device_id = {
arch:"<%=id.arch%>",
uid:"<%=id.uid%>",
version:"<%=id.version%>"
}
})();
</script>
<script type="text/javascript">
L = new LuCI(<%= luci.http.write_json({
token = token,
media = media,
resource = resource,
scriptname = luci.http.getenv("SCRIPT_NAME"),
pathinfo = luci.http.getenv("PATH_INFO"),
documentroot = luci.http.getenv("DOCUMENT_ROOT"),
requestpath = luci.dispatcher.context.requestpath,
dispatchpath = luci.dispatcher.context.path,
pollinterval = luci.config.main.pollinterval or 5,
ubuspath = luci.config.main.ubuspath or '/ubus/',
sessionid = luci.dispatcher.context.authsession,
nodespec = luci.dispatcher.context.dispatched,
apply_rollback = math.max(applyconf and applyconf.rollback or 90, 30),
apply_holdoff = math.max(applyconf and applyconf.holdoff or 4, 1),
apply_timeout = math.max(applyconf and applyconf.timeout or 5, 1),
apply_display = math.max(applyconf and applyconf.display or 1.5, 1),
rollback_token = rollback_token
}) %>);
</script>

View File

@ -0,0 +1,2 @@
msgid "RouterDog"
msgstr "路由狗"

View File

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

View File

@ -0,0 +1,6 @@
config routerdog
option enabled '1'
option bgBlur '0'
option hiddenApp '0'
option hiddenDockerApp '1'
option hiddenUseApp '1'

View File

@ -0,0 +1,4 @@
#!/bin/sh
rm -f /tmp/luci-indexcache
exit 0

View File

@ -0,0 +1,10 @@
{
"admin/routerdog": {
"title": "RouterDog",
"order": -1,
"action": {
"type": "template",
"path": "routerdog/index"
}
}
}

View File

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

16
luci-app-webviewdev/Makefile Executable file
View File

@ -0,0 +1,16 @@
#
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
include $(TOPDIR)/rules.mk
LUCI_TITLE:=Luci App WevviewDev
PKG_VERSION:=0.0.1
LUCI_MINIFY_CSS:=0
LUCI_MINIFY_JS:=0
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,33 @@
module("luci.controller.webviewdev", package.seeall)
function index()
entry({"admin", "webviewdev"}, call("webviewdev_template"), _("webviewdev"), 5).leaf = true
end
local function user_id()
local jsonc = require "luci.jsonc"
local json_parse = jsonc.parse
local fs = require "nixio.fs"
local data = fs.readfile("/etc/.app_store.id")
local id
if data ~= nil then
id = json_parse(data)
end
if id == nil then
fs.unlink("/etc/.app_store.id")
id = {arch="",uid=""}
end
id.version = (fs.readfile("/etc/.app_store.version") or "?"):gsub("[\r\n]", "")
return id
end
function get_params()
local data = {
prefix=luci.dispatcher.build_url(unpack({"admin", "webviewdev"})),
id=user_id(),
}
return data
end
function webviewdev_template()
luci.template.render("webviewdev/main", get_params())
end

View File

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#181c20" />
<title><%=luci.sys.hostname()%></title>
</head>
<body>
<script src="<%=url('admin/translations', luci.i18n.context.lang)%><%# ?v=PKG_VERSION %>"></script>
<script src="<%=resource%>/cbi.js<%# ?v=PKG_VERSION %>"></script>
<script type="text/javascript" src="<%=resource%>/promis.min.js<%# ?v=PKG_VERSION %>"></script>
<script type="text/javascript" src="<%=resource%>/luci.js<%# ?v=PKG_VERSION %>"></script>
<%+tasks/embed%>
<script>
(function(){
var pathe_prefix = "<%=prefix%>"
window.path_base = pathe_prefix
window.pkg_version = "<%# PKG_VERSION %>"
window.token = "<%=token%>"
})();
</script>
<script type="text/javascript">
L = new LuCI(<%= luci.http.write_json({
token = token,
media = media,
resource = resource,
scriptname = luci.http.getenv("SCRIPT_NAME"),
pathinfo = luci.http.getenv("PATH_INFO"),
documentroot = luci.http.getenv("DOCUMENT_ROOT"),
requestpath = luci.dispatcher.context.requestpath,
dispatchpath = luci.dispatcher.context.path,
pollinterval = luci.config.main.pollinterval or 5,
ubuspath = luci.config.main.ubuspath or '/ubus/',
sessionid = luci.dispatcher.context.authsession,
nodespec = luci.dispatcher.context.dispatched,
apply_rollback = math.max(applyconf and applyconf.rollback or 90, 30),
apply_holdoff = math.max(applyconf and applyconf.holdoff or 4, 1),
apply_timeout = math.max(applyconf and applyconf.timeout or 5, 1),
apply_display = math.max(applyconf and applyconf.display or 1.5, 1),
rollback_token = rollback_token
}) %>);
</script>
<div id="app"></div>
<script type="module" src="http://localhost:3000/src/main.ts"></script>
</body>
</html>

19
luci-theme-inas/Makefile Normal file
View File

@ -0,0 +1,19 @@
#
# Copyright (C) 2008-2019 Jerrykuku
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
include $(TOPDIR)/rules.mk
LUCI_TITLE:=INas Theme
LUCI_DEPENDS:=+luci-theme-argon
PKG_VERSION:=0.0.2
PKG_RELEASE:=
LUCI_MINIFY_CSS:=0
LUCI_MINIFY_JS:=0
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

Binary file not shown.

After

Width:  |  Height:  |  Size: 883 KiB

View File

@ -0,0 +1 @@
*{-webkit-box-sizing:border-box;-webkit-tap-highlight-color:transparent;box-sizing:border-box;word-wrap:break-word;outline:none}*{font-style:normal;font-family:PingFang SC,PingFangSC-Regular,Helvetica Neue,Helvetica,Arial,sans-serif}html,body,ul,p{margin:0;padding:0}html,body{width:100%;height:100%;position:relative;-webkit-overflow-scrolling:touch;overflow:hidden}a{cursor:pointer;text-decoration:none;outline:none}i{font-style:normal}body{background:#f9f9f9;margin:0;overflow:hidden;font-family:PingFang SC,Apple System,SF Pro SC,SF Pro Display,Helvetica Neue,Arial,Hiragino Sans GB,STHeiti,Microsoft YaHei,Microsoft JhengHei,Source Han Sans SC,Noto Sans CJK SC,Source Han Sans CN,sans-serif;display:flex;flex-wrap:wrap;align-items:center;justify-content:center;background-size:cover;background-image:url(/luci-static/inas/login/login.jpg?v=ChdA1osC);background-color:#0160b8;background-repeat:no-repeat;background-size:100% 100%;background-attachment:fixed;background-position:bottom center}#app{box-sizing:border-box;animation:left-slide-in .6s forwards;display:flex;flex-wrap:wrap;justify-content:center;align-items:center;align-content:center;width:100vw;height:100vh}#app form{width:520px;position:relative;z-index:1}#app form .logo{width:100%;display:block;text-align:center;font-size:3rem;color:#000;margin:0;margin-bottom:3rem}#app form .logo span{position:relative;z-index:1;font-weight:700;background-clip:text;color:#ddd;white-space:nowrap}#app form .logo span svg{position:absolute;bottom:-30px;right:-30px;left:-30px;z-index:-1;stroke-dasharray:400;stroke-dashoffset:400;animation:drawline .6s forwards .6s}#app form label{display:block;width:100%;margin-bottom:1rem}#app form label span{display:block;width:100%;color:#ddd;font-size:14px}#app form label input{border:none;background:none;display:block;width:100%;height:52px;border-bottom:1px solid #ddd;font-size:18px;color:#fff;font-family:PingFang SC}#app form label input::placeholder{color:#888;font-size:14px}#app form .message{width:100%;display:block;margin-bottom:1rem;display:inline-block;color:#f09381;font-size:12px}#app form button{margin-top:2rem;margin-bottom:1rem;position:relative;width:100%;height:42px;z-index:1;background-color:#057feb;cursor:pointer;display:flex;align-items:center;justify-content:center;border:none;border-radius:10rem;box-shadow:0 5px 14px #057feb57}#app form button:before{content:"";position:absolute;top:0;width:100%;height:100%;border-radius:10rem;background-color:#057feb;-webkit-animation-name:btnPulse;-moz-animation-name:btnPulse;-ms-animation-name:btnPulse;animation-name:btnPulse;-webkit-animation-duration:3s;-moz-animation-duration:3s;-ms-animation-duration:3s;animation-duration:3s;-webkit-animation-delay:3s;-moz-animation-delay:3s;-ms-animation-delay:3s;animation-delay:3s;-webkit-animation-iteration-count:infinite;-moz-animation-iteration-count:infinite;-ms-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-play-state:running;-moz-animation-play-state:running;-ms-animation-play-state:running;animation-play-state:running}#app form button span{color:#fff;font-size:18px;z-index:1}#app form button:hover{transition:.3s;transform:scale(1.1)}@media screen and (max-width: 680px){#app{padding:1rem}#app form{width:100%}}@keyframes btnPulse{0%{transform:scale(1)}80%{transform:scale(1);opacity:1}to{transform:scale(1.3);opacity:0}}@keyframes left-slide-in{0%{transform:translateY(50%);opacity:0}to{transform:translateY(0);opacity:1}}@keyframes right-slide-in{0%{transform:translateY(50%) skew(0);opacity:0}to{transform:translateY(0) skew(-10deg,5deg);opacity:1}}@keyframes left-flow{0%{transform:translateY(0)}50%{transform:translateY(2%)}to{transform:translateY(0)}}@keyframes right-flow{0%{transform:translateY(0) skew(-10deg,5deg)}50%{transform:translateY(-2%) skew(-10deg,4deg)}to{transform:translateY(0) skew(-10deg,5deg)}}@keyframes drawline{to{stroke-dashoffset:0}}

View File

@ -0,0 +1,49 @@
<%
local node = luci.dispatcher.context.dispatched;
local hostname = luci.sys.hostname();
local lang = luci.i18n.context.lang;
luci.http.prepare_content("text/html; charset=UTF-8");
-%>
<!doctype html>
<html lang="<%=lang%>">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>
<%=hostname%>
</title>
<link rel="stylesheet" crossorigin href="/luci-static/inas/login/style.css<%# ?v=PKG_VERSION %>">
</head>
<body name="<%=hostname%>" class="lang_<%=lang%> <% if node then %><%= striptags( node.title ) %><%- end %>">
<div id="app">
<form method="post" class="cbi-map">
<div class="logo">
<span>
<%=hostname%>
<svg viewBox="0 0 190 88" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M97.4999 3.5C1.00023 10.2006 -26 77.5 38 83.5C127.5 91.8906 241 58.5 156.5 6.29944"
stroke="#ddd" stroke-width="6" stroke-linecap="round"></path>
</svg>
</span>
</div>
<label>
<span>登录账号</span>
<input name="luci_username" placeholder="<%:Username%>" <%=attr("value", duser)%> required>
</label>
<label>
<span>登录密码</span>
<input name="luci_password" placeholder="<%:Password%>" type="password">
</label>
<% if fuser then %>
<div class="message">
<%:Invalid username and/or password! Please try again.%>
</div>
<% end %>
<button>
<span><%:Login%></span>
</button>
</form>
</div>
</main>
</body>
</html>

View File

@ -0,0 +1,12 @@
#!/bin/sh
if [ "$PKG_UPGRADE" != 1 ]; then
uci get luci.themes.INas >/dev/null 2>&1 || \
uci batch <<-EOF
set luci.themes.INas=/luci-static/inas
set luci.main.mediaurlbase=/luci-static/inas
commit luci
EOF
fi
exit 0

15
luci-themedog/Makefile Executable file
View File

@ -0,0 +1,15 @@
#
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
include $(TOPDIR)/rules.mk
LUCI_TITLE:=ThemeDog
LUCI_DEPENDS:=
PKG_VERSION:=0.0.73
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,51 @@
:root {
--background-color-high-hsl: none;
--background-color-high: none;
--background-color-medium-hsl: none;
--background-color-medium: none;
--background-color-low-hsl: none;
--background-color-low: none;
--text-color-high: #eee;
}
#maincontent {
position: relative;
width: 100%;
max-width: 1180px;
margin: 0 auto;
padding: 3rem 1rem 1rem;
}
.alert-message.fade-in.warning {
max-width: 1100px;
width: 100%;
background: rgba(0, 0, 0, 0.7);
border-radius: 1rem;
margin: 0 auto;
padding: 1rem 1.5rem;
}
.alert-message.fade-in.warning.fade-out {
display: none !important;
}
/* html,body{
color-scheme: none !important;
}
body {
background: none !important;
background: url(/luci-static/themedog/image/bg.gif) no-repeat center center fixed;
} */
body{
background-color: #242424 !important;;
}
.modal {
background-color: #181c20c7;
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
}
select{
background-color: #181c20c7;
}
option{
color: #fff;
}
.cbi-dropdown[open] > ul.dropdown {
background-color: #181c20;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Some files were not shown because too many files have changed in this diff Show More