mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-11-21 23:41:01 +00:00
Accept a regex for require api key origin
This commit is contained in:
parent
bf79912d2c
commit
94ab47c81d
1 changed files with 2 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
import io
|
||||
import os
|
||||
import tempfile
|
||||
import re
|
||||
import uuid
|
||||
from functools import wraps
|
||||
from html import unescape
|
||||
|
@ -236,7 +237,7 @@ def create_app(args):
|
|||
elif (
|
||||
args.require_api_key_origin
|
||||
and api_keys_db.lookup(ak) is None
|
||||
and request.headers.get("Origin") != args.require_api_key_origin
|
||||
and not re.match(args.require_api_key_origin, request.headers.get("Origin"))
|
||||
):
|
||||
description = _("Please contact the server operator to get an API key")
|
||||
if args.get_api_key_link:
|
||||
|
|
Loading…
Reference in a new issue