提交 ed5ff1ef 编写于 作者: H hjdhnx

增加了自定义文件路由

上级 f2c8e4e7
......@@ -111,6 +111,20 @@ def get_files(name):
response.headers['Content-Disposition'] = f'attachment;filename="{filename}"'
return response
@home.route('/txt/<name>')
def get_txt_files(name):
base_path = 'txt'
os.makedirs(base_path,exist_ok=True)
file_path = os.path.join(base_path, f'{name}')
if not os.path.exists(file_path):
return R.failed(f'{file_path}文件不存在')
with open(file_path, mode='r',encoding='utf-8') as f:
file_byte = f.read()
response = make_response(file_byte)
response.headers['Content-Type'] = 'text/plain; charset=utf-8'
return response
@home.route('/lives')
def get_lives():
......
......@@ -49,7 +49,7 @@
###### 2022/09/08
- [X] 1.升级到3.2.9,支持自动合并自定义用户配置(内置t4测试源)
- [X] 7.升级到3.3.0,增加奇珍异兽源
- [X] 7.升级到3.3.2,增加自定义本地文件路由: {{ host }}/files/文件名 比如 {{ host }}/files/custom_spider.jar
- [X] 7.升级到3.3.2,增加自定义本地文件路由: {{ host }}/files/文件名和{{ host }}/txt/文件名 比如 {{ host }}/files/custom_spider.jar
###### 2022/09/07
- [X] 1.优化后台管理登录界面,升级更新脚本
- [X] 2.增加了镜像合并脚本(三合一直接拉 hjdhnx/drpy 即可)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册