💐 Sync 2024-04-01 20:27:51

This commit is contained in:
github-actions[bot] 2024-04-01 20:27:51 +08:00
parent ab1dc0dcd1
commit bc9f210457
19 changed files with 576 additions and 11 deletions

View File

@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=alac
PKG_VERSION:=0.0.7
PKG_RELEASE:=2
PKG_RELEASE:=3
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/mikebrady/alac.git
PKG_SOURCE_DATE:=2019-02-13
PKG_SOURCE_VERSION:=96dd59d17b776a7dc94ed9b2c2b4a37177feb3c4
PKG_SOURCE_VERSION:=34b327964c2287a49eb79b88b0ace278835ae95f
PKG_MIRROR_HASH:=skip
PKG_LICENSE:=Apache-2.0

View File

@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=dae
PKG_VERSION:=0.5.1
PKG_RELEASE:=45
PKG_RELEASE:=46
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).zip
PKG_SOURCE_URL:=https://github.com/daeuniverse/dae/releases/download/v$(PKG_VERSION)/dae-full-src.zip?

4
dae/files/dae.init Executable file → Normal file
View File

@ -4,6 +4,8 @@
USE_PROCD=1
START=99
extra_command "hot_reload" "Hot-reload service"
CONF="dae"
PROG="/usr/bin/dae"
LOG_DIR="/var/log/dae"
@ -49,6 +51,6 @@ service_triggers() {
procd_add_reload_trigger "$CONF"
}
reload_service() {
hot_reload() {
"$PROG" reload "$(cat /var/run/dae.pid)"
}

View File

@ -122,7 +122,11 @@ else
kernel_tag="stable"
fi
fi
# Remove the kernel_ prefix
kernel_tag="${kernel_tag/kernel_/}"
# If the kernel tag is a number, it is converted to a stable branch
[[ "${kernel_tag}" =~ ^[1-9]+ ]] && kernel_tag="stable"
# Step 2: Check if there is the latest kernel version
check_kernel() {

15
luci-app-dae/Makefile Normal file
View File

@ -0,0 +1,15 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2024 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_LICENSE:=Apache-2.0
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
LUCI_TITLE:=LuCI app for dae
LUCI_DEPENDS:=+dae +dae-geoip +dae-geosite
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,55 @@
// SPDX-License-Identifier: Apache-2.0
'use strict';
'require form';
'require fs';
'require ui';
'require view';
return view.extend({
render: function() {
var m, s, o;
m = new form.Map('dae', _('Configuration'),
_('Here you can edit dae configuration. It will be hot-reloaded automatically after apply.'));
s = m.section(form.TypedSection);
s.anonymous = true;
s = m.section(form.NamedSection, 'config', 'dae');
o = s.option(form.TextValue, '_configuration');
o.rows = 30;
o.monospace = true;
o.load = function(section_id) {
return fs.read_direct('/etc/dae/config.dae', 'text')
.then(function(content) {
return content ?? '';
}).catch(function(e) {
if (!e.toString().includes('NotFoundError'))
ui.addNotification(null, E('p', e.message));
return '';
});
}
o.write = function(section_id, value) {
return fs.write('/etc/dae/config.dae', value)
.catch(function(e) {
ui.addNotification(null, E('p', e.message));
});
}
o.remove = function(section_id, value) {
return fs.write('/etc/dae/config.dae', '')
.catch(function(e) {
ui.addNotification(null, E('p', e.message));
});
}
return m.render();
},
handleSaveApply: function(ev, mode) {
return this.handleSave(ev).then(function() {
return L.resolveDefault(fs.exec_direct('/etc/init.d/dae', ['hot_reload']), null);
});
}
});

View File

@ -0,0 +1,94 @@
// SPDX-License-Identifier: Apache-2.0
'use strict';
'require dom';
'require fs';
'require poll';
'require view';
return view.extend({
render: function() {
/* Thanks to luci-app-aria2 */
var css = ' \
#log_textarea { \
text-align: left; \
} \
#log_textarea pre { \
padding: .5rem; \
word-break: break-all; \
margin: 0; \
} \
.description { \
background-color: #33ccff; \
}';
var log_textarea = E('div', { 'id': 'log_textarea' },
E('img', {
'src': L.resource(['icons/loading.gif']),
'alt': _('Loading...'),
'style': 'vertical-align:middle'
}, _('Collecting data…'))
);
poll.add(L.bind(function() {
return fs.read_direct('/var/log/dae/dae.log', 'text')
.then(function(content) {
var log = E('pre', { 'wrap': 'pre' }, [
content.trim() || _('Log is empty.')
]);
dom.content(log_textarea, log);
}).catch(function(e) {
var log;
if (e.toString().includes('NotFoundError'))
log = E('pre', { 'wrap': 'pre' }, [
_('Log file does not exist.')
]);
else
log = E('pre', { 'wrap': 'pre' }, [
_('Unknown error: %s').format(e)
]);
dom.content(log_textarea, log);
});
}));
var scrollDownButton = E('button', {
'id': 'scrollDownButton',
'class': 'cbi-button cbi-button-neutral',
}, _('Scroll to tail', 'scroll to bottom (the tail) of the log file')
);
scrollDownButton.addEventListener('click', function() {
window.scrollTo(0, document.body.scrollHeight);
});
var scrollUpButton = E('button', {
'id' : 'scrollUpButton',
'class': 'cbi-button cbi-button-neutral',
}, _('Scroll to head', 'scroll to top (the head) of the log file')
);
scrollUpButton.addEventListener('click', function() {
window.scrollTo(0, 0);
});
return E([
E('style', [ css ]),
E('h2', {}, [ _('Log') ]),
E('div', {'class': 'cbi-map'}, [
E('div', {'style': 'padding-bottom: 20px'}, [scrollDownButton]),
E('div', {'class': 'cbi-section'}, [
log_textarea,
E('div', {'style': 'text-align:right'},
E('small', {}, _('Refresh every %s seconds.').format(L.env.pollinterval))
)
]),
E('div', {'style': 'padding-bottom: 20px'}, [scrollUpButton])
])
]);
},
handleSaveApply: null,
handleSave: null,
handleReset: null
});

View File

@ -0,0 +1,88 @@
// SPDX-License-Identifier: Apache-2.0
'use strict';
'require form';
'require poll';
'require rpc';
'require uci';
'require view';
var callServiceList = rpc.declare({
object: 'service',
method: 'list',
params: ['name'],
expect: { '': {} }
});
function getServiceStatus() {
return L.resolveDefault(callServiceList('dae'), {}).then(function (res) {
var isRunning = false;
try {
isRunning = res['dae']['instances']['dae']['running'];
} catch (e) { }
return isRunning;
});
}
function renderStatus(isRunning) {
var spanTemp = '<span style="color:%s"><strong>%s %s</strong></span>';
var renderHTML;
if (isRunning) {
renderHTML = spanTemp.format('green', _('dae'), _('RUNNING'));
} else {
renderHTML = spanTemp.format('red', _('dae'), _('NOT RUNNING'));
}
return renderHTML;
}
return view.extend({
load: function() {
return Promise.all([
uci.load('dae')
]);
},
render: function(data) {
var m, s, o;
m = new form.Map('dae', _('dae'),
_('eBPF-based Linux high-performance transparent proxy solution.'));
s = m.section(form.TypedSection);
s.anonymous = true;
s.render = function () {
poll.add(function () {
return L.resolveDefault(getServiceStatus()).then(function (res) {
var view = document.getElementById('service_status');
view.innerHTML = renderStatus(res);
});
});
return E('div', { class: 'cbi-section', id: 'status_bar' }, [
E('p', { id: 'service_status' }, _('Collecting data…'))
]);
}
s = m.section(form.NamedSection, 'config', 'dae');
o = s.option(form.Flag, 'enabled', _('Enable'));
o = s.option(form.Value, 'config_file', _('Configration file'));
o.default = '/etc/dae/config.dae';
o.rmempty = false;
o.readonly = true;
o = s.option(form.Value, 'log_maxbackups', _('Max log backups'),
_('The maximum number of old log files to retain.'));
o.datatype = 'uinteger';
o.placeholder = '1';
o = s.option(form.Value, 'log_maxsize', _('Max log size'),
_('The maximum size in megabytes of the log file before it gets rotated.'));
o.datatype = 'uinteger';
o.placeholder = '1';
return m.render();
}
});

View File

@ -0,0 +1,104 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:30
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:63
msgid "Collecting data…"
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:71
msgid "Configration file"
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/config.js:13
#: applications/luci-app-dae/root/usr/share/luci/menu.d/luci-app-dae.json:24
msgid "Configuration"
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:69
msgid "Enable"
msgstr ""
#: applications/luci-app-dae/root/usr/share/rpcd/acl.d/luci-app-dae.json:3
msgid "Grant access to dae configuration"
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/config.js:14
msgid ""
"Here you can edit dae configuration. It will be hot-reloaded automatically "
"after apply."
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:28
msgid "Loading..."
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:77
#: applications/luci-app-dae/root/usr/share/luci/menu.d/luci-app-dae.json:32
msgid "Log"
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:46
msgid "Log file does not exist."
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:37
msgid "Log is empty."
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:76
msgid "Max log backups"
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:81
msgid "Max log size"
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:33
msgid "NOT RUNNING"
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:31
msgid "RUNNING"
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:83
msgid "Refresh every %s seconds."
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:69
msgctxt "scroll to top (the head) of the log file"
msgid "Scroll to head"
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:60
msgctxt "scroll to bottom (the tail) of the log file"
msgid "Scroll to tail"
msgstr ""
#: applications/luci-app-dae/root/usr/share/luci/menu.d/luci-app-dae.json:16
msgid "Settings"
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:77
msgid "The maximum number of old log files to retain."
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:82
msgid "The maximum size in megabytes of the log file before it gets rotated."
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:50
msgid "Unknown error: %s"
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:31
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:33
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:49
#: applications/luci-app-dae/root/usr/share/luci/menu.d/luci-app-dae.json:3
msgid "dae"
msgstr ""
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:50
msgid "eBPF-based Linux high-performance transparent proxy solution."
msgstr ""

1
luci-app-dae/po/zh-cn Symbolic link
View File

@ -0,0 +1 @@
zh_Hans

View File

@ -0,0 +1,111 @@
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: PACKAGE VERSION\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: zh-Hans\n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:30
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:63
msgid "Collecting data…"
msgstr "收集数据中…"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:71
msgid "Configration file"
msgstr "配置文件"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/config.js:13
#: applications/luci-app-dae/root/usr/share/luci/menu.d/luci-app-dae.json:24
msgid "Configuration"
msgstr "配置"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:69
msgid "Enable"
msgstr "启用"
#: applications/luci-app-dae/root/usr/share/rpcd/acl.d/luci-app-dae.json:3
msgid "Grant access to dae configuration"
msgstr "授予访问 dae 配置的权限"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/config.js:14
msgid ""
"Here you can edit dae configuration. It will be hot-reloaded automatically "
"after apply."
msgstr "您可以在此处修改 dae 配置文件。应用后会自动热重载。"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:28
msgid "Loading..."
msgstr "加载中..."
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:77
#: applications/luci-app-dae/root/usr/share/luci/menu.d/luci-app-dae.json:32
msgid "Log"
msgstr "日志"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:46
msgid "Log file does not exist."
msgstr "日志文件不存在。"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:37
msgid "Log is empty."
msgstr "日志为空"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:76
msgid "Max log backups"
msgstr "最大日志备份"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:81
msgid "Max log size"
msgstr "最大日志大小"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:33
msgid "NOT RUNNING"
msgstr "未运行"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:31
msgid "RUNNING"
msgstr "运行中"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:83
msgid "Refresh every %s seconds."
msgstr "每 %s 秒刷新。"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:69
msgctxt "scroll to top (the head) of the log file"
msgid "Scroll to head"
msgstr "滚动到顶部"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:60
msgctxt "scroll to bottom (the tail) of the log file"
msgid "Scroll to tail"
msgstr "滚动到尾部"
#: applications/luci-app-dae/root/usr/share/luci/menu.d/luci-app-dae.json:16
msgid "Settings"
msgstr "设置"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:77
msgid "The maximum number of old log files to retain."
msgstr "要保留的最大旧日志文件数量。"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:82
msgid "The maximum size in megabytes of the log file before it gets rotated."
msgstr "要保留的最大日志大小单位MB。"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/log.js:50
msgid "Unknown error: %s"
msgstr "未知错误:%s"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:31
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:33
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:49
#: applications/luci-app-dae/root/usr/share/luci/menu.d/luci-app-dae.json:3
msgid "dae"
msgstr "dae"
#: applications/luci-app-dae/htdocs/luci-static/resources/view/dae/settings.js:50
msgid "eBPF-based Linux high-performance transparent proxy solution."
msgstr "基于 eBPF 的 Linux 高性能透明代理解决方案。"

View File

@ -0,0 +1,39 @@
{
"admin/services/dae": {
"title": "dae",
"action": {
"type": "firstchild"
},
"depends": {
"acl": [ "luci-app-dae" ],
"fs": {
"/etc/init.d/dae": "executable"
},
"uci": { "dae": true }
}
},
"admin/services/dae/settings": {
"title": "Settings",
"order": 10,
"action": {
"type": "view",
"path": "dae/settings"
}
},
"admin/services/dae/config": {
"title": "Configuration",
"order": 20,
"action": {
"type": "view",
"path": "dae/config"
}
},
"admin/services/dae/log": {
"title": "Log",
"order": 30,
"action": {
"type": "view",
"path": "dae/log"
}
}
}

View File

@ -0,0 +1,22 @@
{
"luci-app-dae": {
"description": "Grant access to dae configuration",
"read": {
"file": {
"/etc/dae/config.dae": [ "read" ],
"/var/log/dae/dae.log": [ "read" ],
"/etc/init.d/dae hot_reload": [ "exec" ]
},
"ubus": {
"service": [ "list" ]
},
"uci": [ "dae" ]
},
"write": {
"file": {
"/etc/dae/config.dae": [ "write" ]
},
"uci": [ "dae" ]
}
}
}

View File

@ -419,7 +419,7 @@ o:depends(_depends)
o = s:taboption("DNS", Button, "clear_ipset", translate("Clear IPSET"), translate("Try this feature if the rule modification does not take effect."))
o.inputstyle = "remove"
function o.write(e, e)
luci.sys.call("[ -n \"$(nft list sets 2>/dev/null | grep \"passwall_\")\" ] && sh /usr/share/" .. appname .. "/nftables.sh flush_nftset || sh /usr/share/" .. appname .. "/iptables.sh flush_ipset > /dev/null 2>&1 &")
luci.sys.call('[ -n "$(nft list sets 2>/dev/null | grep \"passwall_\")" ] && sh /usr/share/passwall/nftables.sh flush_nftset_reload || sh /usr/share/passwall/iptables.sh flush_ipset_reload > /dev/null 2>&1 &')
luci.http.redirect(api.url("log"))
end

View File

@ -269,4 +269,8 @@ if sys.call('[ -f "/www/luci-static/resources/uci.js" ]') == 0 then
end
end
function m.on_commit(self)
luci.sys.call('[ -n "$(nft list sets 2>/dev/null | grep \"passwall_\")" ] && sh /usr/share/passwall/nftables.sh flush_nftset || sh /usr/share/passwall/iptables.sh flush_ipset > /dev/null 2>&1 &')
end
return m

View File

@ -7,6 +7,7 @@
<input class="btn cbi-button cbi-button-apply" type="button" onclick="switch_gfw_mode()" value="<%:GFW List%>" />
<input class="btn cbi-button cbi-button-apply" type="button" onclick="switch_chnroute_mode()" value="<%:Not China List%>" />
<input class="btn cbi-button cbi-button-apply" type="button" onclick="switch_returnhome_mode()" value="<%:China List%>" />
<input class="btn cbi-button cbi-button-apply" type="button" onclick="switch_global_mode()" value="<%:Global Proxy%>" />
</div>
</div>
</div>
@ -99,4 +100,11 @@
opt.set("tcp_proxy_mode", "disable");
opt.set("udp_proxy_mode", "disable");
}
function switch_global_mode() {
opt.set("use_gfw_list", false);
opt.set("chn_list", "0");
opt.set("tcp_proxy_mode", "proxy");
opt.set("udp_proxy_mode", "proxy");
}
</script>

View File

@ -135,7 +135,9 @@ REDIRECT() {
get_jump_ipt() {
case "$1" in
direct)
echo "-j RETURN"
local mark="-m mark ! --mark 1"
s="${mark} -j RETURN"
echo $s
;;
proxy)
if [ -n "$2" ] && [ -n "$(echo $2 | grep "^-")" ]; then
@ -1174,10 +1176,15 @@ del_firewall_rule() {
}
flush_ipset() {
del_firewall_rule
$DIR/app.sh echolog "清空 IPSET。"
for _name in $(ipset list | grep "Name: " | grep "passwall_" | awk '{print $2}'); do
destroy_ipset ${_name}
done
}
flush_ipset_reload() {
del_firewall_rule
flush_ipset
rm -rf /tmp/singbox_passwall*
rm -rf /tmp/etc/passwall_tmp/dnsmasq*
/etc/init.d/passwall reload
@ -1301,6 +1308,9 @@ insert_rule_after)
flush_ipset)
flush_ipset
;;
flush_ipset_reload)
flush_ipset_reload
;;
get_ipt_bin)
get_ipt_bin
;;

