🌴 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 97c049ed0a
commit 0acff03804
14253 files changed
+3893239

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
include $(TOPDIR)/rules.mk
PKG_VERSION:=1.1.7-20250516
PKG_RELEASE:=1
LUCI_TITLE:=LuCI support for wxedge
LUCI_PKGARCH:=all
LUCI_DEPENDS:=+lsblk +docker +dockerd +luci-lib-taskd
define Package/luci-app-wxedge/conffiles
/etc/config/wxedge
endef
# prerm
# postrm
define Package/luci-app-wxedge/prerm
#!/bin/sh
docker rm -f wxedge
exit 0
endef
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature
+7
View File
@@ -0,0 +1,7 @@
module("luci.controller.wxedge", package.seeall)
function index()
entry({"admin", "services", "wxedge"}, alias("admin", "services", "wxedge", "config"), _("Onething Edge"), 30).dependent = true
entry({"admin", "services", "wxedge", "config"}, cbi("wxedge"))
end
@@ -0,0 +1,40 @@
--[[
LuCI - Lua Configuration Interface
]]--
local taskd = require "luci.model.tasks"
local wxedge_model = require "luci.model.wxedge"
local m, s, o
m = taskd.docker_map("wxedge", "wxedge", "/usr/libexec/istorec/wxedge.sh",
translate("Onething Edge"),
"「网心云-容器魔方」由网心云推出的一款 docker 容器镜像软件,通过在简单安装后即可快速加入网心云共享计算生态网络,用户可根据每日的贡献量获得相应的现金收益回报。了解更多,请登录「<a href=\"https://www.onethingcloud.com/\" target=\"_blank\" >网心云官网</a>」并查看<a href=\"https://doc.linkease.com/zh/guide/istoreos/software/wxedge.html\" target=\"_blank\">「教程」</a>")
s = m:section(SimpleSection, translate("Service Status"), translate("Onething Edge status:"), "注意网心云会以超级权限运行!")
s:append(Template("wxedge/status"))
s = m:section(TypedSection, "wxedge", translate("Setup"), translate("The following parameters will only take effect during installation or upgrade:"))
s.addremove=false
s.anonymous=true
o = s:option(Value, "image_name", translate("Image").."<b>*</b>")
o.rmempty = false
o.datatype = "string"
o:value("onething1/wxedge", "onething1/wxedge")
o:value("images-cluster.xycloud.com/wxedge/wxedge:latest", "images-cluster.xycloud.com/wxedge/wxedge:latest")
o.default = "images-cluster.xycloud.com/wxedge/wxedge:latest"
local blks = wxedge_model.blocks()
local dir
o = s:option(Value, "cache_path", translate("Cache path").."<b>*</b>", "请选择合适的存储位置进行安装,安装位置容量越大,收益越高。安装后请勿轻易改动")
o.rmempty = false
o.datatype = "string"
for _, dir in pairs(blks) do
dir = dir .. "/wxedge1"
o:value(dir, dir)
end
if #blks > 0 then
o.default = blks[1] .. "/wxedge1"
end
return m
+26
View File
@@ -0,0 +1,26 @@
local util = require "luci.util"
local jsonc = require "luci.jsonc"
local nixio = require "nixio"
local wxedge = {}
wxedge.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
return wxedge
@@ -0,0 +1,31 @@
<%
local util = require "luci.util"
local container_status = util.trim(util.exec("/usr/libexec/istorec/wxedge.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"><%:Onething Edge is running%></button>
<% else %>
<button class="cbi-button cbi-button-negative" disabled="true"><%:Onething Edge is not running%></button>
<% end %>
</div>
</div>
<%
if container_running then
local port=util.trim(util.exec("/usr/libexec/istorec/wxedge.sh port"))
if port == "" then
port="18888"
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 the Onething Edge%>" onclick="window.open('http://'+location.hostname+':<%=port%>/', '_blank')">
</div>
</div>
<% end %>
+32
View File
@@ -0,0 +1,32 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "Onething Edge"
msgstr "网心云-容器魔方"
msgid "Cache path"
msgstr "缓存文件路径"
msgid "Service Status"
msgstr "服务状态"
msgid "Onething Edge status:"
msgstr "网心云的状态信息如下:"
msgid "Setup"
msgstr "安装配置"
msgid "The following parameters will only take effect during installation or upgrade:"
msgstr "以下参数只在安装或者升级时才会生效:"
msgid "Status"
msgstr "状态"
msgid "Onething Edge is running"
msgstr "网心云运行中"
msgid "Onething Edge is not running"
msgstr "网心云未运行"
msgid "Open the Onething Edge"
msgstr "打开网心云"
+1
View File
@@ -0,0 +1 @@
zh-cn
+3
View File
@@ -0,0 +1,3 @@
config wxedge
# option 'cache_path' ''
# option 'image_name' ''
@@ -0,0 +1,14 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete firewall.wxedge
set firewall.wxedge=rule
set firewall.wxedge.name="wxedge"
set firewall.wxedge.target="ACCEPT"
set firewall.wxedge.src="wan"
set firewall.wxedge.dest_port="1024-65535"
set firewall.wxedge.enabled="0"
commit firewall
EOF
exit 0
+122
View File
@@ -0,0 +1,122 @@
#!/bin/sh
ACTION=${1}
shift 1
# 1. 判断iStoreEnhance是否运行
# 2. 使用 docker info 获取包含 registry.linkease.net 的镜像服务器地址
# 3. 如果1和2都满足,则直接 docker pull registry.linkease.net:5443/onething1/wxedge
# 4. 反之运行docker pull
istoreenhance_pull() {
local image_name="$1"
echo "docker pull ${image_name}"
docker pull "$image_name"
if [ $? -ne 0 ]; then
local isInstall=$(command -v iStoreEnhance)
local isRun=$(pgrep iStoreEnhance)
# 判断iStoreEnhance是否运行
if [ -n "$isRun" ]; then
# 使用 docker info 获取包含 registry.linkease.net 的镜像服务器地址
local registry_mirror=$(docker info 2>/dev/null | awk -F': ' '/Registry Mirrors:/ {found=1; next} found && NF {if ($0 ~ /registry.linkease.net/) {print; exit}}')
if [[ -n "$registry_mirror" ]]; then
echo "istoreenhance_pull failed"
else
echo "download failed, not found registry.linkease.net"
fi
else
if [ -z "$isInstall" ]; then
echo "download failed, install istoreenhance to speedup, \"https://doc.linkease.com/zh/guide/istore/software/istoreenhance.html\""
else
echo "download failed, enable istoreenhance to speedup"
fi
fi
exit 1
fi
}
do_install() {
local path=`uci get wxedge.@wxedge[0].cache_path 2>/dev/null`
local image_name=`uci get wxedge.@wxedge[0].image_name 2>/dev/null`
if [ -z "$path" ]; then
echo "path is empty!"
exit 1
fi
[ -z "$image_name" ] && image_name="onething1/wxedge"
istoreenhance_pull "$image_name"
docker rm -f wxedge
local cmd="docker run --restart=unless-stopped -d \
--privileged \
--network=host \
--dns=127.0.0.1 \
--tmpfs /run \
--tmpfs /tmp \
-v \"$path:/storage\" \
-v \"$path/containerd:/var/lib/containerd\" \
-e PLACE=CTKS"
local tz="`uci get system.@system[0].zonename | sed 's/ /_/g'`"
[ -z "$tz" ] || cmd="$cmd -e TZ=$tz"
cmd="$cmd --name wxedge \"$image_name\""
echo "$cmd"
eval "$cmd"
if [ "$?" = "0" ]; then
if [ "`uci -q get firewall.wxedge.enabled`" = 0 ]; then
uci -q batch <<-EOF >/dev/null
set firewall.wxedge.enabled="1"
commit firewall
EOF
/etc/init.d/firewall reload
fi
fi
}
usage() {
echo "usage: $0 sub-command"
echo "where sub-command is one of:"
echo " install Install the wxedge"
echo " upgrade Upgrade the wxedge"
echo " rm/start/stop/restart Remove/Start/Stop/Restart the wxedge"
echo " status Onething Edge status"
echo " port Onething Edge port"
}
case ${ACTION} in
"install")
do_install
;;
"upgrade")
do_install
;;
"rm")
docker rm -f wxedge
if [ "`uci -q get firewall.wxedge.enabled`" = 1 ]; then
uci -q batch <<-EOF >/dev/null
set firewall.wxedge.enabled="0"
commit firewall
EOF
/etc/init.d/firewall reload
fi
;;
"start" | "stop" | "restart")
docker ${ACTION} wxedge
;;
"status")
docker ps --all -f 'name=^/wxedge$' --format '{{.State}}'
;;
"port")
docker ps --all -f 'name=^/wxedge$' --format '{{.Ports}}' | grep -om1 '0.0.0.0:[0-9]*' | sed 's/0.0.0.0://'
;;
*)
usage
exit 1
;;
esac
@@ -0,0 +1,11 @@
{
"luci-app-wxedge": {
"description": "Grant UCI access for luci-app-wxedge",
"read": {
"uci": [ "wxedge" ]
},
"write": {
"uci": [ "wxedge" ]
}
}
}