mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-12 14:15:22 +03:00
fixup auth mode check
This commit is contained in:
parent
9128d1f1d9
commit
c226279016
@ -21,7 +21,7 @@ from frigate.api.export import ExportBp
|
|||||||
from frigate.api.media import MediaBp
|
from frigate.api.media import MediaBp
|
||||||
from frigate.api.preview import PreviewBp
|
from frigate.api.preview import PreviewBp
|
||||||
from frigate.api.review import ReviewBp
|
from frigate.api.review import ReviewBp
|
||||||
from frigate.config import AuthModeEnum, FrigateConfig
|
from frigate.config import FrigateConfig
|
||||||
from frigate.const import CONFIG_DIR
|
from frigate.const import CONFIG_DIR
|
||||||
from frigate.events.external import ExternalEventProcessor
|
from frigate.events.external import ExternalEventProcessor
|
||||||
from frigate.models import Event, Timeline
|
from frigate.models import Event, Timeline
|
||||||
@ -86,9 +86,7 @@ def create_app(
|
|||||||
app.plus_api = plus_api
|
app.plus_api = plus_api
|
||||||
app.camera_error_image = None
|
app.camera_error_image = None
|
||||||
app.stats_emitter = stats_emitter
|
app.stats_emitter = stats_emitter
|
||||||
app.jwt_token = (
|
app.jwt_token = get_jwt_secret() if frigate_config.auth.enabled else None
|
||||||
get_jwt_secret() if frigate_config.auth.mode == AuthModeEnum.native else None
|
|
||||||
)
|
|
||||||
# update the request_address with the x-forwarded-for header from nginx
|
# update the request_address with the x-forwarded-for header from nginx
|
||||||
app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1)
|
app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1)
|
||||||
# initialize the rate limiter for the login endpoint
|
# initialize the rate limiter for the login endpoint
|
||||||
|
|||||||
@ -27,7 +27,7 @@ from frigate.comms.dispatcher import Communicator, Dispatcher
|
|||||||
from frigate.comms.inter_process import InterProcessCommunicator
|
from frigate.comms.inter_process import InterProcessCommunicator
|
||||||
from frigate.comms.mqtt import MqttClient
|
from frigate.comms.mqtt import MqttClient
|
||||||
from frigate.comms.ws import WebSocketClient
|
from frigate.comms.ws import WebSocketClient
|
||||||
from frigate.config import AuthModeEnum, FrigateConfig
|
from frigate.config import FrigateConfig
|
||||||
from frigate.const import (
|
from frigate.const import (
|
||||||
CACHE_DIR,
|
CACHE_DIR,
|
||||||
CLIPS_DIR,
|
CLIPS_DIR,
|
||||||
@ -593,7 +593,7 @@ class FrigateApp:
|
|||||||
)
|
)
|
||||||
|
|
||||||
def init_auth(self) -> None:
|
def init_auth(self) -> None:
|
||||||
if self.config.auth.mode == AuthModeEnum.native:
|
if self.config.auth.enabled:
|
||||||
if User.select().count() == 0:
|
if User.select().count() == 0:
|
||||||
password = secrets.token_hex(16)
|
password = secrets.token_hex(16)
|
||||||
password_hash = hash_password(
|
password_hash = hash_password(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user