mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-09-12 07:30:16 +02:00
ReqKey check
This commit is contained in:
parent
94f4f74892
commit
5c3cf0a392
@ -135,9 +135,9 @@ def create_app(args):
|
|||||||
ak = json.get("api_key")
|
ak = json.get("api_key")
|
||||||
else:
|
else:
|
||||||
ak = request.values.get("api_key")
|
ak = request.values.get("api_key")
|
||||||
|
|
||||||
if (
|
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(
|
abort(
|
||||||
403,
|
403,
|
||||||
|
@ -428,6 +428,7 @@
|
|||||||
data.append("api_key", localStorage.getItem("api_key") || "");
|
data.append("api_key", localStorage.getItem("api_key") || "");
|
||||||
|
|
||||||
request.open('POST', BaseUrl + '/translate', true);
|
request.open('POST', BaseUrl + '/translate', true);
|
||||||
|
request.setRequestHeader("ReqKey", "1");
|
||||||
|
|
||||||
request.onload = function() {
|
request.onload = function() {
|
||||||
try{
|
try{
|
||||||
|
Loading…
Reference in New Issue
Block a user