From 51f8d70e9a38cbe187508199c0e45ce946e43a78 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 10 Jun 2023 09:39:01 +0800 Subject: [PATCH] update 2023-06-10 09:39:01 --- luci-app-filebrowser/Makefile | 17 +--- .../luci-static/resources/view/filebrowser.js | 87 +++++++++++++++++++ .../luasrc/controller/filebrowser.lua | 22 ----- .../luasrc/model/cbi/filebrowser.lua | 43 --------- .../view/filebrowser/filebrowser_status.htm | 27 ------ .../po/templates/filebrowser.pot | 51 +++++++++++ luci-app-filebrowser/po/zh-cn | 1 + .../po/zh_Hans/filebrowser.po | 60 +++++++++++++ .../root/etc/uci-defaults/luci-filebrowser | 11 --- .../luci/menu.d/luci-app-filebrowser.json | 14 +++ .../rpcd/acl.d/luci-app-filebrowser.json | 3 + natflow/Makefile | 4 +- 12 files changed, 222 insertions(+), 118 deletions(-) create mode 100644 luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js delete mode 100644 luci-app-filebrowser/luasrc/controller/filebrowser.lua delete mode 100644 luci-app-filebrowser/luasrc/model/cbi/filebrowser.lua delete mode 100644 luci-app-filebrowser/luasrc/view/filebrowser/filebrowser_status.htm create mode 100644 luci-app-filebrowser/po/templates/filebrowser.pot create mode 120000 luci-app-filebrowser/po/zh-cn create mode 100644 luci-app-filebrowser/po/zh_Hans/filebrowser.po delete mode 100755 luci-app-filebrowser/root/etc/uci-defaults/luci-filebrowser create mode 100644 luci-app-filebrowser/root/usr/share/luci/menu.d/luci-app-filebrowser.json diff --git a/luci-app-filebrowser/Makefile b/luci-app-filebrowser/Makefile index 3abe46bba..b25acc248 100644 --- a/luci-app-filebrowser/Makefile +++ b/luci-app-filebrowser/Makefile @@ -1,21 +1,12 @@ +# SPDX-License-Identifier: Apache-2.0 # -# Copyright (C) 2021 ImmortalWrt -# -# -# This is free software, licensed under the GNU General Public License v3. -# +# Copyright (C) 2023 ImmortalWrt.org include $(TOPDIR)/rules.mk -LUCI_TITLE:=LuCI Support for FileBrowser -LUCI_DEPENDS:=+filebrowser +LUCI_TITLE:=LuCI app for FileBrowser LUCI_PKGARCH:=all - -PKG_NAME:=luci-app-filebrowser -PKG_VERSION:=snapshot -PKG_RELEASE:=118071b - -PKG_LICENSE:=GPLv3 +LUCI_DEPENDS:=+filebrowser include $(TOPDIR)/feeds/luci/luci.mk diff --git a/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js b/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js new file mode 100644 index 000000000..b91e6c589 --- /dev/null +++ b/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js @@ -0,0 +1,87 @@ +'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('filebrowser'), {}).then(function (res) { + var isRunning = false; + try { + isRunning = res['filebrowser']['instances']['instance1']['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', _('FileBrowser'), _('RUNNING')) + button; + } else { + renderHTML = spanTemp.format('red', _('FileBrowser'), _('NOT RUNNING')); + } + + return renderHTML; +} + +return view.extend({ + load: function() { + return uci.load('filebrowser'); + }, + + render: function(data) { + var m, s, o; + var webport = (uci.get(data, 'config', 'listen_port') || '8989'); + + m = new form.Map('filebrowser', _('FileBrowser'), + _('FileBrowser provides a file managing interface within a specified directory and it can be used to upload, delete, preview, rename and edit your files..')); + + 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', 'filebrowser'); + + o = s.option(form.Flag, 'enabled', _('Enable')); + o.default = o.disabled; + o.rmempty = false; + + o = s.option(form.Value, 'listen_port', _('Listen port')); + o.datatype = 'port'; + o.default = '8989'; + o.rmempty = false; + + o = s.option(form.Value, 'root_path', _('Root directory')); + o.default = '/mnt'; + o.rmempty = false; + + o = s.option(form.Flag, 'disable_exec', _('Disable Command Runner feature')); + o.default = o.enabled; + o.rmempty = false; + + return m.render(); + } +}); diff --git a/luci-app-filebrowser/luasrc/controller/filebrowser.lua b/luci-app-filebrowser/luasrc/controller/filebrowser.lua deleted file mode 100644 index 061f542ae..000000000 --- a/luci-app-filebrowser/luasrc/controller/filebrowser.lua +++ /dev/null @@ -1,22 +0,0 @@ -module("luci.controller.filebrowser", package.seeall) - -function index() - if not nixio.fs.access("/etc/config/filebrowser") then - return - end - - entry({"admin", "nas"}, firstchild(), _("NAS"), 45).dependent = false - - local page = entry({"admin", "nas", "filebrowser"}, cbi("filebrowser"), _("文件管理器"), 100) - page.dependent = true - page.acl_depends = { "luci-app-filebrowser" } - - entry({"admin", "nas", "filebrowser", "status"}, call("act_status")).leaf = true -end - -function act_status() - local e = {} - e.running = luci.sys.call("pgrep filebrowser >/dev/null") == 0 - luci.http.prepare_content("application/json") - luci.http.write_json(e) -end diff --git a/luci-app-filebrowser/luasrc/model/cbi/filebrowser.lua b/luci-app-filebrowser/luasrc/model/cbi/filebrowser.lua deleted file mode 100644 index a1ea4f3f2..000000000 --- a/luci-app-filebrowser/luasrc/model/cbi/filebrowser.lua +++ /dev/null @@ -1,43 +0,0 @@ -m = Map("filebrowser", translate("文件管理器")) -m.description = translate("FileBrowser是一个基于Go的在线文件管理器,助您方便的管理设备上的文件。") - -m:section(SimpleSection).template = "filebrowser/filebrowser_status" - -s = m:section(TypedSection, "filebrowser") -s.addremove = false -s.anonymous = true - -o = s:option(Flag, "enabled", translate("启用")) -o.rmempty = false - -o = s:option(ListValue, "addr_type", translate("监听地址")) -o:value("local", translate("监听本机地址")) -o:value("lan", translate("监听局域网地址")) -o:value("wan", translate("监听全部地址")) -o.default = "lan" -o.rmempty = false - -o = s:option(Value, "port", translate("监听端口")) -o.placeholder = 8989 -o.default = 8989 -o.datatype = "port" -o.rmempty = false - -o = s:option(Value, "root_dir", translate("开放目录")) -o.placeholder = "/" -o.default = "/" -o.rmempty = false - -o = s:option(Value, "db_dir", translate("数据库目录")) -o.description = translate("普通用户请勿随意更改") -o.placeholder = "/etc" -o.default = "/etc" -o.rmempty = false - -o = s:option(Value, "db_name", translate("数据库名")) -o.description = translate("普通用户请勿随意更改") -o.placeholder = "filebrowser.db" -o.default = "filebrowser.db" -o.rmempty = false - -return m diff --git a/luci-app-filebrowser/luasrc/view/filebrowser/filebrowser_status.htm b/luci-app-filebrowser/luasrc/view/filebrowser/filebrowser_status.htm deleted file mode 100644 index 9da250f53..000000000 --- a/luci-app-filebrowser/luasrc/view/filebrowser/filebrowser_status.htm +++ /dev/null @@ -1,27 +0,0 @@ - - -
-

