|
@@ -10,6 +10,7 @@ from flask import Flask, jsonify, request, current_app, send_from_directory, Res
|
|
from flask_cors import CORS
|
|
from flask_cors import CORS
|
|
from requests_toolbelt import MultipartEncoder
|
|
from requests_toolbelt import MultipartEncoder
|
|
|
|
|
|
|
|
+import config
|
|
from config import file_type_map, TARGET_URL
|
|
from config import file_type_map, TARGET_URL
|
|
from tools.file_manager import get_file_md5
|
|
from tools.file_manager import get_file_md5
|
|
from tools.logger_handle import logger
|
|
from tools.logger_handle import logger
|
|
@@ -69,7 +70,7 @@ def proxy(path):
|
|
for key, value in request.form.items():
|
|
for key, value in request.form.items():
|
|
fields[key] = value
|
|
fields[key] = value
|
|
|
|
|
|
- # 添加文件字段
|
|
|
|
|
|
+ # 添加文件字段
|
|
for key, file in request.files.items():
|
|
for key, file in request.files.items():
|
|
fields[key] = (file.filename, file.stream, file.mimetype)
|
|
fields[key] = (file.filename, file.stream, file.mimetype)
|
|
|
|
|
|
@@ -216,7 +217,8 @@ def update_local_file():
|
|
file_name = request.get_json()['file_name']
|
|
file_name = request.get_json()['file_name']
|
|
|
|
|
|
try:
|
|
try:
|
|
- metadata = current_app.config['serve_client'].load_metadata(os.path.join(current_app.config['work_path'], file_name))
|
|
|
|
|
|
+ metadata = current_app.config['serve_client'].load_metadata(
|
|
|
|
+ os.path.join(current_app.config['work_path'], file_name))
|
|
|
|
|
|
os.remove(os.path.join(current_app.config['work_path'], file_name))
|
|
os.remove(os.path.join(current_app.config['work_path'], file_name))
|
|
os.remove(os.path.join(current_app.config['work_path'], file_name + '.metadata'))
|
|
os.remove(os.path.join(current_app.config['work_path'], file_name + '.metadata'))
|
|
@@ -251,7 +253,8 @@ def file_state_list():
|
|
if not os.path.exists(os.path.join(current_app.config['work_path'], file_name + '.metadata')):
|
|
if not os.path.exists(os.path.join(current_app.config['work_path'], file_name + '.metadata')):
|
|
continue
|
|
continue
|
|
|
|
|
|
- metadata = current_app.config['serve_client'].load_metadata(os.path.join(current_app.config['work_path'], file_name))
|
|
|
|
|
|
+ metadata = current_app.config['serve_client'].load_metadata(
|
|
|
|
+ os.path.join(current_app.config['work_path'], file_name))
|
|
file_info = {
|
|
file_info = {
|
|
'file_name': file_name,
|
|
'file_name': file_name,
|
|
'show_name': metadata['file_name'],
|
|
'show_name': metadata['file_name'],
|
|
@@ -354,6 +357,13 @@ def refresh_token():
|
|
return jsonify(app.config['serve_client'].login_reply)
|
|
return jsonify(app.config['serve_client'].login_reply)
|
|
|
|
|
|
|
|
|
|
|
|
+@logger.catch()
|
|
|
|
+@app.route('/get_yozo_path', methods=['POST'])
|
|
|
|
+def get_yozo_path():
|
|
|
|
+ yozo_path = os.path.basename(os.path.basename(config.yozoc))
|
|
|
|
+ return jsonify({'code': 1000, 'msg': '操作成功', 'data': yozo_path})
|
|
|
|
+
|
|
|
|
+
|
|
@logger.catch()
|
|
@logger.catch()
|
|
@app.route('/download_cloud_file', methods=['POST'])
|
|
@app.route('/download_cloud_file', methods=['POST'])
|
|
def download_cloud_file():
|
|
def download_cloud_file():
|