Merge pull request #164 from fushinari/suggest-req-key

Require API key for submitting suggestions
This commit is contained in:
Piero Toffanin 2021-10-31 12:19:37 -04:00 committed by GitHub
commit 922ba5de40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -811,7 +811,7 @@ def create_app(args):
) )
@app.route("/suggest", methods=["POST"]) @app.route("/suggest", methods=["POST"])
@limiter.exempt @access_check
def suggest(): def suggest():
""" """
Submit a suggestion to improve a translation Submit a suggestion to improve a translation

View file

@ -290,6 +290,7 @@ document.addEventListener('DOMContentLoaded', function(){
data.append("s", self.translatedText); data.append("s", self.translatedText);
data.append("source", self.sourceLang); data.append("source", self.sourceLang);
data.append("target", self.targetLang); data.append("target", self.targetLang);
data.append("api_key", localStorage.getItem("api_key") || "");
request.open('POST', BaseUrl + '/suggest', true); request.open('POST', BaseUrl + '/suggest', true);
request.onload = function() { request.onload = function() {