From 2a53e61d76a609ce90c54efd00609e18ed202695 Mon Sep 17 00:00:00 2001 From: kenzok8 Date: Wed, 20 Mar 2024 21:52:20 +0800 Subject: [PATCH] update 2024-03-20 21:52:20 --- daed/Makefile | 159 ++++++++++++++++++ daed/files/daed.config | 7 + daed/files/daed.init | 46 +++++ daed/test.sh | 7 + luci-app-daed/Makefile | 13 ++ .../luci-static/resources/view/daed/config.js | 93 ++++++++++ .../luci-static/resources/view/daed/log.js | 75 +++++++++ luci-app-daed/po/templates/daed.pot | 86 ++++++++++ luci-app-daed/po/zh-cn | 1 + luci-app-daed/po/zh_Hans/daed.po | 93 ++++++++++ .../usr/share/luci/menu.d/luci-app-daed.json | 29 ++++ .../usr/share/rpcd/acl.d/luci-app-daed.json | 17 ++ 12 files changed, 626 insertions(+) create mode 100644 daed/Makefile create mode 100644 daed/files/daed.config create mode 100644 daed/files/daed.init create mode 100644 daed/test.sh create mode 100644 luci-app-daed/Makefile create mode 100644 luci-app-daed/htdocs/luci-static/resources/view/daed/config.js create mode 100644 luci-app-daed/htdocs/luci-static/resources/view/daed/log.js create mode 100644 luci-app-daed/po/templates/daed.pot create mode 120000 luci-app-daed/po/zh-cn create mode 100644 luci-app-daed/po/zh_Hans/daed.po create mode 100644 luci-app-daed/root/usr/share/luci/menu.d/luci-app-daed.json create mode 100644 luci-app-daed/root/usr/share/rpcd/acl.d/luci-app-daed.json diff --git a/daed/Makefile b/daed/Makefile new file mode 100644 index 000000000..c86b0b7d4 --- /dev/null +++ b/daed/Makefile @@ -0,0 +1,159 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2023 ImmortalWrt.org + +include $(TOPDIR)/rules.mk + +PKG_NAME:=daed +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/daeuniverse/daed.git +PKG_SOURCE_DATE:=2023-11-03 +PKG_SOURCE_VERSION:=54bc33934d0e323449df11fc26dc9569edbbe13c +PKG_MIRROR_HASH:=1d4d8b4fd163834acec3d227ef56697d79ffa374309105a9e6b35dcf4aa96b14 + +PKG_LICENSE:=AGPL-3.0-only MIT +PKG_LICENSE_FILES:=LICENSE wing/LICENSE +PKG_MAINTAINER:=Tianling Shen + +PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/wing +PKG_BUILD_DEPENDS:=golang/host bpf-headers +PKG_BUILD_PARALLEL:=1 +PKG_BUILD_FLAGS:=no-mips16 + +GO_PKG:=github.com/daeuniverse/dae-wing +GO_PKG_LDFLAGS:= \ + -X '$(GO_PKG)/db.AppDescription=$(PKG_NAME) is a integration solution of dae, API and UI.' +GO_PKG_LDFLAGS_X= \ + $(GO_PKG)/db.AppName=$(PKG_NAME) \ + $(GO_PKG)/db.AppVersion=$(PKG_VERSION) +GO_PKG_TAGS:=embedallowed + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/bpf.mk +include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk + +TAR_CMD=$(HOST_TAR) -C $(BUILD_DIR)/ $(TAR_OPTIONS) + +define Package/daed/Default + SECTION:=net + CATEGORY:=Network + SUBMENU:=Web Servers/Proxies + URL:=https://github.com/daeuniverse/daed +endef + +define Package/daed + $(call Package/daed/Default) + TITLE:=A Modern Dashboard For dae + # You need enable KERNEL_DEBUG_INFO_BTF and KERNEL_BPF_EVENTS + DEPENDS:=$(GO_ARCH_DEPENDS) $(BPF_DEPENDS) \ + +ca-bundle +kmod-sched-core +kmod-sched-bpf +kmod-xdp-sockets-diag +endef + +define Package/daed-geoip + $(call Package/daed/Default) + TITLE:=geoip for daed + DEPENDS:=+daed +v2ray-geoip + PKGARCH:=all +endef + +define Package/daed-geosite + $(call Package/daed/Default) + TITLE:=geosite for daed + DEPENDS:=+daed +v2ray-geosite + PKGARCH:=all +endef + +define Package/daed/description + daed is a backend of dae, provides a method to bundle arbitrary + frontend, dae and geodata into one binary. +endef + +define Package/daed/conffiles +/etc/daed/wing.db +/etc/config/daed +endef + +WEB_FILE:=$(PKG_NAME)-web-$(PKG_VERSION).zip +define Download/daed-web + URL:=@IMMORTALWRT + FILE:=$(WEB_FILE) + HASH:=8cbff499a250ab5af859e3374f566c683925ef9b3efddce7ceeefdf44ef6fe04 +endef + +define Build/Prepare + $(call Build/Prepare/Default) + + ( \ + mkdir -p $(PKG_BUILD_DIR)/webrender/web ; \ + unzip -q -d $(PKG_BUILD_DIR)/webrender/web $(DL_DIR)/$(WEB_FILE) ; \ + find $(PKG_BUILD_DIR)/webrender/web -type f -size +4k ! -name "*.gz" ! -name "*.woff" ! -name "*.woff2" -exec sh -c '\ + gzip -9 -k "{}"; \ + if [ "$$$$(stat -c %s {})" -lt "$$$$(stat -c %s {}.gz)" ]; then \ + rm {}.gz; \ + else \ + rm {}; \ + fi' \ + ";" ; \ + ) +endef + +DAE_CFLAGS:= \ + -O2 -Wall -Werror \ + -DMAX_MATCH_SET_LEN=64 \ + -I$(BPF_HEADERS_DIR)/tools/lib \ + -I$(BPF_HEADERS_DIR)/arch/$(BPF_KARCH)/include/asm/mach-generic + +ifneq ($(CONFIG_USE_MUSL),) + TARGET_CFLAGS += -D_LARGEFILE64_SOURCE +endif + +define Build/Compile + ( \ + pushd $(PKG_BUILD_DIR) ; \ + $(GO_GENERAL_BUILD_CONFIG_VARS) \ + $(GO_PKG_BUILD_CONFIG_VARS) \ + $(GO_PKG_BUILD_VARS) \ + go generate ./... ; \ + cd dae-core ; \ + $(GO_GENERAL_BUILD_CONFIG_VARS) \ + $(GO_PKG_BUILD_CONFIG_VARS) \ + $(GO_PKG_BUILD_VARS) \ + BPF_CLANG="$(CLANG)" \ + BPF_STRIP_FLAG="-strip=$(LLVM_STRIP)" \ + BPF_CFLAGS="$(DAE_CFLAGS)" \ + BPF_TARGET="bpfel,bpfeb" \ + go generate control/control.go ; \ + popd ; \ + $(call GoPackage/Build/Compile) ; \ + ) +endef + +define Package/daed/install + $(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR)) + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/dae-wing $(1)/usr/bin/daed + + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) $(CURDIR)/files/daed.config $(1)/etc/config/daed + + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) $(CURDIR)/files/daed.init $(1)/etc/init.d/daed +endef + +define Package/daed-geoip/install + $(INSTALL_DIR) $(1)/usr/share/daed + $(LN) ../v2ray/geoip.dat $(1)/usr/share/daed/geoip.dat +endef + +define Package/daed-geosite/install + $(INSTALL_DIR) $(1)/usr/share/daed + $(LN) ../v2ray/geosite.dat $(1)/usr/share/daed/geosite.dat +endef + +$(eval $(call Download,daed-web)) +$(eval $(call GoBinPackage,daed)) +$(eval $(call BuildPackage,daed)) +$(eval $(call BuildPackage,daed-geoip)) +$(eval $(call BuildPackage,daed-geosite)) diff --git a/daed/files/daed.config b/daed/files/daed.config new file mode 100644 index 000000000..ff61f3639 --- /dev/null +++ b/daed/files/daed.config @@ -0,0 +1,7 @@ + +config daed 'config' + option enabled '0' + option listen_addr '0.0.0.0:2023' + option log_maxbackups '1' + option log_maxsize '5' + diff --git a/daed/files/daed.init b/daed/files/daed.init new file mode 100644 index 000000000..baa72884e --- /dev/null +++ b/daed/files/daed.init @@ -0,0 +1,46 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2023 Tianling Shen + +USE_PROCD=1 +START=99 + +CONF="daed" +PROG="/usr/bin/daed" +LOG="/var/log/daed/daed.log" + +start_service() { + config_load "$CONF" + + local enabled + config_get_bool enabled "config" "enabled" "0" + [ "$enabled" -eq "1" ] || return 1 + + local listen_addr log_maxbackups log_maxsize + config_get listen_addr "config" "listen_addr" "0.0.0.0:2023" + config_get log_maxbackups "config" "log_maxbackups" "1" + config_get log_maxsize "config" "log_maxsize" "5" + + procd_open_instance "$CONF" + procd_set_param command "$PROG" run + procd_append_param command --config "/etc/daed/" + procd_append_param command --listen "$listen_addr" + procd_append_param command --logfile "$LOG" + procd_append_param command --logfile-maxbackups "$log_maxbackups" + procd_append_param command --logfile-maxsize "$log_maxsize" + + procd_set_param limits core="unlimited" + procd_set_param limits nofile="1000000 1000000" + procd_set_param respawn + # procd_set_param stdout 1 + procd_set_param stderr 1 + + procd_close_instance +} + +stop_service() { + rm -f "$LOG" +} + +service_triggers() { + procd_add_reload_trigger "$CONF" +} diff --git a/daed/test.sh b/daed/test.sh new file mode 100644 index 000000000..891cd5631 --- /dev/null +++ b/daed/test.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +case "$1" in + "daed") + daed --version | grep "$PKG_VERSION" + ;; +esac diff --git a/luci-app-daed/Makefile b/luci-app-daed/Makefile new file mode 100644 index 000000000..ff102937b --- /dev/null +++ b/luci-app-daed/Makefile @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (C) 2023 ImmortalWrt.org + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI app for dae dashboard +LUCI_DEPENDS:=+daed +daed-geoip +daed-geosite +LUCI_PKGARCH:=all + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js b/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js new file mode 100644 index 000000000..2ecacbc93 --- /dev/null +++ b/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js @@ -0,0 +1,93 @@ +// 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('daed'), {}).then(function (res) { + var isRunning = false; + try { + isRunning = res['daed']['instances']['daed']['running']; + } catch (e) { } + return isRunning; + }); +} + +function renderStatus(isRunning, port) { + var spanTemp = '%s %s'; + var renderHTML; + if (isRunning) { + var button = String.format(' %s', + window.location.hostname, port, _('Open Web Interface')); + renderHTML = spanTemp.format('green', _('daed'), _('RUNNING')) + button; + } else { + renderHTML = spanTemp.format('red', _('daed'), _('NOT RUNNING')); + } + + return renderHTML; +} + +return view.extend({ + load: function() { + return Promise.all([ + uci.load('daed') + ]); + }, + + render: function(data) { + var m, s, o; + var webport = (uci.get(data[0], 'config', 'address') || '0.0.0.0:2023').split(':').slice(-1)[0]; + + m = new form.Map('daed', _('daed'), + _('A modern dashboard for dae.')); + + 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, webport); + }); + }); + + return E('div', { class: 'cbi-section', id: 'status_bar' }, [ + E('p', { id: 'service_status' }, _('Collecting data...')) + ]); + } + + s = m.section(form.NamedSection, 'config', 'daed'); + + o = s.option(form.Flag, 'enabled', _('Enable')); + o.default = o.disabled; + o.rmempty = false; + + o = s.option(form.Value, 'listen_addr', _('Listening address')); + o.datatype = 'ipaddrport(1)'; + o.default = '0.0.0.0:2023'; + o.rmempty = false; + + o = s.option(form.Value, 'log_maxbackups', _('Max log backups'), + _('The maximum number of old log files to retain.')); + o.datatype = 'uinteger'; + o.default = '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.default = '5'; + + return m.render(); + } +}); diff --git a/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js b/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js new file mode 100644 index 000000000..67f8cf29c --- /dev/null +++ b/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js @@ -0,0 +1,75 @@ +// SPDX-License-Identifier: Apache-2.0 + +'use strict'; +'require dom'; +'require fs'; +'require poll'; +'require uci'; +'require view'; + +return view.extend({ + render: function() { + /* Thanks to luci-app-aria2 */ + var css = ' \ + #log_textarea { \ + padding: 10px; \ + 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/daed/daed.log', 'text') + .then(function(res) { + var log = E('pre', { 'wrap': 'pre' }, [ + res.trim() || _('Log is empty.') + ]); + + dom.content(log_textarea, log); + }).catch(function(err) { + var log; + + if (err.toString().includes('NotFoundError')) + log = E('pre', { 'wrap': 'pre' }, [ + _('Log file does not exist.') + ]); + else + log = E('pre', { 'wrap': 'pre' }, [ + _('Unknown error: %s').format(err) + ]); + + dom.content(log_textarea, log); + }); + })); + + return E([ + E('style', [ css ]), + E('div', {'class': 'cbi-map'}, [ + E('div', {'class': 'cbi-section'}, [ + log_textarea, + E('div', {'style': 'text-align:right'}, + E('small', {}, _('Refresh every %s seconds.').format(L.env.pollinterval)) + ) + ]) + ]) + ]); + }, + + handleSaveApply: null, + handleSave: null, + handleReset: null +}); diff --git a/luci-app-daed/po/templates/daed.pot b/luci-app-daed/po/templates/daed.pot new file mode 100644 index 000000000..548c9433f --- /dev/null +++ b/luci-app-daed/po/templates/daed.pot @@ -0,0 +1,86 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:53 +msgid "A modern dashboard for dae." +msgstr "" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:66 +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:32 +msgid "Collecting data..." +msgstr "" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:72 +msgid "Enable" +msgstr "" + +#: applications/luci-app-daed/root/usr/share/rpcd/acl.d/luci-app-daed.json:3 +msgid "Grant access to daed configuration" +msgstr "" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:76 +msgid "Listening address" +msgstr "" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:30 +msgid "Loading..." +msgstr "" + +#: applications/luci-app-daed/root/usr/share/luci/menu.d/luci-app-daed.json:22 +msgid "Log" +msgstr "" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:48 +msgid "Log file does not exist." +msgstr "" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:39 +msgid "Log is empty." +msgstr "" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:81 +msgid "Max log backups" +msgstr "" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:86 +msgid "Max log size" +msgstr "" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:35 +msgid "NOT RUNNING" +msgstr "" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:32 +msgid "Open Web Interface" +msgstr "" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:33 +msgid "RUNNING" +msgstr "" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:65 +msgid "Refresh every %s seconds." +msgstr "" + +#: applications/luci-app-daed/root/usr/share/luci/menu.d/luci-app-daed.json:14 +msgid "Settings" +msgstr "" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:82 +msgid "The maximum number of old log files to retain." +msgstr "" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:87 +msgid "The maximum size in megabytes of the log file before it gets rotated." +msgstr "" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:52 +msgid "Unknown error: %s" +msgstr "" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:33 +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:35 +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:52 +#: applications/luci-app-daed/root/usr/share/luci/menu.d/luci-app-daed.json:3 +msgid "daed" +msgstr "" diff --git a/luci-app-daed/po/zh-cn b/luci-app-daed/po/zh-cn new file mode 120000 index 000000000..8d69574dd --- /dev/null +++ b/luci-app-daed/po/zh-cn @@ -0,0 +1 @@ +zh_Hans \ No newline at end of file diff --git a/luci-app-daed/po/zh_Hans/daed.po b/luci-app-daed/po/zh_Hans/daed.po new file mode 100644 index 000000000..686d7a9e5 --- /dev/null +++ b/luci-app-daed/po/zh_Hans/daed.po @@ -0,0 +1,93 @@ +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-daed/htdocs/luci-static/resources/view/daed/config.js:53 +msgid "A modern dashboard for dae." +msgstr "dae 现代化控制面板。" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:66 +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:32 +msgid "Collecting data..." +msgstr "收集数据中..." + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:72 +msgid "Enable" +msgstr "启用" + +#: applications/luci-app-daed/root/usr/share/rpcd/acl.d/luci-app-daed.json:3 +msgid "Grant access to daed configuration" +msgstr "授予访问 daed 配置的权限" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:76 +msgid "Listening address" +msgstr "监听地址" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:30 +msgid "Loading..." +msgstr "加载中..." + +#: applications/luci-app-daed/root/usr/share/luci/menu.d/luci-app-daed.json:22 +msgid "Log" +msgstr "日志" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:48 +msgid "Log file does not exist." +msgstr "日志文件不存在。" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:39 +msgid "Log is empty." +msgstr "日志为空" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:81 +msgid "Max log backups" +msgstr "最大日志备份" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:86 +msgid "Max log size" +msgstr "最大日志大小" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:35 +msgid "NOT RUNNING" +msgstr "未运行" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:32 +msgid "Open Web Interface" +msgstr "打开 Web 界面" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:33 +msgid "RUNNING" +msgstr "运行中" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:65 +msgid "Refresh every %s seconds." +msgstr "每 %s 秒刷新。" + +#: applications/luci-app-daed/root/usr/share/luci/menu.d/luci-app-daed.json:14 +msgid "Settings" +msgstr "设置" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:82 +msgid "The maximum number of old log files to retain." +msgstr "要保留的最大旧日志文件数量。" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:87 +msgid "The maximum size in megabytes of the log file before it gets rotated." +msgstr "要保留的最大日志大小(单位:MB)。" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:52 +msgid "Unknown error: %s" +msgstr "未知错误:%s" + +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:33 +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:35 +#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:52 +#: applications/luci-app-daed/root/usr/share/luci/menu.d/luci-app-daed.json:3 +msgid "daed" +msgstr "daed" diff --git a/luci-app-daed/root/usr/share/luci/menu.d/luci-app-daed.json b/luci-app-daed/root/usr/share/luci/menu.d/luci-app-daed.json new file mode 100644 index 000000000..7dd5e2b48 --- /dev/null +++ b/luci-app-daed/root/usr/share/luci/menu.d/luci-app-daed.json @@ -0,0 +1,29 @@ +{ + "admin/services/daed": { + "title": "daed", + "order": 20, + "action": { + "type": "firstchild" + }, + "depends": { + "acl": [ "luci-app-daed" ], + "uci": { "daed": true } + } + }, + "admin/services/daed/config": { + "title": "Settings", + "order": 10, + "action": { + "type": "view", + "path": "daed/config" + } + }, + "admin/services/daed/log": { + "title": "Log", + "order": 20, + "action": { + "type": "view", + "path": "daed/log" + } + } +} diff --git a/luci-app-daed/root/usr/share/rpcd/acl.d/luci-app-daed.json b/luci-app-daed/root/usr/share/rpcd/acl.d/luci-app-daed.json new file mode 100644 index 000000000..8ec379d9d --- /dev/null +++ b/luci-app-daed/root/usr/share/rpcd/acl.d/luci-app-daed.json @@ -0,0 +1,17 @@ +{ + "luci-app-daed": { + "description": "Grant access to daed configuration", + "read": { + "file": { + "/var/log/daed/daed.log": [ "read" ] + }, + "ubus": { + "service": [ "list" ] + }, + "uci": [ "daed" ] + }, + "write": { + "uci": [ "daed" ] + } + } +}