Accept a regex for require api key origin

This commit is contained in:
Piero Toffanin 2023-01-23 16:15:23 -05:00
parent bf79912d2c
commit 94ab47c81d

View file

@ -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: