ReqKey check

This commit is contained in:
Piero Toffanin 2021-09-08 16:14:39 -04:00
parent 94f4f74892
commit 5c3cf0a392
2 changed files with 3 additions and 2 deletions

View file

@ -137,7 +137,7 @@ def create_app(args):
ak = request.values.get("api_key")
if (
api_keys_db.lookup(ak) is None and request.headers.get("Origin") != args.require_api_key_origin
api_keys_db.lookup(ak) is None and (request.headers.get("Origin") != args.require_api_key_origin or (args.require_api_key_origin and request.headers.get("ReqKey") != "1"))
):
abort(
403,

View file

@ -428,6 +428,7 @@
data.append("api_key", localStorage.getItem("api_key") || "");
request.open('POST', BaseUrl + '/translate', true);
request.setRequestHeader("ReqKey", "1");
request.onload = function() {
try{