Add files via upload

This commit is contained in:
kiddin9 2026-05-15 21:14:58 +08:00 committed by GitHub
parent 5292b9c80a
commit f5c404d5e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 392 additions and 0 deletions

View File

@ -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

View File

@ -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 = '<span style="color:%s"><strong>%s %s</strong></span>';
let renderHTML;
if (isRunning) {
let button = String.format('&#160;<a class="btn cbi-button" href="http://%s:%s" target="_blank" rel="noreferrer noopener">%s</a>',
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.<br />' +
'Default login username is <code>admin</code> and password is <code>adminadmin</code>.'));
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();
}
});

View File

@ -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
});

View File

@ -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.<br />Default "
"login username is <code>admin</code> and password is <code>adminadmin</code>."
msgstr ""

View File

@ -0,0 +1 @@
zh_Hans

View File

@ -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.<br />Default "
"login username is <code>admin</code> and password is <code>adminadmin</code>."
msgstr ""
"qBittorrent 是一个基于 C++ / Qt 编写的 BitTorrent 客户端。<br />默认登录用户"
"名 <code>admin</code> 密码 <code>adminadmin</code>。"

View File

@ -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

View File

@ -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"
}
}
}

View File

@ -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" ]
}
}
}