From ae76d7efb4322c4decc93b54fa2f214276a156c4 Mon Sep 17 00:00:00 2001 From: jdu9 Date: Wed, 31 Mar 2021 17:57:02 +0200 Subject: [PATCH] Add LibreJS support --- app/app.py | 7 ++++++- app/templates/index.html | 8 ++++++-- app/templates/javascript-licenses.html | 22 ++++++++++++++++++++++ 3 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 app/templates/javascript-licenses.html diff --git a/app/app.py b/app/app.py index 8ac8e7c..96a1c14 100644 --- a/app/app.py +++ b/app/app.py @@ -43,7 +43,7 @@ def get_routes_limits(default_req_limit, api_keys_db): req_limit = db_req_limit return "%s per minute" % req_limit - + return [limits] def create_app(args): @@ -102,6 +102,11 @@ def create_app(args): def index(): return render_template('index.html', gaId=args.ga_id, frontendTimeout=args.frontend_timeout, offline=args.offline, api_keys=args.api_keys, web_version=os.environ.get('LT_WEB') is not None) + @app.route("/javascript-licenses", methods=['GET']) + @limiter.exempt + def javascript_licenses(): + return render_template('javascript-licenses.html', offline=args.offline) + @app.route("/languages", methods=['GET', 'POST']) @limiter.exempt def langs(): diff --git a/app/templates/index.html b/app/templates/index.html index eaedc1f..163e8f8 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -229,7 +229,8 @@

Made with ❤ by UAV4GEO and powered by Argos Translate

-

License: AGPLv3

+

License: AGPLv3

+

JavaScript license information

{% if web_version %}

The public API on libretranslate.com should be used for testing, personal or infrequent use. If you're going to run an application in production, please host your own server or get in touch to obtain an API key. @@ -255,13 +256,16 @@ diff --git a/app/templates/javascript-licenses.html b/app/templates/javascript-licenses.html new file mode 100644 index 0000000..37f1a88 --- /dev/null +++ b/app/templates/javascript-licenses.html @@ -0,0 +1,22 @@ + + + jslicense-labels1 for LibreTranslate + + +

Weblabels

+ + + + + + + + + + + + + +
Vue.jsExpat
prism.min.jsExpat
materialize.min.jsExpat
+ + \ No newline at end of file