mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-11-25 17:31:00 +00:00
disable routes
This commit is contained in:
parent
bbc1d61836
commit
909deccd3f
1 changed files with 9 additions and 1 deletions
10
app/app.py
10
app/app.py
|
@ -560,6 +560,9 @@ def create_app(args):
|
||||||
type: string
|
type: string
|
||||||
description: Error message
|
description: Error message
|
||||||
"""
|
"""
|
||||||
|
if args.disable_files_translation:
|
||||||
|
abort(403, description="Files translation are disabled on this server.")
|
||||||
|
|
||||||
source_lang = request.form.get("source")
|
source_lang = request.form.get("source")
|
||||||
target_lang = request.form.get("target")
|
target_lang = request.form.get("target")
|
||||||
file = request.files['file']
|
file = request.files['file']
|
||||||
|
@ -612,6 +615,10 @@ def create_app(args):
|
||||||
"""
|
"""
|
||||||
Download a translated file
|
Download a translated file
|
||||||
"""
|
"""
|
||||||
|
if args.disable_files_translation:
|
||||||
|
abort(403, description="Files translation are disabled on this server.")
|
||||||
|
|
||||||
|
|
||||||
filepath = os.path.join(get_upload_dir(), filename)
|
filepath = os.path.join(get_upload_dir(), filename)
|
||||||
|
|
||||||
return_data = io.BytesIO()
|
return_data = io.BytesIO()
|
||||||
|
@ -775,7 +782,8 @@ def create_app(args):
|
||||||
"charLimit": args.char_limit,
|
"charLimit": args.char_limit,
|
||||||
"frontendTimeout": args.frontend_timeout,
|
"frontendTimeout": args.frontend_timeout,
|
||||||
"suggestions": args.suggestions,
|
"suggestions": args.suggestions,
|
||||||
"supportedFilesFormat": frontend_argos_supported_files_format,
|
"filesTranslation": not args.disable_files_translation,
|
||||||
|
"supportedFilesFormat": [] if args.disable_files_translation else frontend_argos_supported_files_format,
|
||||||
"language": {
|
"language": {
|
||||||
"source": {
|
"source": {
|
||||||
"code": frontend_argos_language_source.code,
|
"code": frontend_argos_language_source.code,
|
||||||
|
|
Loading…
Reference in a new issue