diff --git a/app/front/views.py b/app/front/views.py index f916cd1..e5bf366 100644 --- a/app/front/views.py +++ b/app/front/views.py @@ -143,13 +143,15 @@ def show(fileid,user,action='download',token=None): name=GetName(fileid) ext=name.split('.')[-1].lower() url=request.url.replace(':80','').replace(':443','').encode('utf-8').split('?')[0] + url='/'.join(url.split('/')[:3])+'/'+urllib.quote('/'.join(url.split('/')[3:])) inner_url='/'+urllib.quote('/'.join(url.split('/')[3:])) if GetConfig("verify_url")=="True": url=url+'?token='+token - if token is None: - return abort(403) - elif VerifyToken(token,path)==False: - return abort(403) + if action!='share': + if token is None: + return abort(403) + elif VerifyToken(token,path)==False: + return abort(403) if request.method=='POST' or action=='share': InfoLogger().print_r(u'share page:{}'.format(path)) if ext in GetConfig('show_redirect').split(','): @@ -176,7 +178,6 @@ def show(fileid,user,action='download',token=None): downloadUrl,play_url=GetDownloadUrl(fileid,user) resp=MakeResponse(redirect(downloadUrl)) return resp - InfoLogger().print_r('action:{}'.format(action)) if name=='.password': resp=MakeResponse(abort(404)) if 'no-referrer' in GetConfig('allow_site').split(',') or sum([i in referrer for i in GetConfig('allow_site').split(',')])>0: diff --git a/app/templates/admin/manage/manage.html b/app/templates/admin/manage/manage.html index 2c5de0b..cdc089b 100644 --- a/app/templates/admin/manage/manage.html +++ b/app/templates/admin/manage/manage.html @@ -129,9 +129,13 @@ a:hover { - + {%if GetConfig("verify_url")=="True"%} + + {%else%} + + {%endif%} {{file_ico(data)}} {{data['name']}} - + {{data['lastModtime']}} @@ -169,7 +173,11 @@ $$(function() { shadeClose: true, shade: 0.8, area: ['100%', '100%'], + {%if GetConfig("verify_url")=="True"%} + content: $$(this).attr('href')+"&action=share" //iframe的url + {%else%} content: $$(this).attr('href')+"?action=share" //iframe的url + {%endif%} }); return false; }); diff --git a/app/utils/aes.py b/app/utils/aes.py index 3e3cc5c..416798b 100644 --- a/app/utils/aes.py +++ b/app/utils/aes.py @@ -57,9 +57,7 @@ def reverse_token(token): return token.replace('plus','+').replace('xiegang','/').replace('equal','=') def VerifyToken(token,filepath): - print token token=reverse_token(token) - print token path=filepath.split(':')[-1] ae=AesCls(GetConfig("password")) msg=ae.decrypt(token) diff --git a/app/utils/file_os.py b/app/utils/file_os.py index 741a918..57a8517 100644 --- a/app/utils/file_os.py +++ b/app/utils/file_os.py @@ -80,8 +80,7 @@ def CreateFolder(folder_name,grand_path,user=GetConfig('default_pan')): mon_db.items.insert_one(item) return True else: - ErrorLogger().print_r(data.get('error').get('msg')) - InfoLogger().print_r(data.get('error').get('msg')) + InfoLogger().print_r('创建文件夹失败:{}'.format(data.get('error').get('message'))) return False def CreateFile(filename,path,content,user=GetConfig('default_pan')): @@ -115,6 +114,7 @@ def CreateFile(filename,path,content,user=GetConfig('default_pan')): else: info['status']=0 info['msg']=data.get('error').get('message') + InfoLogger().print_r('创建文件失败:{}'.format(data.get('error').get('message'))) return info def EditFile(fileid,content,user=GetConfig('default_pan')): @@ -146,6 +146,7 @@ def EditFile(fileid,content,user=GetConfig('default_pan')): else: info['status']=0 info['msg']=data.get('error').get('message') + InfoLogger().print_r('编辑文件失败:{}'.format(data.get('error').get('message'))) except Exception as e: exstr = traceback.format_exc() ErrorLogger().print_r(exstr) @@ -199,7 +200,7 @@ def MoveFile(fileid,new_folder_path,user=GetConfig('default_pan')): redis_client.delete(key) return True else: - InfoLogger().print_r(data.get('error').get('msg')) + InfoLogger().print_r('移动文件失败:{}'.format(data.get('error').get('message'))) return False def ReName(fileid,new_name,user=GetConfig('default_pan')): @@ -236,5 +237,5 @@ def ReName(fileid,new_name,user=GetConfig('default_pan')): mon_db.items.find_one_and_update({'id':file['id']},{'$set':new_value}) return True else: - InfoLogger().print_r(data.get('error').get('msg')) + InfoLogger().print_r('重命名失败:{}'.format(data.get('error').get('message'))) return False diff --git a/config.py b/config.py index 297d96b..4a2cd13 100644 --- a/config.py +++ b/config.py @@ -14,7 +14,7 @@ class config: if REDIS_PASSWORD!='': CACHE_REDIS_PASSWORD=REDIS_PASSWORD SEND_FILE_MAX_AGE_DEFAULT=timedelta(seconds=1) - version='4.190613' + version='4.190614' @staticmethod def init_app(app): diff --git a/update.sh b/update.sh index 6fe948a..f366f04 100755 --- a/update.sh +++ b/update.sh @@ -180,6 +180,7 @@ echo "2019.05.28更新版本:修复开启负债均衡之后,文件名有特 echo "2019.05.29更新版本:支持自定义线程数" echo "2019.05.31更新版本:新增功能:1)下载链接验证开关;优化:1)aria2信息不对时,无法添加任务" echo "2019.06.13更新版本:新增功能:文件展示设置" +echo "2019.06.14更新版本:稍微完善一下日志记录;分享页面取消token验证;修复开启下载验证之后,后台文件打开失败的bug" echo "---------------------------------------------------------------" echo "更新完成!" echo "如果网站无法访问,请检查config.py!"