View File

@ -170,7 +170,7 @@ gen_nftset() {
get_jump_ipt() {
case "$1" in
direct)
echo "counter return"
echo "mark != 1 counter return"
;;
proxy)
if [ -n "$2" ] && [ -n "$(echo $2 | grep "^counter")" ]; then
@ -1218,10 +1218,15 @@ del_firewall_rule() {
}
flush_nftset() {
del_firewall_rule
$DIR/app.sh echolog "清空 NFTSET。"
for _name in $(nft -a list sets | grep -E "passwall" | awk -F 'set ' '{print $2}' | awk '{print $1}'); do
destroy_nftset ${_name}
done
}
flush_nftset_reload() {
del_firewall_rule
flush_nftset
rm -rf /tmp/singbox_passwall*
rm -rf /tmp/etc/passwall_tmp/dnsmasq*
/etc/init.d/passwall reload
@ -1328,6 +1333,9 @@ insert_rule_after)
flush_nftset)
flush_nftset
;;
flush_nftset_reload)
flush_nftset_reload
;;
get_wan_ip)
get_wan_ip
;;

View File

@ -461,9 +461,9 @@ luci.sys.call("uci commit " .. name)
if reboot == 1 then
log("重启服务,应用新的规则。")
if use_nft == "1" then
luci.sys.call("sh /usr/share/" .. name .. "/nftables.sh flush_nftset > /dev/null 2>&1 &")
luci.sys.call("sh /usr/share/" .. name .. "/nftables.sh flush_nftset_reload > /dev/null 2>&1 &")
else
luci.sys.call("sh /usr/share/" .. name .. "/iptables.sh flush_ipset > /dev/null 2>&1 &")
luci.sys.call("sh /usr/share/" .. name .. "/iptables.sh flush_ipset_reload > /dev/null 2>&1 &")
end
end
log("规则更新完毕...")