From 62120eb0fea1033a0b557bf0360e7e066df8c0b5 Mon Sep 17 00:00:00 2001 From: SpeedPartner <376705740@qq.com> Date: Fri, 5 May 2023 00:17:52 +0800 Subject: [PATCH 1/2] Scroll to the bottom only once when get the log --- luci-app-alist/luasrc/view/alist/alist_log.htm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/luci-app-alist/luasrc/view/alist/alist_log.htm b/luci-app-alist/luasrc/view/alist/alist_log.htm index b77932e..737179e 100644 --- a/luci-app-alist/luasrc/view/alist/alist_log.htm +++ b/luci-app-alist/luasrc/view/alist/alist_log.htm @@ -12,12 +12,16 @@ } ); } + var scrolled = false; XHR.poll(2, '<%=url([[admin]], [[nas]], [[alist]], [[get_log]])%>', null, function(x, data) { if(x && x.status == 200) { var log_textarea = document.getElementById('log_textarea'); log_textarea.innerHTML = x.responseText; - log_textarea.scrollTop = log_textarea.scrollHeight; + if (!scrolled) { + log_textarea.scrollTop = log_textarea.scrollHeight; + scrolled = true; + } } } ); From 7af0cda04eb81be4a75846118f30bc2a8bcad5bf Mon Sep 17 00:00:00 2001 From: SpeedPartner <376705740@qq.com> Date: Sat, 6 May 2023 22:20:52 +0800 Subject: [PATCH 2/2] Replace ASCII symbols that cannot be displayed in the logs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before: INFO[2023-05-06 01:46:19] build index for: [/] After: 🔧[36mINFO🔧[0m[2023-05-06 01:46:19] build index for: [/] --- luci-app-alist/luasrc/view/alist/alist_log.htm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/luci-app-alist/luasrc/view/alist/alist_log.htm b/luci-app-alist/luasrc/view/alist/alist_log.htm index 737179e..5ec4a78 100644 --- a/luci-app-alist/luasrc/view/alist/alist_log.htm +++ b/luci-app-alist/luasrc/view/alist/alist_log.htm @@ -17,7 +17,9 @@ function(x, data) { if(x && x.status == 200) { var log_textarea = document.getElementById('log_textarea'); - log_textarea.innerHTML = x.responseText; + var str = x.responseText; + var logs = str.replace(//g, "🔧"); + log_textarea.innerHTML = logs; if (!scrolled) { log_textarea.scrollTop = log_textarea.scrollHeight; scrolled = true;