From f5c404d5e12f80b95e2be2975c4e70f0cbf730bd Mon Sep 17 00:00:00 2001 From: kiddin9 <48883331+kiddin9@users.noreply.github.com> Date: Fri, 15 May 2026 21:14:58 +0800 Subject: [PATCH] Add files via upload --- .../luci-app-qbittorrent-enhanced/Makefile | 13 +++ .../resources/view/qbittorrent/config.js | 88 +++++++++++++++++++ .../resources/view/qbittorrent/log.js | 75 ++++++++++++++++ .../po/templates/qbittorrent.pot | 76 ++++++++++++++++ .../luci-app-qbittorrent-enhanced/po/zh-cn | 1 + .../po/zh_Hans/qbittorrent.po | 85 ++++++++++++++++++ .../root/etc/uci-defaults/qbittorrent | 9 ++ .../menu.d/luci-app-qbittorrent-enhanced.json | 28 ++++++ .../acl.d/luci-app-qbittorrent-enhanced.json | 17 ++++ 9 files changed, 392 insertions(+) create mode 100644 .github/diy/packages/luci-app-qbittorrent-enhanced/Makefile create mode 100644 .github/diy/packages/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/config.js create mode 100644 .github/diy/packages/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/log.js create mode 100644 .github/diy/packages/luci-app-qbittorrent-enhanced/po/templates/qbittorrent.pot create mode 100644 .github/diy/packages/luci-app-qbittorrent-enhanced/po/zh-cn create mode 100644 .github/diy/packages/luci-app-qbittorrent-enhanced/po/zh_Hans/qbittorrent.po create mode 100644 .github/diy/packages/luci-app-qbittorrent-enhanced/root/etc/uci-defaults/qbittorrent create mode 100644 .github/diy/packages/luci-app-qbittorrent-enhanced/root/usr/share/luci/menu.d/luci-app-qbittorrent-enhanced.json create mode 100644 .github/diy/packages/luci-app-qbittorrent-enhanced/root/usr/share/rpcd/acl.d/luci-app-qbittorrent-enhanced.json diff --git a/.github/diy/packages/luci-app-qbittorrent-enhanced/Makefile b/.github/diy/packages/luci-app-qbittorrent-enhanced/Makefile new file mode 100644 index 00000000..0b57dddb --- /dev/null +++ b/.github/diy/packages/luci-app-qbittorrent-enhanced/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 qBittorrent Enhanced Edition +LUCI_DEPENDS:=+qbittorrent-enhanced-edition +LUCI_PKGARCH:=all + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/.github/diy/packages/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/config.js b/.github/diy/packages/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/config.js new file mode 100644 index 00000000..1cbc7e6e --- /dev/null +++ b/.github/diy/packages/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/config.js @@ -0,0 +1,88 @@ +// 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('qbittorrent'), {}).then(function(res) { + let isRunning = false; + try { + isRunning = res['qbittorrent']['instances']['instance1']['running']; + } catch (e) { } + return isRunning; + }); +} + +function renderStatus(isRunning, port) { + let spanTemp = '%s %s'; + let renderHTML; + if (isRunning) { + let button = String.format(' %s', + window.location.hostname, port, _('Open Web Interface')); + renderHTML = spanTemp.format('green', _('qBittorrent'), _('RUNNING')) + button; + } else { + renderHTML = spanTemp.format('red', _('qBittorrent'), _('NOT RUNNING')); + } + + return renderHTML; +} + +return view.extend({ + load() { + return Promise.all([ + uci.load('qbittorrent') + ]); + }, + + render(data) { + let m, s, o; + let webport = uci.get(data[0], 'config', 'http_port') || '8080'; + + m = new form.Map('qbittorrent', _('qBittorrent'), + _('qBittorrent is a bittorrent client programmed in C++ / Qt.
' + + 'Default login username is admin and password is adminadmin.')); + + 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, webport); + }); + }); + + return E('div', { class: 'cbi-section', id: 'status_bar' }, [ + E('p', { id: 'service_status' }, _('Collecting data...')) + ]); + } + + s = m.section(form.NamedSection, 'config', 'qbittorrent'); + + o = s.option(form.Flag, 'enabled', _('Enable')); + o.default = o.disabled; + o.rmempty = false; + + o = s.option(form.Value, 'http_port', _('Listen port')); + o.datatype = 'port'; + o.default = '8080'; + o.rmempty = false; + + o = s.option(form.Value, 'download_dir', _('Download path')); + o.default = '/mnt/download'; + o.rmempty = false; + + return m.render(); + } +}); diff --git a/.github/diy/packages/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/log.js b/.github/diy/packages/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/log.js new file mode 100644 index 00000000..e56cb5e0 --- /dev/null +++ b/.github/diy/packages/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/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.svg'), + 'alt': _('Loading...'), + 'style': 'vertical-align:middle' + }, _('Collecting data...')) + ); + + poll.add(L.bind(function() { + return fs.read_direct('/var/log/qbittorrent/qbittorrent.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/.github/diy/packages/luci-app-qbittorrent-enhanced/po/templates/qbittorrent.pot b/.github/diy/packages/luci-app-qbittorrent-enhanced/po/templates/qbittorrent.pot new file mode 100644 index 00000000..990816ee --- /dev/null +++ b/.github/diy/packages/luci-app-qbittorrent-enhanced/po/templates/qbittorrent.pot @@ -0,0 +1,76 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/config.js:81 +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/log.js:32 +msgid "Collecting data..." +msgstr "" + +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/config.js:96 +msgid "Download path" +msgstr "" + +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/config.js:87 +msgid "Enable" +msgstr "" + +#: applications/luci-app-qbittorrent-enhanced/root/usr/share/rpcd/acl.d/luci-app-qbittorrent-enhanced.json:3 +msgid "Grant UCI access for luci-app-qbittorrent-enhanced" +msgstr "" + +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/config.js:91 +msgid "Listen port" +msgstr "" + +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/log.js:30 +msgid "Loading..." +msgstr "" + +#: applications/luci-app-qbittorrent-enhanced/root/usr/share/luci/menu.d/luci-app-qbittorrent-enhanced.json:21 +msgid "Log" +msgstr "" + +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/log.js:48 +msgid "Log file does not exist." +msgstr "" + +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/log.js:39 +msgid "Log is empty." +msgstr "" + +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/config.js:36 +msgid "NOT RUNNING" +msgstr "" + +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/config.js:33 +msgid "Open Web Interface" +msgstr "" + +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/config.js:34 +msgid "RUNNING" +msgstr "" + +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/log.js:65 +msgid "Refresh every %s seconds." +msgstr "" + +#: applications/luci-app-qbittorrent-enhanced/root/usr/share/luci/menu.d/luci-app-qbittorrent-enhanced.json:13 +msgid "Settings" +msgstr "" + +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/log.js:52 +msgid "Unknown error: %s" +msgstr "" + +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/config.js:34 +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/config.js:36 +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/config.js:66 +#: applications/luci-app-qbittorrent-enhanced/root/usr/share/luci/menu.d/luci-app-qbittorrent-enhanced.json:3 +msgid "qBittorrent" +msgstr "" + +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/config.js:67 +msgid "" +"qBittorrent is a bittorrent client programmed in C++ / Qt.
Default " +"login username is admin and password is adminadmin." +msgstr "" diff --git a/.github/diy/packages/luci-app-qbittorrent-enhanced/po/zh-cn b/.github/diy/packages/luci-app-qbittorrent-enhanced/po/zh-cn new file mode 100644 index 00000000..8d69574d --- /dev/null +++ b/.github/diy/packages/luci-app-qbittorrent-enhanced/po/zh-cn @@ -0,0 +1 @@ +zh_Hans \ No newline at end of file diff --git a/.github/diy/packages/luci-app-qbittorrent-enhanced/po/zh_Hans/qbittorrent.po b/.github/diy/packages/luci-app-qbittorrent-enhanced/po/zh_Hans/qbittorrent.po new file mode 100644 index 00000000..e576422f --- /dev/null +++ b/.github/diy/packages/luci-app-qbittorrent-enhanced/po/zh_Hans/qbittorrent.po @@ -0,0 +1,85 @@ +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-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/config.js:81 +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/log.js:32 +msgid "Collecting data..." +msgstr "正在收集数据中..." + +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/config.js:96 +msgid "Download path" +msgstr "下载目录" + +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/config.js:87 +msgid "Enable" +msgstr "启用" + +#: applications/luci-app-qbittorrent-enhanced/root/usr/share/rpcd/acl.d/luci-app-qbittorrent-enhanced.json:3 +msgid "Grant UCI access for luci-app-qbittorrent-enhanced" +msgstr "授予 luci-app-qbittorrent-enhanced 访问 UCI 配置的权限" + +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/config.js:91 +msgid "Listen port" +msgstr "监听端口" + +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/log.js:30 +msgid "Loading..." +msgstr "加载中..." + +#: applications/luci-app-qbittorrent-enhanced/root/usr/share/luci/menu.d/luci-app-qbittorrent-enhanced.json:21 +msgid "Log" +msgstr "日志" + +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/log.js:48 +msgid "Log file does not exist." +msgstr "日志文件不存在。" + +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/log.js:39 +msgid "Log is empty." +msgstr "日志为空。" + +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/config.js:36 +msgid "NOT RUNNING" +msgstr "未运行" + +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/config.js:33 +msgid "Open Web Interface" +msgstr "打开 Web 界面" + +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/config.js:34 +msgid "RUNNING" +msgstr "运行中" + +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/log.js:65 +msgid "Refresh every %s seconds." +msgstr "每 %s 秒刷新。" + +#: applications/luci-app-qbittorrent-enhanced/root/usr/share/luci/menu.d/luci-app-qbittorrent-enhanced.json:13 +msgid "Settings" +msgstr "设置" + +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/log.js:52 +msgid "Unknown error: %s" +msgstr "未知错误:%s" + +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/config.js:34 +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/config.js:36 +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/config.js:66 +#: applications/luci-app-qbittorrent-enhanced/root/usr/share/luci/menu.d/luci-app-qbittorrent-enhanced.json:3 +msgid "qBittorrent" +msgstr "qBittorrent" + +#: applications/luci-app-qbittorrent-enhanced/htdocs/luci-static/resources/view/qbittorrent/config.js:67 +msgid "" +"qBittorrent is a bittorrent client programmed in C++ / Qt.
Default " +"login username is admin and password is adminadmin." +msgstr "" +"qBittorrent 是一个基于 C++ / Qt 编写的 BitTorrent 客户端。
默认登录用户" +"名 admin 密码 adminadmin。" diff --git a/.github/diy/packages/luci-app-qbittorrent-enhanced/root/etc/uci-defaults/qbittorrent b/.github/diy/packages/luci-app-qbittorrent-enhanced/root/etc/uci-defaults/qbittorrent new file mode 100644 index 00000000..8feb10c9 --- /dev/null +++ b/.github/diy/packages/luci-app-qbittorrent-enhanced/root/etc/uci-defaults/qbittorrent @@ -0,0 +1,9 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@qbittorrent[-1] + commit ucitrack +EOF + +rm -f /tmp/luci-indexcache +exit 0 diff --git a/.github/diy/packages/luci-app-qbittorrent-enhanced/root/usr/share/luci/menu.d/luci-app-qbittorrent-enhanced.json b/.github/diy/packages/luci-app-qbittorrent-enhanced/root/usr/share/luci/menu.d/luci-app-qbittorrent-enhanced.json new file mode 100644 index 00000000..1e3e3cc8 --- /dev/null +++ b/.github/diy/packages/luci-app-qbittorrent-enhanced/root/usr/share/luci/menu.d/luci-app-qbittorrent-enhanced.json @@ -0,0 +1,28 @@ +{ + "admin/services/qbittorrent": { + "title": "qBittorrent Enhanced Edition", + "action": { + "type": "firstchild" + }, + "depends": { + "acl": [ "luci-app-qbittorrent-enhanced" ], + "uci": { "qbittorrent": true } + } + }, + "admin/services/qbittorrent/config": { + "title": "Settings", + "order": 10, + "action": { + "type": "view", + "path": "qbittorrent/config" + } + }, + "admin/services/qbittorrent/log": { + "title": "Log", + "order": 20, + "action": { + "type": "view", + "path": "qbittorrent/log" + } + } +} diff --git a/.github/diy/packages/luci-app-qbittorrent-enhanced/root/usr/share/rpcd/acl.d/luci-app-qbittorrent-enhanced.json b/.github/diy/packages/luci-app-qbittorrent-enhanced/root/usr/share/rpcd/acl.d/luci-app-qbittorrent-enhanced.json new file mode 100644 index 00000000..a584aab5 --- /dev/null +++ b/.github/diy/packages/luci-app-qbittorrent-enhanced/root/usr/share/rpcd/acl.d/luci-app-qbittorrent-enhanced.json @@ -0,0 +1,17 @@ +{ + "luci-app-qbittorrent-enhanced": { + "description": "Grant UCI access for luci-app-qbittorrent-enhanced", + "read": { + "file": { + "/var/log/qbittorrent/qbittorrent.log": [ "read" ] + }, + "ubus": { + "service": [ "list" ] + }, + "uci": [ "qbittorrent" ] + }, + "write": { + "uci": [ "qbittorrent" ] + } + } +}