mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-31 22:25:13 +08:00
🌴 Sync 2026-03-05 23:51:42
This commit is contained in:
1 parent
97c049ed0a
commit
0acff03804
14253 files changed
+3893239
No files matched your search
@@ -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
|
||||
@@ -0,0 +1,62 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
'use strict';
|
||||
'require form';
|
||||
'require fs';
|
||||
'require ui';
|
||||
'require view';
|
||||
|
||||
return view.extend({
|
||||
render() {
|
||||
let 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'))
|
||||
return fs.read_direct('/etc/dae/example.dae', 'text')
|
||||
.then(function(content) {
|
||||
return content ?? '';
|
||||
}).catch(function(e) {
|
||||
return '';
|
||||
});
|
||||
|
||||
ui.addNotification(null, E('p', e.message));
|
||||
return '';
|
||||
});
|
||||
}
|
||||
o.write = function(section_id, value) {
|
||||
return fs.write('/etc/dae/config.dae', value, 384 /* 0600 */)
|
||||
.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(ev, mode) {
|
||||
return this.handleSave(ev).then(function() {
|
||||
return L.resolveDefault(fs.exec_direct('/etc/init.d/dae', ['hot_reload']), null);
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -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 */
|
||||
let css = ' \
|
||||
#log_textarea { \
|
||||
text-align: left; \
|
||||
} \
|
||||
#log_textarea pre { \
|
||||
padding: .5rem; \
|
||||
word-break: break-all; \
|
||||
margin: 0; \
|
||||
} \
|
||||
.description { \
|
||||
background-color: #33ccff; \
|
||||
}';
|
||||
|
||||
let log_textarea = E('div', { 'id': 'log_textarea' },
|
||||
E('img', {
|
||||
'src': L.resource('icons/loading.svg'),
|
||||
'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) {
|
||||
let log = E('pre', { 'wrap': 'pre' }, [
|
||||
content.trim() || _('Log is empty.')
|
||||
]);
|
||||
|
||||
dom.content(log_textarea, log);
|
||||
}).catch(function(e) {
|
||||
let 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);
|
||||
});
|
||||
}));
|
||||
|
||||
const 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', () => {
|
||||
scrollUpButton.focus();
|
||||
});
|
||||
|
||||
const 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', () => {
|
||||
scrollDownButton.focus();
|
||||
});
|
||||
|
||||
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
|
||||
});
|
||||
@@ -0,0 +1,81 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
'use strict';
|
||||
'require form';
|
||||
'require poll';
|
||||
'require rpc';
|
||||
'require uci';
|
||||
'require view';
|
||||
|
||||
const callServiceList = rpc.declare({
|
||||
object: 'service',
|
||||
method: 'list',
|
||||
params: ['name'],
|
||||
expect: { '': {} }
|
||||
});
|
||||
|
||||
function getServiceStatus() {
|
||||
return L.resolveDefault(callServiceList('dae'), {}).then(function(res) {
|
||||
let isRunning = false;
|
||||
try {
|
||||
isRunning = res['dae']['instances']['dae']['running'];
|
||||
} catch (e) { }
|
||||
return isRunning;
|
||||
});
|
||||
}
|
||||
|
||||
function renderStatus(isRunning) {
|
||||
let spanTemp = '<span style="color:%s"><strong>%s %s</strong></span>';
|
||||
let renderHTML;
|
||||
if (isRunning)
|
||||
renderHTML = spanTemp.format('green', _('dae'), _('RUNNING'));
|
||||
else
|
||||
renderHTML = spanTemp.format('red', _('dae'), _('NOT RUNNING'));
|
||||
|
||||
return renderHTML;
|
||||
}
|
||||
|
||||
return view.extend({
|
||||
render() {
|
||||
let 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) {
|
||||
let 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();
|
||||
}
|
||||
});
|
||||
@@ -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 ""
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
zh_Hans
|
||||
@@ -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 高性能透明代理解决方案。"
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"luci-app-dae": {
|
||||
"description": "Grant access to dae configuration",
|
||||
"read": {
|
||||
"file": {
|
||||
"/etc/dae/config.dae": [ "read" ],
|
||||
"/etc/dae/example.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" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user