mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-11-28 19:01:02 +00:00
Merge pull request #232 from dingedi/feature/upgrade-to-flask2
Upgrade to flask 2
This commit is contained in:
commit
c19823344c
2 changed files with 12 additions and 11 deletions
12
app/app.py
12
app/app.py
|
@ -231,7 +231,7 @@ def create_app(args):
|
|||
version=get_version()
|
||||
)
|
||||
|
||||
@app.route("/javascript-licenses", methods=["GET"])
|
||||
@app.get("/javascript-licenses")
|
||||
@limiter.exempt
|
||||
def javascript_licenses():
|
||||
if args.disable_web_ui:
|
||||
|
@ -287,7 +287,7 @@ def create_app(args):
|
|||
response.headers.add("Access-Control-Max-Age", 60 * 60 * 24 * 20)
|
||||
return response
|
||||
|
||||
@app.route("/translate", methods=["POST"])
|
||||
@app.post("/translate")
|
||||
@access_check
|
||||
def translate():
|
||||
"""
|
||||
|
@ -523,7 +523,7 @@ def create_app(args):
|
|||
except Exception as e:
|
||||
abort(500, description="Cannot translate text: %s" % str(e))
|
||||
|
||||
@app.route("/translate_file", methods=["POST"])
|
||||
@app.post("/translate_file")
|
||||
@access_check
|
||||
def translate_file():
|
||||
"""
|
||||
|
@ -656,7 +656,7 @@ def create_app(args):
|
|||
except Exception as e:
|
||||
abort(500, description=e)
|
||||
|
||||
@app.route("/download_file/<string:filename>", methods=["GET"])
|
||||
@app.get("/download_file/<string:filename>")
|
||||
def download_file(filename: str):
|
||||
"""
|
||||
Download a translated file
|
||||
|
@ -683,7 +683,7 @@ def create_app(args):
|
|||
|
||||
return send_file(return_data, as_attachment=True, attachment_filename=download_filename)
|
||||
|
||||
@app.route("/detect", methods=["POST"])
|
||||
@app.post("/detect")
|
||||
@access_check
|
||||
def detect():
|
||||
"""
|
||||
|
@ -856,7 +856,7 @@ def create_app(args):
|
|||
}
|
||||
)
|
||||
|
||||
@app.route("/suggest", methods=["POST"])
|
||||
@app.post("/suggest")
|
||||
@access_check
|
||||
def suggest():
|
||||
"""
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
argostranslate==1.6.1
|
||||
Flask==1.1.2
|
||||
Flask==2.0.3
|
||||
flask-swagger==0.2.14
|
||||
flask-swagger-ui==3.36.0
|
||||
Flask-Limiter==1.4
|
||||
waitress==1.4.4
|
||||
Flask-Limiter==2.2.0
|
||||
waitress==2.1.1
|
||||
expiringdict==1.2.1
|
||||
pyicu>=2.8
|
||||
pycld2==0.41
|
||||
morfessor==2.0.6
|
||||
polyglot==16.7.4
|
||||
appdirs==1.4.4
|
||||
APScheduler==3.7.0
|
||||
APScheduler==3.9.1
|
||||
translatehtml==1.5.2
|
||||
argos-translate-files==1.0.5
|
||||
itsdangerous==2.0.1
|
||||
itsdangerous==2.1.2
|
||||
Werkzeug==2.0.3
|
||||
|
|
Loading…
Reference in a new issue