update
This commit is contained in:
parent
477b8b1f73
commit
795bee7de3
|
|
@ -161,6 +161,7 @@ data/api.json
|
|||
data/bind_domain.pl
|
||||
data/unauthorized_status.pl
|
||||
data/auth_secret.pl
|
||||
data/panelSpeed.pl
|
||||
|
||||
plugins/vip_*
|
||||
plugins/own_*
|
||||
|
|
@ -185,4 +186,5 @@ plugins/goedge-node
|
|||
plugins/goedge-happy
|
||||
plugins/dztasks
|
||||
|
||||
data/default_new.pl
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
88rr2g7e
|
||||
|
|
@ -156,6 +156,13 @@ def recycle_bin():
|
|||
return file.toggleRecycleBin()
|
||||
|
||||
|
||||
# 回收站文件
|
||||
@blueprint.route('/close_recycle_bin', endpoint='close_recycle_bin', methods=['POST'])
|
||||
@panel_login_required
|
||||
def close_recycle_bin():
|
||||
return file.closeRecycleBin()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -610,6 +610,31 @@ def writeDbLog(stype, msg, args=(), uid=1):
|
|||
print("writeDbLog:"+str(e))
|
||||
return False
|
||||
|
||||
def writeSpeed(title, used, total, speed=0):
|
||||
path = getPanelDir()
|
||||
speed_file= path + '/data/panelSpeed.pl'
|
||||
# 写进度
|
||||
if not title:
|
||||
data = {'title': None, 'progress': 0,'total': 0, 'used': 0, 'speed': 0}
|
||||
else:
|
||||
progress = int((100.0 * used / total))
|
||||
data = {'title': title, 'progress': progress,'total': total, 'used': used, 'speed': speed}
|
||||
writeFile(speed_file, json.dumps(data))
|
||||
return True
|
||||
|
||||
|
||||
def getSpeed():
|
||||
path = getPanelDir()
|
||||
speed_file= path + '/data/panelSpeed.pl'
|
||||
# 取进度
|
||||
path = getPanelDir()
|
||||
data = readFile(speed_file)
|
||||
if not data:
|
||||
data = json.dumps({'title': None, 'progress': 0,'total': 0, 'used': 0, 'speed': 0})
|
||||
writeFile(speed_file, data)
|
||||
return json.loads(data)
|
||||
|
||||
|
||||
|
||||
def M(table=''):
|
||||
import core.db as db
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import time
|
|||
from admin import model
|
||||
|
||||
import core.mw as mw
|
||||
import thisdb
|
||||
|
||||
def getFileBody(path):
|
||||
if not os.path.exists(path):
|
||||
|
|
@ -284,7 +285,7 @@ def fileDelete(path):
|
|||
mw.execShell(cmd)
|
||||
|
||||
try:
|
||||
recycle_bin = model.getOption('recycle_bin')
|
||||
recycle_bin = thisdb.getOption('recycle_bin')
|
||||
if recycle_bin == 'open':
|
||||
if mvRecycleBin(path):
|
||||
return mw.returnData(True, '已将文件移动到回收站!')
|
||||
|
|
@ -303,7 +304,7 @@ def dirDelete(path):
|
|||
if path.find('.user.ini'):
|
||||
os.system("which chattr && chattr -i '" + path + "'")
|
||||
try:
|
||||
recycle_bin = model.getOption('recycle_bin')
|
||||
recycle_bin = thisdb.getOption('recycle_bin')
|
||||
if recycle_bin == 'open':
|
||||
if mvRecycleBin(path):
|
||||
return mw.returnData(True, '已将文件移动到回收站!')
|
||||
|
|
@ -315,19 +316,19 @@ def dirDelete(path):
|
|||
|
||||
# 关闭
|
||||
def toggleRecycleBin():
|
||||
recycle_bin = model.getOption('recycle_bin')
|
||||
recycle_bin = thisdb.getOption('recycle_bin')
|
||||
if recycle_bin == 'open':
|
||||
model.setOption('recycle_bin','close')
|
||||
thisdb.setOption('recycle_bin','close')
|
||||
mw.writeLog('文件管理', '已关闭回收站功能!')
|
||||
return mw.returnData(True, '已关闭回收站功能!')
|
||||
else:
|
||||
model.setOption('recycle_bin','open')
|
||||
thisdb.setOption('recycle_bin','open')
|
||||
mw.writeLog('文件管理', '已开启回收站功能!')
|
||||
return mw.returnData(True, '已开启回收站功能!')
|
||||
|
||||
def getRecycleBin():
|
||||
rb_dir = mw.getRecycleBinDir()
|
||||
recycle_bin = model.getOption('recycle_bin')
|
||||
recycle_bin = thisdb.getOption('recycle_bin')
|
||||
|
||||
data = {}
|
||||
data['dirs'] = []
|
||||
|
|
@ -392,6 +393,26 @@ def reRecycleBin(path):
|
|||
mw.writeLog('文件管理', msg)
|
||||
return mw.returnData(False, '恢复失败!')
|
||||
|
||||
|
||||
def closeRecycleBin():
|
||||
rb_dir = mw.getRecycleBinDir()
|
||||
mw.execShell('which chattr && chattr -R -i ' + rb_dir)
|
||||
rlist = os.listdir(rb_dir)
|
||||
i = 0
|
||||
l = len(rlist)
|
||||
for name in rlist:
|
||||
i += 1
|
||||
path = rb_dir + '/' + name
|
||||
mw.writeSpeed(name, i, l)
|
||||
if os.path.isdir(path):
|
||||
shutil.rmtree(path)
|
||||
else:
|
||||
os.remove(path)
|
||||
mw.writeSpeed(None, 0, 0)
|
||||
mw.writeLog('文件管理', '已清空回收站!')
|
||||
return mw.returnJson(True, '已清空回收站!')
|
||||
|
||||
|
||||
# 设置文件和目录权限
|
||||
def setMode(path):
|
||||
s_path = os.path.dirname(path)
|
||||
|
|
|
|||
Loading…
Reference in New Issue