diff --git a/app/admin/pan_manage.py b/app/admin/pan_manage.py index c9257fa..a652422 100644 --- a/app/admin/pan_manage.py +++ b/app/admin/pan_manage.py @@ -85,7 +85,6 @@ def rm_pan(): def setDefaultPan(): pan=request.form.get('pan') set('default_pan',pan) - redis_client.delete(key) redis_client.delete("od_users") redis_client.set('default_pan',pan) return jsonify({'msg':'修改成功'}) diff --git a/app/front/views.py b/app/front/views.py index e5bf366..4968388 100644 --- a/app/front/views.py +++ b/app/front/views.py @@ -88,7 +88,7 @@ def index(path=None): if password!=False: if (not request.cookies.get(md5_p) or request.cookies.get(md5_p)!=password) and has_verify_==False: if total=='files' and GetConfig('encrypt_file')=="no": - if GetConfig("verify_url")=="True": + if GetConfig("verify_url")=="True" and action not in ['share','iframe']: if token is None: return abort(403) elif VerifyToken(token,path): @@ -100,7 +100,7 @@ def index(path=None): resp=MakeResponse(render_template('theme/{}/password.html'.format(GetConfig('theme')),path=path,cur_user=user)) return resp if total=='files': - if GetConfig("verify_url")=="True": + if GetConfig("verify_url")=="True" and action not in ['share','iframe']: if token is None: return abort(403) elif VerifyToken(token,path): @@ -144,15 +144,14 @@ def show(fileid,user,action='download',token=None): 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 action!='share': + url=url+'?token='+GenerateToken(path) + if action not in ['share','iframe']: if token is None: return abort(403) elif VerifyToken(token,path)==False: return abort(403) - if request.method=='POST' or action=='share': + if request.method=='POST' or action in ['share','iframe']: InfoLogger().print_r(u'share page:{}'.format(path)) if ext in GetConfig('show_redirect').split(','): downloadUrl,play_url=GetDownloadUrl(fileid,user) @@ -162,16 +161,32 @@ def show(fileid,user,action='download',token=None): url = 'https://view.officeapps.live.com/op/view.aspx?src='+urllib.quote(downloadUrl) resp=MakeResponse(redirect(url)) elif ext in GetConfig('show_image').split(','): - resp=MakeResponse(render_template('theme/{}/show/image.html'.format(GetConfig('theme')),url=url,inner_url=inner_url,path=path,cur_user=user,name=name)) + if action=='share': + resp=MakeResponse(render_template('theme/{}/show/image.html'.format(GetConfig('theme')),url=url,path=path,cur_user=user,name=name)) + else: + resp=MakeResponse(render_template('show/image.html'.format(GetConfig('theme')),url=url,path=path,cur_user=user,name=name)) + elif ext in GetConfig('show_video').split(','): - resp=MakeResponse(render_template('theme/{}/show/video.html'.format(GetConfig('theme')),url=url,inner_url=inner_url,path=path,cur_user=user,name=name)) + if action=='share': + resp=MakeResponse(render_template('theme/{}/show/video.html'.format(GetConfig('theme')),url=url,path=path,cur_user=user,name=name)) + else: + resp=MakeResponse(render_template('show/video.html'.format(GetConfig('theme')),url=url,path=path,cur_user=user,name=name)) elif ext in GetConfig('show_dash').split(','): - resp=MakeResponse(render_template('theme/{}/show/video2.html'.format(GetConfig('theme')),url=url,inner_url=inner_url,path=path,cur_user=user,name=name)) + if action=='share': + resp=MakeResponse(render_template('theme/{}/show/video2.html'.format(GetConfig('theme')),url=url,path=path,cur_user=user,name=name)) + else: + resp=MakeResponse(render_template('show/video2.html'.format(GetConfig('theme')),url=url,path=path,cur_user=user,name=name)) elif ext in GetConfig('show_audio').split(','): - resp=MakeResponse(render_template('theme/{}/show/audio.html'.format(GetConfig('theme')),url=url,inner_url=inner_url,path=path,cur_user=user,name=name)) + if action=='share': + resp=MakeResponse(render_template('theme/{}/show/audio.html'.format(GetConfig('theme')),url=url,path=path,cur_user=user,name=name)) + else: + resp=MakeResponse(render_template('show/audio.html'.format(GetConfig('theme')),url=url,path=path,cur_user=user,name=name)) elif ext in GetConfig('show_code').split(','): content=common._remote_content(fileid,user) - resp=MakeResponse(render_template('theme/{}/show/code.html'.format(GetConfig('theme')),content=content,url=url,inner_url=inner_url,language=CodeType(ext),path=path,cur_user=user,name=name)) + if action=="share": + resp=MakeResponse(render_template('theme/{}/show/code.html'.format(GetConfig('theme')),content=content,url=url,language=CodeType(ext),path=path,cur_user=user,name=name)) + else: + resp=MakeResponse(render_template('show/code.html'.format(GetConfig('theme')),content=content,url=url,language=CodeType(ext),path=path,cur_user=user,name=name)) elif name=='.password': resp=MakeResponse(abort(404)) else: diff --git a/app/templates/show/audio.html b/app/templates/show/audio.html new file mode 100644 index 0000000..5b0ffce --- /dev/null +++ b/app/templates/show/audio.html @@ -0,0 +1,47 @@ +{%extends 'show/iframe_base.html'%} + +{%block content%} + + + +
+ + +{%endblock content%} diff --git a/app/templates/show/code.html b/app/templates/show/code.html new file mode 100644 index 0000000..9dd34ea --- /dev/null +++ b/app/templates/show/code.html @@ -0,0 +1,21 @@ +{%extends 'show/iframe_base.html'%} + +{%block content%} +
{{content|safe}}
+ + + +{%endblock content%} diff --git a/app/templates/show/iframe_base.html b/app/templates/show/iframe_base.html new file mode 100644 index 0000000..a1f3087 --- /dev/null +++ b/app/templates/show/iframe_base.html @@ -0,0 +1,15 @@ + + + + +PyOne + + + + {%block content%} + {%endblock content%} +
+ {{GetConfig('tj_code')|safe}} +
+ + diff --git a/app/templates/show/image.html b/app/templates/show/image.html new file mode 100644 index 0000000..eb0c391 --- /dev/null +++ b/app/templates/show/image.html @@ -0,0 +1,5 @@ +{%extends 'show/iframe_base.html'%} + +{%block content%} + +{%endblock content%} diff --git a/app/templates/show/video.html b/app/templates/show/video.html new file mode 100644 index 0000000..dc30a25 --- /dev/null +++ b/app/templates/show/video.html @@ -0,0 +1,46 @@ +{%extends 'show/iframe_base.html'%} +{%block content%} + + +
+ +{%endblock content%} + + diff --git a/app/templates/show/video2.html b/app/templates/show/video2.html new file mode 100644 index 0000000..9c62e1d --- /dev/null +++ b/app/templates/show/video2.html @@ -0,0 +1,46 @@ +{%extends 'show/iframe_base.html'%} + +{%block content%} + + + +
+ +{%endblock content%} diff --git a/app/templates/theme/bst4/show/audio.html b/app/templates/theme/bst4/show/audio.html index 2a153f5..4216509 100644 --- a/app/templates/theme/bst4/show/audio.html +++ b/app/templates/theme/bst4/show/audio.html @@ -16,13 +16,16 @@ 分享地址 - {%if GetConfig("verify_url")=="True"%} - - {%else%} - - {%endif%} + 点击复制 +
+ + 内嵌窗口 + + + 点击复制 +
调用地址 diff --git a/app/templates/theme/bst4/show/code.html b/app/templates/theme/bst4/show/code.html index 98f9019..f3e4a76 100644 --- a/app/templates/theme/bst4/show/code.html +++ b/app/templates/theme/bst4/show/code.html @@ -15,13 +15,16 @@ 分享地址 - {%if GetConfig("verify_url")=="True"%} - - {%else%} - - {%endif%} + 点击复制
+
+ + 内嵌窗口 + + + 点击复制 +
调用地址 diff --git a/app/templates/theme/bst4/show/video.html b/app/templates/theme/bst4/show/video.html index 7da0517..4e25262 100644 --- a/app/templates/theme/bst4/show/video.html +++ b/app/templates/theme/bst4/show/video.html @@ -13,13 +13,16 @@ 分享地址 - {%if GetConfig("verify_url")=="True"%} - - {%else%} - - {%endif%} + 点击复制
+
+ + 内嵌窗口 + + + 点击复制 +
调用地址 diff --git a/app/templates/theme/bst4/show/video2.html b/app/templates/theme/bst4/show/video2.html index 61a84a5..27a44bb 100644 --- a/app/templates/theme/bst4/show/video2.html +++ b/app/templates/theme/bst4/show/video2.html @@ -13,13 +13,16 @@ 分享地址 - {%if GetConfig("verify_url")=="True"%} - - {%else%} - - {%endif%} + 点击复制
+
+ + 内嵌窗口 + + + 点击复制 +
调用地址 diff --git a/app/templates/theme/bst_sketchy/show/audio.html b/app/templates/theme/bst_sketchy/show/audio.html index 7d6ef71..0f7423c 100644 --- a/app/templates/theme/bst_sketchy/show/audio.html +++ b/app/templates/theme/bst_sketchy/show/audio.html @@ -12,25 +12,37 @@
+
-
-
-
- 分享地址 -
- {%if GetConfig("verify_url")=="True"%} - - {%else%} - - {%endif%} - -
- 点击复制 -
-
+
+
+ 分享地址 +
+ + +
+ 点击复制 +
+
+
+
+
+ +
+
+
+
+ 内嵌窗口 +
+ + +
+ 点击复制
+
+
diff --git a/app/templates/theme/bst_sketchy/show/code.html b/app/templates/theme/bst_sketchy/show/code.html index de63f7a..28e7006 100644 --- a/app/templates/theme/bst_sketchy/show/code.html +++ b/app/templates/theme/bst_sketchy/show/code.html @@ -11,25 +11,37 @@
+
-
-
-
- 分享地址 -
- {%if GetConfig("verify_url")=="True"%} - - {%else%} - - {%endif%} - -
- 点击复制 -
-
+
+
+ 分享地址 +
+ + +
+ 点击复制 +
+
+
+
+
+ +
+
+
+
+ 内嵌窗口 +
+ + +
+ 点击复制
+
+
diff --git a/app/templates/theme/bst_sketchy/show/video.html b/app/templates/theme/bst_sketchy/show/video.html index 36a21c1..f534e82 100644 --- a/app/templates/theme/bst_sketchy/show/video.html +++ b/app/templates/theme/bst_sketchy/show/video.html @@ -9,25 +9,37 @@
+
-
-
-
- 分享地址 -
- {%if GetConfig("verify_url")=="True"%} - - {%else%} - - {%endif%} - -
- 点击复制 -
-
+
+
+ 分享地址 +
+ + +
+ 点击复制 +
+
+
+
+
+ +
+
+
+
+ 内嵌窗口 +
+ + +
+ 点击复制
+
+
diff --git a/app/templates/theme/bst_sketchy/show/video2.html b/app/templates/theme/bst_sketchy/show/video2.html index a168edb..be9692e 100644 --- a/app/templates/theme/bst_sketchy/show/video2.html +++ b/app/templates/theme/bst_sketchy/show/video2.html @@ -15,11 +15,7 @@
分享地址
- {%if GetConfig("verify_url")=="True"%} - - {%else%} - - {%endif%} +
点击复制 @@ -29,6 +25,23 @@
+ + +
diff --git a/app/templates/theme/layui/show/audio.html b/app/templates/theme/layui/show/audio.html index 6b4430e..0469814 100644 --- a/app/templates/theme/layui/show/audio.html +++ b/app/templates/theme/layui/show/audio.html @@ -16,11 +16,15 @@
- {%if GetConfig("verify_url")=="True"%} - - {%else%} - - {%endif%} + +
+
+
+ diff --git a/app/templates/theme/layui/show/code.html b/app/templates/theme/layui/show/code.html index ca25bca..393965d 100644 --- a/app/templates/theme/layui/show/code.html +++ b/app/templates/theme/layui/show/code.html @@ -13,11 +13,15 @@
- {%if GetConfig("verify_url")=="True"%} - - {%else%} - - {%endif%} + +
+
+
+ diff --git a/app/templates/theme/layui/show/video.html b/app/templates/theme/layui/show/video.html index 446e9fc..f4bf057 100644 --- a/app/templates/theme/layui/show/video.html +++ b/app/templates/theme/layui/show/video.html @@ -12,11 +12,15 @@
- {%if GetConfig("verify_url")=="True"%} - - {%else%} - - {%endif%} + +
+
+
+ diff --git a/app/templates/theme/layui/show/video2.html b/app/templates/theme/layui/show/video2.html index e16552f..4e1769c 100644 --- a/app/templates/theme/layui/show/video2.html +++ b/app/templates/theme/layui/show/video2.html @@ -12,11 +12,15 @@
- {%if GetConfig("verify_url")=="True"%} - - {%else%} - - {%endif%} + +
+
+
+ diff --git a/app/templates/theme/material/show/any.html b/app/templates/theme/material/show/any.html deleted file mode 100644 index be0a2a2..0000000 --- a/app/templates/theme/material/show/any.html +++ /dev/null @@ -1,5 +0,0 @@ -{%extends 'theme/'+GetConfig('theme')+'/layout.html'%} - -{%block content%} -{{content}} -{%endblock content%} diff --git a/app/templates/theme/material/show/audio.html b/app/templates/theme/material/show/audio.html index 46025bf..1adfafe 100644 --- a/app/templates/theme/material/show/audio.html +++ b/app/templates/theme/material/show/audio.html @@ -13,11 +13,11 @@
- {%if GetConfig("verify_url")=="True"%} - - {%else%} - - {%endif%} + +
+
+ +
diff --git a/app/templates/theme/material/show/code.html b/app/templates/theme/material/show/code.html index 0010d94..7de7cba 100644 --- a/app/templates/theme/material/show/code.html +++ b/app/templates/theme/material/show/code.html @@ -11,11 +11,11 @@
- {%if GetConfig("verify_url")=="True"%} - - {%else%} - - {%endif%} + +
+
+ +
diff --git a/app/templates/theme/material/show/image.html b/app/templates/theme/material/show/image.html index 6530d83..015ebfa 100644 --- a/app/templates/theme/material/show/image.html +++ b/app/templates/theme/material/show/image.html @@ -7,11 +7,7 @@
- {%if GetConfig("verify_url")=="True"%} - - {%else%} - - {%endif%} +
diff --git a/app/templates/theme/material/show/video.html b/app/templates/theme/material/show/video.html index 8ac1a3f..311f9e7 100644 --- a/app/templates/theme/material/show/video.html +++ b/app/templates/theme/material/show/video.html @@ -10,11 +10,11 @@
- {%if GetConfig("verify_url")=="True"%} - - {%else%} - - {%endif%} + +
+
+ +
diff --git a/app/templates/theme/material/show/video2.html b/app/templates/theme/material/show/video2.html index c7cde5f..9041474 100644 --- a/app/templates/theme/material/show/video2.html +++ b/app/templates/theme/material/show/video2.html @@ -11,16 +11,17 @@
- {%if GetConfig("verify_url")=="True"%} - - {%else%} - - {%endif%} + +
+
+ +
+