From dd790885e053618f1a5e74ce8b844adff79fd4e9 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Mon, 21 Dec 2020 11:09:23 -0500 Subject: [PATCH 1/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fc2a8bd..3b2d513 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [Try it online!](https://libretranslate.com) | [API Docs](https://libretranslate.com/docs) -Free and Open Source Translation API, entirely self-hosted and works even in offline environments. Unlike other APIs, it doesn't rely on proprietary providers such as Google or Azure to perform translations. +Free and Open Source Machine Translation API, entirely self-hosted and works even in offline environments. Unlike other APIs, it doesn't rely on proprietary providers such as Google or Azure to perform translations. ![image](https://user-images.githubusercontent.com/1951843/102724116-32a6df00-42db-11eb-8cc0-129ab39cdfb5.png) From d9a1a142878780b1a12826f9975c10693b51387d Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Mon, 21 Dec 2020 11:10:44 -0500 Subject: [PATCH 2/3] Add machine word --- app/templates/index.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/templates/index.html b/app/templates/index.html index ae44129..7567e9a 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -3,15 +3,15 @@ - LibreTranslate - Free and Open Source Translation API - + LibreTranslate - Free and Open Source Machine Translation API + - + - + @@ -210,7 +210,7 @@
LibreTranslate
-

Free and Open Source Translation API

+

Free and Open Source Machine Translation API

Made with ❤ by UAV4GEO and powered by Argos Translate

From 51adc564bb2aa0c60d6d9a14b2506d8601dcf50e Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Mon, 21 Dec 2020 11:16:49 -0500 Subject: [PATCH 3/3] Rate limit behind proxy --- app/app.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/app.py b/app/app.py index 57b208e..9dc5fc4 100644 --- a/app/app.py +++ b/app/app.py @@ -1,8 +1,14 @@ from flask import Flask, render_template, jsonify, request, abort, send_from_directory from flask_swagger import swagger from flask_swagger_ui import get_swaggerui_blueprint -from flask_limiter.util import get_remote_address +def get_remote_address(): + if request.headers.getlist("X-Forwarded-For"): + ip = request.headers.getlist("X-Forwarded-For")[0] + else: + ip = request.remote_addr or '127.0.0.1' + + return ip def create_app(char_limit=-1, req_limit=-1, ga_id=None, debug=False): from app.init import boot