mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2025-05-16 15:03:03 +00:00
Add --disable-web-ui
This commit is contained in:
parent
f75a294aa0
commit
6b18b23b46
4 changed files with 36 additions and 21 deletions
|
@ -209,6 +209,9 @@ def create_app(args):
|
|||
@app.route("/")
|
||||
@limiter.exempt
|
||||
def index():
|
||||
if args.disable_web_ui:
|
||||
abort(404)
|
||||
|
||||
return render_template(
|
||||
"index.html",
|
||||
gaId=args.ga_id,
|
||||
|
@ -221,6 +224,9 @@ def create_app(args):
|
|||
@app.route("/javascript-licenses", methods=["GET"])
|
||||
@limiter.exempt
|
||||
def javascript_licenses():
|
||||
if args.disable_web_ui:
|
||||
abort(404)
|
||||
|
||||
return render_template("javascript-licenses.html")
|
||||
|
||||
@app.route("/languages", methods=["GET", "POST"])
|
||||
|
|
|
@ -19,7 +19,7 @@ def _get_value_bool(name, default_value):
|
|||
if env_value in ['TRUE', 'True', 'true', '1']:
|
||||
return True
|
||||
return default_value
|
||||
|
||||
|
||||
def _get_value(name, default_value, value_type):
|
||||
env_name = _prefix + name
|
||||
if value_type == 'str':
|
||||
|
@ -75,7 +75,7 @@ _default_options_objects = [
|
|||
'name': 'DEBUG',
|
||||
'default_value': False,
|
||||
'value_type': 'bool'
|
||||
},
|
||||
},
|
||||
{
|
||||
'name': 'SSL',
|
||||
'default_value': None,
|
||||
|
@ -120,7 +120,12 @@ _default_options_objects = [
|
|||
'name': 'DISABLE_FILES_TRANSLATION',
|
||||
'default_value': False,
|
||||
'value_type': 'bool'
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'DISABLE_WEB_UI',
|
||||
'default_value': False,
|
||||
'value_type': 'bool'
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -108,6 +108,9 @@ def main():
|
|||
parser.add_argument(
|
||||
"--disable-files-translation", default=DEFARGS['DISABLE_FILES_TRANSLATION'], action="store_true", help="Disable files translation"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--disable-web-ui", default=DEFARGS['DISABLE_WEB_UI'], action="store_true", help="Disable web ui"
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
app = create_app(args)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue