From 255ed5944fa38fd79e1f330357341e6c37ca1ec8 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Fri, 10 Jan 2025 11:36:54 +0800 Subject: [PATCH 1/5] Update file.py --- web/utils/file.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/web/utils/file.py b/web/utils/file.py index 237f217b75..002526b776 100644 --- a/web/utils/file.py +++ b/web/utils/file.py @@ -496,10 +496,17 @@ def saveBody(path, data, encoding): def sortFileList(path, ftype = 'mtime', sort = 'desc'): flist = os.listdir(path) if ftype == 'mtime': - if sort == 'desc': - flist = sorted(flist, key=lambda f: os.path.getmtime(os.path.join(path,f)), reverse=True) - if sort == 'asc': - flist = sorted(flist, key=lambda f: os.path.getmtime(os.path.join(path,f)), reverse=False) + try: + if sort == 'desc': + flist = sorted(flist, key=lambda f: os.path.getmtime(os.path.join(path,f)), reverse=True) + if sort == 'asc': + flist = sorted(flist, key=lambda f: os.path.getmtime(os.path.join(path,f)), reverse=False) + except Exception as e: + if sort == 'desc': + flist = sorted(flist, key=lambda f: os.path.getctime(os.path.join(path,f)), reverse=True) + if sort == 'asc': + flist = sorted(flist, key=lambda f: os.path.getctime(os.path.join(path,f)), reverse=False) + if ftype == 'size': if sort == 'desc': From 84ceef47cb3d42da7874f415dcc3a52d68b9b750 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Fri, 10 Jan 2025 11:48:20 +0800 Subject: [PATCH 2/5] Update index.py --- plugins/rsyncd/index.py | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/plugins/rsyncd/index.py b/plugins/rsyncd/index.py index c1b88b4381..37e76e95b7 100755 --- a/plugins/rsyncd/index.py +++ b/plugins/rsyncd/index.py @@ -281,21 +281,33 @@ def rsyncOp(method): return 'fail' -def start(): - return rsyncOp('start') +def lsyncdOp(method): + if not mw.isAppleSystem(): + data = mw.execShell('systemctl ' + method + ' lsyncd') + if data[1] == '': + return 'ok' + return 'fail' + return 'fail' +def start(): + status = rsyncOp('start') + lsyncdOp('start') + return status def stop(): - return rsyncOp('stop') - + status = rsyncOp('stop') + lsyncdOp('stop') + return status def restart(): - return rsyncOp('restart') - + status = rsyncOp('restart') + lsyncdOp('restart') + return status def reload(): - return rsyncOp('reload') - + status = rsyncOp('reload') + lsyncdOp('reload') + return status def initdStatus(): if mw.isAppleSystem(): From e0fea9398391f69272e9bb9c12a3662d54ec4a73 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Fri, 10 Jan 2025 12:04:30 +0800 Subject: [PATCH 3/5] update --- plugins/rsyncd/index.py | 2 +- plugins/rsyncd/js/rsyncd.js | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/plugins/rsyncd/index.py b/plugins/rsyncd/index.py index 37e76e95b7..e5f5087739 100755 --- a/plugins/rsyncd/index.py +++ b/plugins/rsyncd/index.py @@ -734,7 +734,7 @@ def lsyncdAdd(): import base64 args = getArgs() - data = checkArgs(args, ['ip', 'conn_type', 'path', 'delay', 'period']) + data = checkArgs(args, ['ip', 'conn_type', 'path', 'delay', 'period', 'bwlimit']) if not data[0]: return data[1] diff --git a/plugins/rsyncd/js/rsyncd.js b/plugins/rsyncd/js/rsyncd.js index f7e2a7f230..edfa2d3e35 100755 --- a/plugins/rsyncd/js/rsyncd.js +++ b/plugins/rsyncd/js/rsyncd.js @@ -84,6 +84,13 @@ function createSendTask(name = ''){ period_minute_n = "selected"; } + var bwlimit = "1024"; + var delay = "3"; + if ('rsync' in data){ + bwlimit = data['rsync']['bwlimit']; + delay = data['rsync']['delay']; + } + var layerID = layer.open({ type: 1, @@ -146,9 +153,9 @@ function createSendTask(name = ''){
\ 限速\
\ - KB\ + KB\ ?\ - 延迟 秒\ + 延迟 秒\ ?\
\
\ From 703b9be83e17d1df676d9517d25f85595ef1fb16 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Fri, 10 Jan 2025 12:07:03 +0800 Subject: [PATCH 4/5] Update rsyncd.js --- plugins/rsyncd/js/rsyncd.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/rsyncd/js/rsyncd.js b/plugins/rsyncd/js/rsyncd.js index edfa2d3e35..d261bfda32 100755 --- a/plugins/rsyncd/js/rsyncd.js +++ b/plugins/rsyncd/js/rsyncd.js @@ -85,12 +85,14 @@ function createSendTask(name = ''){ } var bwlimit = "1024"; - var delay = "3"; if ('rsync' in data){ bwlimit = data['rsync']['bwlimit']; - delay = data['rsync']['delay']; } + var delay = "3"; + if ('delay' in data){ + delay = data['delay']; + } var layerID = layer.open({ type: 1, From d01ccf1208ffe0adddc71e571e43986b175c19e0 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Fri, 10 Jan 2025 12:10:06 +0800 Subject: [PATCH 5/5] Update rsyncd.js --- plugins/rsyncd/js/rsyncd.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/rsyncd/js/rsyncd.js b/plugins/rsyncd/js/rsyncd.js index d261bfda32..f29c7af078 100755 --- a/plugins/rsyncd/js/rsyncd.js +++ b/plugins/rsyncd/js/rsyncd.js @@ -155,7 +155,7 @@ function createSendTask(name = ''){
\ 限速\
\ - KB\ + KB\ ?\ 延迟 秒\ ?\