- <%:Collecting data...%> -

-
diff --git a/luci-app-filebrowser/po/templates/filebrowser.pot b/luci-app-filebrowser/po/templates/filebrowser.pot new file mode 100644 index 000000000..dcec5fbaa --- /dev/null +++ b/luci-app-filebrowser/po/templates/filebrowser.pot @@ -0,0 +1,51 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:62 +msgid "Collecting data..." +msgstr "" + +#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:81 +msgid "Disable Command Runner feature" +msgstr "" + +#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:68 +msgid "Enable" +msgstr "" + +#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:31 +#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:33 +#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:48 +#: applications/luci-app-filebrowser/root/usr/share/luci/menu.d/luci-app-filebrowser.json:3 +msgid "FileBrowser" +msgstr "" + +#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:49 +msgid "" +"FileBrowser provides a file managing interface within a specified directory " +"and it can be used to upload, delete, preview, rename and edit your files.." +msgstr "" + +#: applications/luci-app-filebrowser/root/usr/share/rpcd/acl.d/luci-app-filebrowser.json:3 +msgid "Grant UCI access for luci-app-filebrowser" +msgstr "" + +#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:72 +msgid "Listen port" +msgstr "" + +#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:33 +msgid "NOT RUNNING" +msgstr "" + +#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:30 +msgid "Open Web Interface" +msgstr "" + +#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:31 +msgid "RUNNING" +msgstr "" + +#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:77 +msgid "Root directory" +msgstr "" diff --git a/luci-app-filebrowser/po/zh-cn b/luci-app-filebrowser/po/zh-cn new file mode 120000 index 000000000..8d69574dd --- /dev/null +++ b/luci-app-filebrowser/po/zh-cn @@ -0,0 +1 @@ +zh_Hans \ No newline at end of file diff --git a/luci-app-filebrowser/po/zh_Hans/filebrowser.po b/luci-app-filebrowser/po/zh_Hans/filebrowser.po new file mode 100644 index 000000000..b1b763dfd --- /dev/null +++ b/luci-app-filebrowser/po/zh_Hans/filebrowser.po @@ -0,0 +1,60 @@ +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-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:62 +msgid "Collecting data..." +msgstr "收集数据中..." + +#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:81 +msgid "Disable Command Runner feature" +msgstr "禁用命令执行功能" + +#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:68 +msgid "Enable" +msgstr "启用" + +#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:31 +#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:33 +#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:48 +#: applications/luci-app-filebrowser/root/usr/share/luci/menu.d/luci-app-filebrowser.json:3 +msgid "FileBrowser" +msgstr "FileBrowser" + +#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:49 +msgid "" +"FileBrowser provides a file managing interface within a specified directory " +"and it can be used to upload, delete, preview, rename and edit your files.." +msgstr "" +"FileBrowser 提供指定目录下的文件管理界面,可用于上传、删除、预览、重命名和编" +"辑文件。" + +#: applications/luci-app-filebrowser/root/usr/share/rpcd/acl.d/luci-app-filebrowser.json:3 +msgid "Grant UCI access for luci-app-filebrowser" +msgstr "授予 luci-app-filebrowser 访问 UCI 配置的权限" + +#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:72 +msgid "Listen port" +msgstr "监听端口" + +#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:33 +msgid "NOT RUNNING" +msgstr "未运行" + +#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:30 +msgid "Open Web Interface" +msgstr "打开 Web 界面" + +#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:31 +msgid "RUNNING" +msgstr "运行中" + +#: applications/luci-app-filebrowser/htdocs/luci-static/resources/view/filebrowser.js:77 +msgid "Root directory" +msgstr "根目录" diff --git a/luci-app-filebrowser/root/etc/uci-defaults/luci-filebrowser b/luci-app-filebrowser/root/etc/uci-defaults/luci-filebrowser deleted file mode 100755 index df11e7222..000000000 --- a/luci-app-filebrowser/root/etc/uci-defaults/luci-filebrowser +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -uci -q batch <<-EOF >/dev/null - delete ucitrack.@filebrowser[-1] - add ucitrack filebrowser - set ucitrack.@filebrowser[-1].init=filebrowser - commit ucitrack -EOF - -rm -f /tmp/luci-indexcache -exit 0 diff --git a/luci-app-filebrowser/root/usr/share/luci/menu.d/luci-app-filebrowser.json b/luci-app-filebrowser/root/usr/share/luci/menu.d/luci-app-filebrowser.json new file mode 100644 index 000000000..9bd0e410e --- /dev/null +++ b/luci-app-filebrowser/root/usr/share/luci/menu.d/luci-app-filebrowser.json @@ -0,0 +1,14 @@ +{ + "admin/services/filebrowser": { + "title": "FileBrowser", + "action": { + "order": 30, + "type": "view", + "path": "filebrowser" + }, + "depends": { + "acl": [ "luci-app-filebrowser" ], + "uci": { "filebrowser": true } + } + } +} diff --git a/luci-app-filebrowser/root/usr/share/rpcd/acl.d/luci-app-filebrowser.json b/luci-app-filebrowser/root/usr/share/rpcd/acl.d/luci-app-filebrowser.json index e01bde3d4..cc5b6b0b6 100644 --- a/luci-app-filebrowser/root/usr/share/rpcd/acl.d/luci-app-filebrowser.json +++ b/luci-app-filebrowser/root/usr/share/rpcd/acl.d/luci-app-filebrowser.json @@ -2,6 +2,9 @@ "luci-app-filebrowser": { "description": "Grant UCI access for luci-app-filebrowser", "read": { + "ubus": { + "service": [ "list" ] + }, "uci": [ "filebrowser" ] }, "write": { diff --git a/natflow/Makefile b/natflow/Makefile index 7d637b9e3..765d10446 100644 --- a/natflow/Makefile +++ b/natflow/Makefile @@ -9,10 +9,10 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=natflow -PKG_VERSION:=20230601 +PKG_VERSION:=20230610 PKG_SOURCE_URL:=https://codeload.github.com/ptpt52/natflow/tar.gz/$(PKG_VERSION)? -PKG_HASH:=b6d634cd4ab7a0357bcba763307bcad45e541f80eb86bef9aabbf6d481ded0de +PKG_HASH:=ca17141b664f7e4e0aad6943727d3bcf1ed89868ceb784f366cca101c8d59404 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_MAINTAINER:=Chen Minqiang