forked from mirrors/LibreTranslate
download work
This commit is contained in:
parent
f0d6c92db7
commit
4f0d19dbc4
1 changed files with 5 additions and 3 deletions
|
@ -6,7 +6,7 @@ from functools import wraps
|
||||||
import argostranslatefiles
|
import argostranslatefiles
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
from argostranslatefiles import get_supported_formats
|
from argostranslatefiles import get_supported_formats
|
||||||
from flask import Flask, abort, jsonify, render_template, request, url_for
|
from flask import Flask, abort, jsonify, render_template, request, url_for, send_from_directory
|
||||||
from flask_swagger import swagger
|
from flask_swagger import swagger
|
||||||
from flask_swagger_ui import get_swaggerui_blueprint
|
from flask_swagger_ui import get_swaggerui_blueprint
|
||||||
from translatehtml import translate_html
|
from translatehtml import translate_html
|
||||||
|
@ -601,11 +601,13 @@ def create_app(args):
|
||||||
|
|
||||||
@app.route("/download_file/<string:filename>", methods=["GET"])
|
@app.route("/download_file/<string:filename>", methods=["GET"])
|
||||||
@access_check
|
@access_check
|
||||||
def download_file(filename):
|
def download_file(filename: str):
|
||||||
"""
|
"""
|
||||||
Download a translated file
|
Download a translated file
|
||||||
"""
|
"""
|
||||||
print('')
|
filename.split('.').pop(0)
|
||||||
|
|
||||||
|
return send_from_directory(directory=tempfile.gettempdir(), filename=filename)
|
||||||
|
|
||||||
@app.route("/detect", methods=["POST"])
|
@app.route("/detect", methods=["POST"])
|
||||||
@access_check
|
@access_check
|
||||||
|
|
Loading…
Reference in a new issue