Make webui login optional.

Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
This commit is contained in:
Jeroen Oudshoorn
2025-01-03 12:04:17 +01:00
parent 9ea6728a26
commit 27c8a113de
2 changed files with 11 additions and 7 deletions

View File

@ -158,8 +158,9 @@ ui.faces.position_y = 34
ui.web.enabled = true ui.web.enabled = true
ui.web.address = "::" # listening on both ipv4 and ipv6 - switch to 0.0.0.0 to listen on just ipv4 ui.web.address = "::" # listening on both ipv4 and ipv6 - switch to 0.0.0.0 to listen on just ipv4
ui.web.username = "changeme" ui.web.auth = false
ui.web.password = "changeme" ui.web.username = "changeme" # if auth is true
ui.web.password = "changeme" # if auth is true
ui.web.origin = "" ui.web.origin = ""
ui.web.port = 8080 ui.web.port = 8080
ui.web.on_frame = "" ui.web.on_frame = ""

View File

@ -64,6 +64,9 @@ class Handler:
def with_auth(self, f): def with_auth(self, f):
@wraps(f) @wraps(f)
def wrapper(*args, **kwargs): def wrapper(*args, **kwargs):
if not self._config['auth']:
return f(*args, **kwargs)
else:
auth = request.authorization auth = request.authorization
if not auth or not auth.username or not auth.password or not self._check_creds(auth.username, if not auth or not auth.username or not auth.password or not self._check_creds(auth.username,
auth.password): auth.password):