update 2024-11-12 20:38:43

This commit is contained in:
kenzok8 2024-11-12 20:38:43 +08:00
parent 92a74c34c2
commit 9abb825643
6 changed files with 25 additions and 9 deletions

View File

@ -53,7 +53,7 @@ define Package/aria2
SUBMENU:=File Transfer
TITLE:=lightweight download utility
URL:=https://aria2.github.io/
DEPENDS:=+zlib +libstdcpp +ARIA2_OPENSSL:libopenssl +ARIA2_GNUTLS:libgnutls \
DEPENDS:=+zlib +libstdcpp +ARIA2_OPENSSL:libopenssl +ARIA2_OPENSSL:libopenssl-legacy +ARIA2_GNUTLS:libgnutls \
+ARIA2_NETTLE:libnettle +ARIA2_LIBGCRYPT:libgcrypt +ARIA2_GMP:libgmp \
+ARIA2_LIBXML2:libxml2 +ARIA2_EXPAT:libexpat +ARIA2_SFTP:libssh2 \
+ARIA2_ASYNC_DNS:libcares +ARIA2_COOKIE:libsqlite3

View File

@ -6,7 +6,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-alist
PKG_VERSION:=1.1.1
PKG_VERSION:=1.1.2
PKG_RELEASE:=1
LUCI_TITLE:=LuCI support for alist

View File

@ -170,6 +170,11 @@ return view.extend({
o.default = 1;
o.rmempty = false;
o = s.option(form.Value, 'log_path', _('Log path'));
o.default = '/var/log/alist.log';
o.rmempty = false;
o.depends('log', '1');
o = s.option(form.Value, 'log_max_size', _('Max Size'));
o.datatype = 'uinteger';
o.default = '10';

View File

@ -2,15 +2,21 @@
'require dom';
'require fs';
'require poll';
'require uci';
'require view';
var scrollPosition = 0;
var userScrolled = false;
var logTextarea;
var log_path;
uci.load('alist').then(function() {
log_path = uci.get('alist', '@alist[0]', 'log_path') || '/var/log/alist.log';
});
function pollLog() {
return Promise.all([
fs.read_direct('/var/log/alist.log', 'text').then(function (res) {
fs.read_direct(log_path, 'text').then(function (res) {
return res.trim().split(/\n/).join('\n').replace(/\u001b\[33mWARN\u001b\[0m/g, '').replace(/\u001b\[36mINFO\u001b\[0m/g, '').replace(/\u001b\[31mERRO\u001b\[0m/g, '');
}),
]).then(function (data) {
@ -26,7 +32,7 @@ function pollLog() {
return view.extend({
handleCleanLogs: function () {
return fs.write('/var/log/alist.log', '')
return fs.write(log_path, '')
.catch(function (e) { ui.addNotification(null, E('p', e.message)) });
},
@ -45,7 +51,9 @@ return view.extend({
var log_textarea_wrapper = E('div', { 'id': 'log_textarea' }, logTextarea);
poll.add(pollLog);
setTimeout(function () {
poll.add(pollLog);
}, 100);
var clear_logs_button = E('input', { 'class': 'btn cbi-button-action', 'type': 'button', 'style': 'margin-left: 10px; margin-top: 10px;', 'value': _('Clear logs') });
clear_logs_button.addEventListener('click', this.handleCleanLogs.bind(this));

View File

@ -80,8 +80,11 @@ msgstr "允许从外网访问"
msgid "Enable Logs"
msgstr "启用日志"
msgid "Max Size"
msgstr "日志文大小"
msgid "Log path"
msgstr "日志文件路径"
msgid "Max Size (MB)"
msgstr "日志文件大小MB"
msgid "Max backups"
msgstr "日志备份数量"

View File

@ -4,7 +4,7 @@
"read": {
"file": {
"/usr/bin/alist": [ "exec" ],
"/var/log/alist.log": [ "read" ]
"/*": [ "read" ]
},
"ubus": {
"service": [ "list" ]
@ -13,7 +13,7 @@
},
"write": {
"file": {
"/var/log/alist.log": [ "write" ]
"/*": [ "write" ]
},
"uci": [ "alist" ]
}