mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 01:39:25 +08:00
update
This commit is contained in:
@@ -192,3 +192,4 @@ plugins/goedge-happy
|
||||
plugins/dztasks
|
||||
|
||||
/logs
|
||||
/data
|
||||
|
||||
@@ -121,7 +121,7 @@ def get_dir():
|
||||
dir_list['page'] = mw.getPage({'p':page, 'row': row, 'tojs':'getFiles', 'count': dir_list['count']}, '1,2,3,4,5,6,7,8')
|
||||
return dir_list
|
||||
|
||||
# 获取文件列表
|
||||
# 解压
|
||||
@blueprint.route('/uncompress', endpoint='uncompress', methods=['POST'])
|
||||
@panel_login_required
|
||||
def uncompress():
|
||||
@@ -130,6 +130,17 @@ def uncompress():
|
||||
path = request.form.get('path', '')
|
||||
return file.uncompress(sfile, dfile, path)
|
||||
|
||||
# 批量操作
|
||||
@blueprint.route('/set_batch_data', endpoint='set_batch_data', methods=['POST'])
|
||||
@panel_login_required
|
||||
def set_batch_data():
|
||||
path = request.form.get('path', '')
|
||||
stype = request.form.get('type', '')
|
||||
access = request.form.get('access', '')
|
||||
user = request.form.get('user', '')
|
||||
data = request.form.get('data')
|
||||
return file.setBatchData(path, stype, access, user, data)
|
||||
|
||||
# 上传文件
|
||||
@blueprint.route('/upload_file', endpoint='upload_file', methods=['POST'])
|
||||
@panel_login_required
|
||||
|
||||
+62
-1
@@ -12,11 +12,12 @@ import os
|
||||
import pwd
|
||||
import time
|
||||
import shutil
|
||||
import json
|
||||
|
||||
import core.mw as mw
|
||||
import thisdb
|
||||
|
||||
def uploadSegmentApi():
|
||||
def uploadSegment():
|
||||
# 分段上传
|
||||
path = request.form.get('path', '')
|
||||
name = request.form.get('name', '')
|
||||
@@ -131,6 +132,66 @@ def uncompress(sfile, dfile, path):
|
||||
except Exception as e:
|
||||
return mw.returnData(False, '文件解压失败!:' + str(e))
|
||||
|
||||
def setBatchData(path, stype, access, user, data):
|
||||
if stype == '1' or stype == '2':
|
||||
session['selected'] = {
|
||||
'path': path,
|
||||
'type': stype,
|
||||
'access': access,
|
||||
'user': user,
|
||||
'data': data
|
||||
}
|
||||
return mw.returnData(True, '标记成功,请在目标目录点击粘贴所有按钮!')
|
||||
elif stype == '3':
|
||||
for key in json.loads(data):
|
||||
try:
|
||||
filename = path + '/' + key
|
||||
if not self.checkDir(filename):
|
||||
return mw.returnData(False, 'FILE_DANGER')
|
||||
os.system('chmod -R ' + access + " '" + filename + "'")
|
||||
os.system('chown -R ' + user + ':' + user + " '" + filename + "'")
|
||||
except:
|
||||
continue
|
||||
mw.writeLog('文件管理', '批量设置权限成功!')
|
||||
return mw.returnData(True, '批量设置权限成功!')
|
||||
else:
|
||||
recycle_bin = thisdb.getOption('recycle_bin')
|
||||
is_recycle = False
|
||||
if recycle_bin == 'open':
|
||||
is_recycle = True
|
||||
data = json.loads(data)
|
||||
l = len(data)
|
||||
i = 0
|
||||
for key in data:
|
||||
try:
|
||||
filename = path + '/' + key
|
||||
topath = filename
|
||||
if not os.path.exists(filename):
|
||||
continue
|
||||
|
||||
i += 1
|
||||
mw.writeSpeed(key, i, l)
|
||||
if os.path.isdir(filename):
|
||||
if not checkDir(filename):
|
||||
return mw.returnData(False, '请不要花样作死!')
|
||||
if is_recycle:
|
||||
mvRecycleBin(topath)
|
||||
else:
|
||||
shutil.rmtree(filename)
|
||||
else:
|
||||
if key == '.user.ini':
|
||||
os.system('which chattr && chattr -i ' + filename)
|
||||
if is_recycle:
|
||||
mvRecycleBin(topath)
|
||||
else:
|
||||
os.remove(filename)
|
||||
except:
|
||||
continue
|
||||
mw.writeSpeed(None, 0, 0)
|
||||
mw.writeLog('文件管理', '批量删除成功!')
|
||||
return mw.returnData(True, '批量删除成功!')
|
||||
|
||||
|
||||
def copyDir(src_file, dst_file):
|
||||
if not os.path.exists(src_file):
|
||||
return mw.returnData(False, '指定目录不存在!')
|
||||
|
||||
Reference in New Issue
Block a user