Kommandozeilenparameter für Adminzugang eingefügt
This commit is contained in:
parent
859d55c99a
commit
4def6c50fa
2
admin.py
2
admin.py
@ -615,7 +615,7 @@ Dies kann nicht rückgängig gemacht werden!''')
|
|||||||
output_dict["photos_on_touchscreen"] = photo_switch.value
|
output_dict["photos_on_touchscreen"] = photo_switch.value
|
||||||
output_dict["holidays"] = data["holidays"]
|
output_dict["holidays"] = data["holidays"]
|
||||||
json_dict = json.dumps(output_dict, indent=4)
|
json_dict = json.dumps(output_dict, indent=4)
|
||||||
with open(f"{scriptpath}/{usersettingsfilename}", "w") as outputfile:
|
with open(os.path.join(scriptpath, usersettingsfilename), "w") as outputfile:
|
||||||
outputfile.write(json_dict)
|
outputfile.write(json_dict)
|
||||||
if int(old_port) != int(port.value):
|
if int(old_port) != int(port.value):
|
||||||
with ui.dialog() as dialog, ui.card():
|
with ui.dialog() as dialog, ui.card():
|
||||||
|
53
main.py
53
main.py
@ -10,6 +10,18 @@ from api import *
|
|||||||
from homepage import *
|
from homepage import *
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
import argparse
|
||||||
|
|
||||||
|
from web_ui import hash_password
|
||||||
|
|
||||||
|
|
||||||
|
class Commandline_Header:
|
||||||
|
message_string = f"{app_title} {app_version}"
|
||||||
|
underline = ""
|
||||||
|
for i in range(len(message_string)):
|
||||||
|
underline += "-"
|
||||||
|
print(message_string)
|
||||||
|
print(underline)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
@ -24,12 +36,7 @@ def main():
|
|||||||
|
|
||||||
def startup_message():
|
def startup_message():
|
||||||
|
|
||||||
message_string = f"{app_title} {app_version}"
|
Commandline_Header()
|
||||||
underline = ""
|
|
||||||
for i in range(len(message_string)):
|
|
||||||
underline += "-"
|
|
||||||
print(message_string)
|
|
||||||
print(underline)
|
|
||||||
|
|
||||||
url_string = ""
|
url_string = ""
|
||||||
for i in list(app.urls):
|
for i in list(app.urls):
|
||||||
@ -41,4 +48,38 @@ def main():
|
|||||||
ui.run(favicon="favicon.svg", port=port, storage_secret=secret, language='de-DE', show_welcome_message=False)
|
ui.run(favicon="favicon.svg", port=port, storage_secret=secret, language='de-DE', show_welcome_message=False)
|
||||||
|
|
||||||
if __name__ in ("__main__", "__mp_main__"):
|
if __name__ in ("__main__", "__mp_main__"):
|
||||||
|
parser = argparse.ArgumentParser(description=f'{app_title} {app_version}')
|
||||||
|
parser.add_argument('--admin-access', help='Zugangsdaten für Administrator einstellen', action="store_true")
|
||||||
|
args = parser.parse_args()
|
||||||
|
if args.admin_access:
|
||||||
|
Commandline_Header()
|
||||||
|
print("Lade Administrationseinstellungen")
|
||||||
|
admin_settings = load_adminsettings()
|
||||||
|
print("Geben Sie den neuen Benutzernamen für den Administrationsbenutzer an:")
|
||||||
|
admin_user = input()
|
||||||
|
if admin_user == "":
|
||||||
|
print("Ungültiger Benutzername. Breche ab.")
|
||||||
|
quit()
|
||||||
|
print("Geben Sie das neue Passwort für den Administrationsbenutzer ein:")
|
||||||
|
admin_password = input()
|
||||||
|
if admin_password == "":
|
||||||
|
print("Ungültiges Passwort. Breche ab.")
|
||||||
|
quit()
|
||||||
|
print("Sie haben folgende Informationen eingegeben.")
|
||||||
|
print(f"Benutzername: {admin_user}")
|
||||||
|
print(f"Passwort: {admin_password}")
|
||||||
|
print("Sollen diese Einstellungen übernommen werden? j=Ja")
|
||||||
|
question = input()
|
||||||
|
if question == "j":
|
||||||
|
admin_settings["admin_user"] = admin_user
|
||||||
|
admin_settings["admin_password"] = hash_password(admin_password)
|
||||||
|
json_dict = json.dumps(admin_settings, indent=4)
|
||||||
|
with open(os.path.join(scriptpath, usersettingsfilename), "w") as outputfile:
|
||||||
|
outputfile.write(json_dict)
|
||||||
|
print("Daten geschrieben")
|
||||||
|
quit()
|
||||||
|
else:
|
||||||
|
print("Breche ab.")
|
||||||
|
quit()
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
"secret": "ftgzuhjikg,mt5jn46uzer8sfi9okrmtzjhndfierko5zltjhdgise",
|
"secret": "ftgzuhjikg,mt5jn46uzer8sfi9okrmtzjhndfierko5zltjhdgise",
|
||||||
"times_on_touchscreen": true,
|
"times_on_touchscreen": true,
|
||||||
"photos_on_touchscreen": true,
|
"photos_on_touchscreen": true,
|
||||||
"button_height": 300,
|
|
||||||
"picture_height": 200,
|
"picture_height": 200,
|
||||||
|
"button_height": 300,
|
||||||
"holidays": {
|
"holidays": {
|
||||||
"2025-01-01": "Neujahr",
|
"2025-01-01": "Neujahr",
|
||||||
"2025-04-18": "Karfreitag",
|
"2025-04-18": "Karfreitag",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user