diff --git a/luci-app-arcadia/Makefile b/luci-app-arcadia/Makefile
new file mode 100644
index 000000000..39d58ad1e
--- /dev/null
+++ b/luci-app-arcadia/Makefile
@@ -0,0 +1,19 @@
+
+
+include $(TOPDIR)/rules.mk
+
+PKG_VERSION:=0.0.1-1
+PKG_RELEASE:=
+
+LUCI_TITLE:=LuCI support for arcadia
+LUCI_PKGARCH:=all
+LUCI_DEPENDS:=+lsblk +docker +dockerd +luci-lib-taskd
+
+define Package/luci-app-arcadia/conffiles
+/etc/config/arcadia
+endef
+
+include $(TOPDIR)/feeds/luci/luci.mk
+
+# call BuildPackage - OpenWrt buildroot signature
+
diff --git a/luci-app-arcadia/luasrc/controller/arcadia.lua b/luci-app-arcadia/luasrc/controller/arcadia.lua
new file mode 100644
index 000000000..7da84153b
--- /dev/null
+++ b/luci-app-arcadia/luasrc/controller/arcadia.lua
@@ -0,0 +1,7 @@
+
+module("luci.controller.arcadia", package.seeall)
+
+function index()
+ entry({"admin", "services", "arcadia"}, alias("admin", "services", "arcadia", "config"), _("Arcadia"), 30).dependent = true
+ entry({"admin", "services", "arcadia", "config"}, cbi("arcadia"))
+end
diff --git a/luci-app-arcadia/luasrc/model/arcadia.lua b/luci-app-arcadia/luasrc/model/arcadia.lua
new file mode 100644
index 000000000..e1ca5c105
--- /dev/null
+++ b/luci-app-arcadia/luasrc/model/arcadia.lua
@@ -0,0 +1,55 @@
+local util = require "luci.util"
+local jsonc = require "luci.jsonc"
+
+local arcadia = {}
+
+arcadia.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
+
+arcadia.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
+
+arcadia.find_paths = function(blocks, home_dirs, path_name)
+ local default_path = ''
+ local configs = {}
+
+ default_path = home_dirs[path_name] .. "/Arcadia"
+ if #blocks == 0 then
+ table.insert(configs, default_path)
+ else
+ for _, val in pairs(blocks) do
+ table.insert(configs, val .. "/" .. path_name .. "/Arcadia")
+ end
+ local without_conf_dir = "/root/" .. path_name .. "/Arcadia"
+ if default_path == without_conf_dir then
+ default_path = configs[1]
+ end
+ end
+
+ return configs, default_path
+end
+
+return arcadia
diff --git a/luci-app-arcadia/luasrc/model/cbi/arcadia.lua b/luci-app-arcadia/luasrc/model/cbi/arcadia.lua
new file mode 100644
index 000000000..7dfd0acc5
--- /dev/null
+++ b/luci-app-arcadia/luasrc/model/cbi/arcadia.lua
@@ -0,0 +1,54 @@
+--[[
+LuCI - Lua Configuration Interface
+]]--
+
+local taskd = require "luci.model.tasks"
+local arcadia_model = require "luci.model.arcadia"
+local m, s, o
+
+m = taskd.docker_map("arcadia", "arcadia", "/usr/libexec/istorec/arcadia.sh",
+ translate("Arcadia"),
+ translate("Arcadia one-stop code operation and maintenance platform.")
+ .. translate("Official website:") .. ' https://arcadia.cool'
+ .. "
" .. translate("Arcadia is mainly aimed at scripting language programming and is suitable for development and operation environments of small and medium-sized teams and individuals.") .. "
"
+ .. translate("In addition to code maintenance, Arcadia is also a powerful scheduled task maintenance platform with a comprehensive file system and underlying CLI command design.")
+ .. "
")
+
+s = m:section(SimpleSection, translate("Service Status"), translate("Arcadia status:"))
+s:append(Template("arcadia/status"))
+
+s = m:section(TypedSection, "arcadia", translate("Setup"),
+ translate("The initial installation of Arcadia requires at least 2GB of space, please make sure that the Docker data directory has enough space. It is recommended to migrate Docker to a hard drive before installing Arcadia.")
+ .. " " .. translate("The following parameters will only take effect during installation or upgrade:"))
+s.addremove=false
+s.anonymous=true
+
+o = s:option(Value, "image", translate("Image"))
+o.datatype = "string"
+o:value("", translate("Default"))
+o:value("supermanito/arcadia:beta", "supermanito/arcadia:beta")
+o:value("registry.cn-hangzhou.aliyuncs.com/supermanito/arcadia:beta", "registry.cn-hangzhou.aliyuncs.com/supermanito/arcadia:beta")
+
+o = s:option(Flag, "hostnet", translate("Host network"), translate("Arcadia running in host network, port is always 5678 if enabled"))
+o.default = 0
+o.rmempty = false
+
+o = s:option(Value, "port", translate("Port").."*")
+o.default = "5678"
+o.datatype = "port"
+o:depends("hostnet", 0)
+
+local blocks = arcadia_model.blocks()
+local home = arcadia_model.home()
+
+o = s:option(Value, "config_path", translate("Config path").."*")
+o.rmempty = false
+o.datatype = "string"
+
+local paths, default_path = arcadia_model.find_paths(blocks, home, "Configs")
+for _, val in pairs(paths) do
+ o:value(val, val)
+end
+o.default = default_path
+
+return m
diff --git a/luci-app-arcadia/luasrc/view/arcadia/status.htm b/luci-app-arcadia/luasrc/view/arcadia/status.htm
new file mode 100644
index 000000000..870101810
--- /dev/null
+++ b/luci-app-arcadia/luasrc/view/arcadia/status.htm
@@ -0,0 +1,31 @@
+<%
+local util = require "luci.util"
+local container_status = util.trim(util.exec("/usr/libexec/istorec/arcadia.sh status"))
+local container_install = (string.len(container_status) > 0)
+local container_running = container_status == "running"
+-%>
+
+
+
+ <% if container_running then %>
+
+ <% else %>
+
+ <% end %>
+
+
+<%
+if container_running then
+ local port=util.trim(util.exec("/usr/libexec/istorec/arcadia.sh port"))
+ if port == "" then
+ port="5678"
+ end
+-%>
+
+
+
+
+
+
+
+<% end %>
\ No newline at end of file
diff --git a/luci-app-arcadia/po/zh-cn/arcadia.po b/luci-app-arcadia/po/zh-cn/arcadia.po
new file mode 100644
index 000000000..231d035c9
--- /dev/null
+++ b/luci-app-arcadia/po/zh-cn/arcadia.po
@@ -0,0 +1,59 @@
+msgid ""
+msgstr "Content-Type: text/plain; charset=UTF-8"
+
+msgid "Official website:"
+msgstr "官方网站:"
+
+msgid "Arcadia one-stop code operation and maintenance platform."
+msgstr "Arcadia 一站式代码运维平台。"
+
+msgid "Arcadia is mainly aimed at scripting language programming and is suitable for development and operation environments of small and medium-sized teams and individuals."
+msgstr "Arcadia 主要面向于脚本语言编程,适用于中小型团队与个人的开发与运维环境。"
+
+msgid "In addition to code maintenance, Arcadia is also a powerful scheduled task maintenance platform with a comprehensive file system and underlying CLI command design."
+msgstr "除了代码运维外 Arcadia 还是一个强大的定时任务运维平台,并且有着完善的文件系统和底层CLI命令设计。"
+
+msgid "Image"
+msgstr "镜像"
+
+msgid "Default"
+msgstr "默认"
+
+msgid "Config path"
+msgstr "配置文件路径"
+
+msgid "Port"
+msgstr "端口"
+
+msgid "Host network"
+msgstr "宿主网络"
+
+msgid "Arcadia running in host network, port is always 5678 if enabled"
+msgstr "在宿主网络运行 Arcadia,如果启用则端口固定为5678"
+
+msgid "Service Status"
+msgstr "服务状态"
+
+msgid "Arcadia status:"
+msgstr "Arcadia 的状态信息如下:"
+
+msgid "Setup"
+msgstr "安装配置"
+
+msgid "The initial installation of Arcadia requires at least 2GB of space, please make sure that the Docker data directory has enough space. It is recommended to migrate Docker to a hard drive before installing Arcadia."
+msgstr "初次安装 Arcadia 至少需要2GB空间,请确保 Docker 数据目录有足够空间。建议安装 Arcadia 前将 Docker 迁移到硬盘上。"
+
+msgid "The following parameters will only take effect during installation or upgrade:"
+msgstr "以下参数只在安装或者升级时才会生效:"
+
+msgid "Status"
+msgstr "状态"
+
+msgid "Arcadia is running"
+msgstr "Arcadia 运行中"
+
+msgid "Arcadia is not running"
+msgstr "Arcadia 未运行"
+
+msgid "Open Arcadia"
+msgstr "打开 Arcadia"
diff --git a/luci-app-arcadia/po/zh_Hans b/luci-app-arcadia/po/zh_Hans
new file mode 120000
index 000000000..41451e4a1
--- /dev/null
+++ b/luci-app-arcadia/po/zh_Hans
@@ -0,0 +1 @@
+zh-cn
\ No newline at end of file
diff --git a/luci-app-arcadia/root/etc/config/arcadia b/luci-app-arcadia/root/etc/config/arcadia
new file mode 100644
index 000000000..d9b33a19f
--- /dev/null
+++ b/luci-app-arcadia/root/etc/config/arcadia
@@ -0,0 +1,5 @@
+config arcadia
+ option 'hostnet' '0'
+ option 'port' '5678'
+# option 'image' 'default'
+# option 'config_path' ''
diff --git a/luci-app-arcadia/root/usr/libexec/istorec/arcadia.sh b/luci-app-arcadia/root/usr/libexec/istorec/arcadia.sh
new file mode 100755
index 000000000..13eb3544e
--- /dev/null
+++ b/luci-app-arcadia/root/usr/libexec/istorec/arcadia.sh
@@ -0,0 +1,101 @@
+#!/bin/sh
+# Author jjm2473@gmail.com
+# Author Xiaobao(xiaobao@linkease.com)
+
+ACTION=${1}
+shift 1
+
+ARCH="default"
+IMAGE_NAME='default'
+
+get_image() {
+ IMAGE_NAME=`uci get arcadia.@arcadia[0].image 2>/dev/null`
+ if [ -z "$IMAGE_NAME" -o "$IMAGE_NAME" == "default" ]; then
+ IMAGE_NAME="supermanito/arcadia:beta"
+ fi
+}
+
+do_install() {
+ get_image
+ echo "docker pull ${IMAGE_NAME}"
+ docker pull ${IMAGE_NAME}
+ docker rm -f arcadia
+
+ do_install_detail
+}
+
+do_install_detail() {
+ local hostnet=`uci get arcadia.@arcadia[0].hostnet 2>/dev/null`
+ local config=`uci get arcadia.@arcadia[0].config_path 2>/dev/null`
+ local port=`uci get arcadia.@arcadia[0].port 2>/dev/null`
+ local dev
+
+ if [ -z "$config" ]; then
+ echo "config path is empty!"
+ exit 1
+ fi
+
+ [ -z "$port" ] && port=5678
+
+ local cmd="docker run --restart=unless-stopped -d -v \"$config/config:/arcadia/config\" -v \"$config/log:/arcadia/log\" -v \"$config/scripts:/arcadia/scripts\" -v \"$config/repo:/arcadia/repo\" -v \"$config/raw:/arcadia/raw\" -v \"$config/tgbot:/arcadia/tgbot\" "
+ if [ -d /dev/dri ]; then
+ cmd="$cmd\
+ -v /dev/dri:/dev/dri \
+ --privileged "
+ fi
+ if [ "$hostnet" = 1 ]; then
+ cmd="$cmd\
+ --dns=127.0.0.1 \
+ --network=host "
+ else
+ cmd="$cmd\
+ --dns=172.17.0.1 \
+ -p $port:5678 "
+ 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 arcadia \"$IMAGE_NAME\""
+
+ echo "$cmd"
+ eval "$cmd"
+
+}
+
+usage() {
+ echo "usage: $0 sub-command"
+ echo "where sub-command is one of:"
+ echo " install Install the arcadia"
+ echo " upgrade Upgrade the arcadia"
+ echo " rm/start/stop/restart Remove/Start/Stop/Restart the arcadia"
+ echo " status Arcadia status"
+ echo " port Arcadia port"
+}
+
+case ${ACTION} in
+ "install")
+ do_install
+ ;;
+ "upgrade")
+ do_install
+ ;;
+ "rm")
+ docker rm -f arcadia
+ ;;
+ "start" | "stop" | "restart")
+ docker ${ACTION} arcadia
+ ;;
+ "status")
+ docker ps --all -f 'name=^/arcadia$' --format '{{.State}}'
+ ;;
+ "port")
+ docker ps --all -f 'name=^/arcadia$' --format '{{.Ports}}' | grep -om1 '0.0.0.0:[0-9]*->5678/tcp' | sed 's/0.0.0.0:\([0-9]*\)->.*/\1/'
+ ;;
+ *)
+ usage
+ exit 1
+ ;;
+esac
diff --git a/luci-app-arcadia/root/usr/share/rpcd/acl.d/luci-app-arcadia.json b/luci-app-arcadia/root/usr/share/rpcd/acl.d/luci-app-arcadia.json
new file mode 100644
index 000000000..66c09c58d
--- /dev/null
+++ b/luci-app-arcadia/root/usr/share/rpcd/acl.d/luci-app-arcadia.json
@@ -0,0 +1,11 @@
+{
+ "luci-app-arcadia": {
+ "description": "Grant UCI access for luci-app-arcadia",
+ "read": {
+ "uci": [ "arcadia" ]
+ },
+ "write": {
+ "uci": [ "arcadia" ]
+ }
+ }
+}
diff --git a/luci-app-passwall/root/usr/share/passwall/helper_chinadns_add.lua b/luci-app-passwall/root/usr/share/passwall/helper_chinadns_add.lua
index 2f430f843..11bdd5507 100644
--- a/luci-app-passwall/root/usr/share/passwall/helper_chinadns_add.lua
+++ b/luci-app-passwall/root/usr/share/passwall/helper_chinadns_add.lua
@@ -224,10 +224,8 @@ end
if uci:get(appname, TCP_NODE, "protocol") == "_shunt" then
local white_domain, lookup_white_domain = {}, {}
local shunt_domain, lookup_shunt_domain = {}, {}
- local blackhole_domain, lookup_blackhole_domain = {}, {}
local file_white_host = TMP_ACL_PATH .. "/white_host"
local file_shunt_host = TMP_ACL_PATH .. "/shunt_host"
- local file_blackhole_host = TMP_ACL_PATH .. "/blackhole_host"
local t = uci:get_all(appname, TCP_NODE)
local default_node_id = t["default_node"] or "_direct"
@@ -246,11 +244,7 @@ if uci:get(appname, TCP_NODE, "protocol") == "_shunt" then
end
line = api.get_std_domain(line)
- if _node_id == "_blackhole" then
- if line ~= "" and not line:find("#") then
- insert_unique(blackhole_domain, line, lookup_blackhole_domain)
- end
- elseif _node_id == "_direct" then
+ if _node_id == "_direct" then
if line ~= "" and not line:find("#") then
insert_unique(white_domain, line, lookup_white_domain)
end
@@ -268,16 +262,6 @@ if uci:get(appname, TCP_NODE, "protocol") == "_shunt" then
end
end)
- if is_file_nonzero(file_blackhole_host) == nil then
- if #blackhole_domain > 0 then
- local f_out = io.open(file_blackhole_host, "w")
- for i = 1, #blackhole_domain do
- f_out:write(blackhole_domain[i] .. "\n")
- end
- f_out:close()
- end
- end
-
if is_file_nonzero(file_white_host) == nil then
if #white_domain > 0 then
local f_out = io.open(file_white_host, "w")
@@ -298,15 +282,6 @@ if uci:get(appname, TCP_NODE, "protocol") == "_shunt" then
end
end
- if is_file_nonzero(file_blackhole_host) then
- for i, v in ipairs(config_lines) do --添加到屏蔽组一同处理
- if v == "group-dnl " .. file_block_host then
- config_lines[i] = "group-dnl " .. file_block_host .. "," .. file_blackhole_host
- break
- end
- end
- end
-
if is_file_nonzero(file_white_host) then
for i, v in ipairs(config_lines) do --添加到白名单组一同处理
if v == "group-dnl " .. file_direct_host then
diff --git a/luci-app-passwall/root/usr/share/passwall/iptables.sh b/luci-app-passwall/root/usr/share/passwall/iptables.sh
index 5d20a8992..2e734320d 100755
--- a/luci-app-passwall/root/usr/share/passwall/iptables.sh
+++ b/luci-app-passwall/root/usr/share/passwall/iptables.sh
@@ -751,10 +751,7 @@ add_firewall_rule() {
local _node_id=$(config_n_get $TCP_NODE $shunt_id "nil")
[ "$_node_id" != "nil" ] && {
[ "$_node_id" = "_default" ] && _node_id=$default_node_id
- if [ "$_node_id" = "_blackhole" ]; then
- config_n_get $shunt_id ip_list | tr -s "\r\n" "\n" | sed -e "/^$/d" | grep -E "(\.((2(5[0-5]|[0-4][0-9]))|[0-1]?[0-9]{1,2})){3}" | sed -e "s/^/add $IPSET_BLOCKLIST &/g" -e "s/$/ timeout 0/g" | awk '{print $0} END{print "COMMIT"}' | ipset -! -R
- config_n_get $shunt_id ip_list | tr -s "\r\n" "\n" | sed -e "/^$/d" | grep -E "([A-Fa-f0-9]{1,4}::?){1,7}[A-Fa-f0-9]{1,4}" | sed -e "s/^/add $IPSET_BLOCKLIST6 &/g" -e "s/$/ timeout 0/g" | awk '{print $0} END{print "COMMIT"}' | ipset -! -R
- elif [ "$_node_id" = "_direct" ]; then
+ if [ "$_node_id" = "_direct" ]; then
config_n_get $shunt_id ip_list | tr -s "\r\n" "\n" | sed -e "/^$/d" | grep -E "(\.((2(5[0-5]|[0-4][0-9]))|[0-1]?[0-9]{1,2})){3}" | sed -e "s/^/add $IPSET_WHITELIST &/g" -e "s/$/ timeout 0/g" | awk '{print $0} END{print "COMMIT"}' | ipset -! -R
config_n_get $shunt_id ip_list | tr -s "\r\n" "\n" | sed -e "/^$/d" | grep -E "([A-Fa-f0-9]{1,4}::?){1,7}[A-Fa-f0-9]{1,4}" | sed -e "s/^/add $IPSET_WHITELIST6 &/g" -e "s/$/ timeout 0/g" | awk '{print $0} END{print "COMMIT"}' | ipset -! -R
else
diff --git a/luci-app-passwall/root/usr/share/passwall/nftables.sh b/luci-app-passwall/root/usr/share/passwall/nftables.sh
index 57ed752bc..0e3dd6812 100755
--- a/luci-app-passwall/root/usr/share/passwall/nftables.sh
+++ b/luci-app-passwall/root/usr/share/passwall/nftables.sh
@@ -837,10 +837,7 @@ add_firewall_rule() {
local _node_id=$(config_n_get $TCP_NODE $shunt_id "nil")
[ "$_node_id" != "nil" ] && {
[ "$_node_id" = "_default" ] && _node_id=$default_node_id
- if [ "$_node_id" = "_blackhole" ]; then
- insert_nftset $NFTSET_BLOCKLIST "0" $(config_n_get $shunt_id ip_list | tr -s "\r\n" "\n" | sed -e "/^$/d" | grep -E "(\.((2(5[0-5]|[0-4][0-9]))|[0-1]?[0-9]{1,2})){3}")
- insert_nftset $NFTSET_BLOCKLIST6 "0" $(config_n_get $shunt_id ip_list | tr -s "\r\n" "\n" | sed -e "/^$/d" | grep -E "([A-Fa-f0-9]{1,4}::?){1,7}[A-Fa-f0-9]{1,4}")
- elif [ "$_node_id" = "_direct" ]; then
+ if [ "$_node_id" = "_direct" ]; then
insert_nftset $NFTSET_WHITELIST "0" $(config_n_get $shunt_id ip_list | tr -s "\r\n" "\n" | sed -e "/^$/d" | grep -E "(\.((2(5[0-5]|[0-4][0-9]))|[0-1]?[0-9]{1,2})){3}")
insert_nftset $NFTSET_WHITELIST6 "0" $(config_n_get $shunt_id ip_list | tr -s "\r\n" "\n" | sed -e "/^$/d" | grep -E "([A-Fa-f0-9]{1,4}::?){1,7}[A-Fa-f0-9]{1,4}")
else