diff options
author | Maxim Devaev <[email protected]> | 2022-03-26 00:54:16 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2022-03-26 00:54:16 +0300 |
commit | 3a878baac812958fd27ca5d82ef4bb4463de4654 (patch) | |
tree | 20b91c821e03e9df108ac29a0b9bad632ac441c1 /kvmd | |
parent | ed23fef5121f8f71b47b3e6aefe409a7e36fd9a7 (diff) |
hide logout botton when auth is disabled
Diffstat (limited to 'kvmd')
-rw-r--r-- | kvmd/apps/kvmd/info/__init__.py | 2 | ||||
-rw-r--r-- | kvmd/apps/kvmd/info/auth.py | 34 |
2 files changed, 36 insertions, 0 deletions
diff --git a/kvmd/apps/kvmd/info/__init__.py b/kvmd/apps/kvmd/info/__init__.py index 53a02f88..f8871d72 100644 --- a/kvmd/apps/kvmd/info/__init__.py +++ b/kvmd/apps/kvmd/info/__init__.py @@ -25,6 +25,7 @@ from typing import Set from ....yamlconf import Section from .base import BaseInfoSubmanager +from .auth import AuthInfoSubmanager from .system import SystemInfoSubmanager from .meta import MetaInfoSubmanager from .extras import ExtrasInfoSubmanager @@ -37,6 +38,7 @@ class InfoManager: def __init__(self, config: Section) -> None: self.__subs = { "system": SystemInfoSubmanager(config.kvmd.streamer.cmd), + "auth": AuthInfoSubmanager(config.kvmd.auth.enabled), "meta": MetaInfoSubmanager(config.kvmd.info.meta), "extras": ExtrasInfoSubmanager(config), "hw": HwInfoSubmanager(**config.kvmd.info.hw._unpack()), diff --git a/kvmd/apps/kvmd/info/auth.py b/kvmd/apps/kvmd/info/auth.py new file mode 100644 index 00000000..bf1c6160 --- /dev/null +++ b/kvmd/apps/kvmd/info/auth.py @@ -0,0 +1,34 @@ +# ========================================================================== # +# # +# KVMD - The main PiKVM daemon. # +# # +# Copyright (C) 2018-2022 Maxim Devaev <[email protected]> # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see <https://www.gnu.org/licenses/>. # +# # +# ========================================================================== # + + +from typing import Dict + +from .base import BaseInfoSubmanager + + +# ===== +class AuthInfoSubmanager(BaseInfoSubmanager): + def __init__(self, enabled: bool) -> None: + self.__enabled = enabled + + async def get_state(self) -> Dict: + return {"enabled": self.__enabled} |