diff --git a/app/app.py b/app/app.py index f63348a..44e21c1 100644 --- a/app/app.py +++ b/app/app.py @@ -592,6 +592,7 @@ def create_app(args): { "charLimit": args.char_limit, "frontendTimeout": args.frontend_timeout, + "suggestions": args.suggestions, "language": { "source": { "code": frontend_argos_language_source.code, @@ -618,6 +619,9 @@ def create_app(args): @app.route("/suggest", methods=["POST"]) @limiter.exempt def suggest(): + if args.suggestions is False: + abort(404) + q = request.values.get("q") s = request.values.get("s") source_lang = request.values.get("source") diff --git a/app/default_values.py b/app/default_values.py index 2538a0e..d41843a 100644 --- a/app/default_values.py +++ b/app/default_values.py @@ -110,6 +110,11 @@ _default_options_objects = [ 'name': 'LOAD_ONLY', 'default_value': None, 'value_type': 'str' + }, + { + 'name': 'SUGGESTIONS', + 'default_value': False, + 'value_type': 'bool' } ] diff --git a/app/main.py b/app/main.py index d9b5b44..ffaef87 100644 --- a/app/main.py +++ b/app/main.py @@ -102,6 +102,9 @@ def main(): metavar="", help="Set available languages (ar,de,en,es,fr,ga,hi,it,ja,ko,pt,ru,zh)", ) + parser.add_argument( + "--suggestions", default=DEFARGS['SUGGESTIONS'], action="store_true", help="Allow user suggestions" + ) args = parser.parse_args() app = create_app(args) diff --git a/app/templates/index.html b/app/templates/index.html index 404c47e..4ca063f 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -148,15 +148,15 @@ - +
- - -