130 lines
5.8 KiB
Python
130 lines
5.8 KiB
Python
# Zeiterfassung
|
|
# Quasi-Konstanten
|
|
|
|
import os
|
|
from pathlib import Path
|
|
import hashlib
|
|
|
|
app_title = "Zeiterfassung"
|
|
app_version = "beta-2025.0.1"
|
|
|
|
# Standardpfade
|
|
|
|
def is_docker():
|
|
cgroup = Path('/proc/self/cgroup')
|
|
return Path('/.dockerenv').is_file() or (cgroup.is_file() and 'docker' in cgroup.read_text())
|
|
|
|
if is_docker():
|
|
scriptpath = "/settings"
|
|
backupfolder = "/backup"
|
|
userfolder = "/users"
|
|
else:
|
|
scriptpath = str(Path(os.path.dirname(os.path.abspath(__file__))).parent.absolute())
|
|
backupfolder = str(os.path.join(scriptpath, "backup"))
|
|
userfolder = os.path.join(scriptpath, "users")
|
|
|
|
# Dateinamen
|
|
|
|
usersettingsfilename = "settings.json"
|
|
photofilename = "photo.jpg"
|
|
va_file = "vacation_application.json"
|
|
|
|
# Status
|
|
|
|
status_in = "eingestempelt"
|
|
status_out = "ausgestempelt"
|
|
|
|
# Standardadmin Settings:
|
|
|
|
standard_adminsettings = { "admin_user": "admin",
|
|
"admin_password": "8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918",
|
|
"port": "8090",
|
|
"secret": "ftgzuhjikg,mt5jn46uzer8sfi9okrmtzjhndfierko5zltjhdgise",
|
|
"times_on_touchscreen": True,
|
|
"photos_on_touchscreen": True,
|
|
"touchscreen": True,
|
|
"picture_height": 200,
|
|
"button_height": 300,
|
|
"user_notes": True,
|
|
"vacation_application": True,
|
|
"backup_folder": backupfolder,
|
|
"backup_api_key": hashlib.shake_256(bytes(backupfolder, 'utf-8')).hexdigest(20),
|
|
"holidays": { }
|
|
}
|
|
|
|
# Standard User Settings:
|
|
|
|
standard_usersettings = {
|
|
"username": "default",
|
|
"fullname": "Standardbenutzer",
|
|
"password": "37a8eec1ce19687d132fe29051dca629d164e2c4958ba141d5f4133a33f0688f",
|
|
"api_key": "1234567890",
|
|
"workhours": { }
|
|
}
|
|
|
|
# Abesenheiten
|
|
|
|
absence_entries = {"U": { "name": "Urlaub",
|
|
"color": "green",
|
|
"text-color": "black"},
|
|
"K": { "name": "Krankheit",
|
|
"color": "red",
|
|
"text-color": "white"},
|
|
"KK": { "name": "Krankheit Kind",
|
|
"color": "orange",
|
|
"text-color": "black"},
|
|
"UU": { "name": "Urlaub aus Überstunden",
|
|
"color": "green",
|
|
"text-color": "black"},
|
|
"F": { "name": "Fortbildung",
|
|
"color": "black",
|
|
"text-color": "white"},
|
|
"EZ": { "name": "Elternzeit",
|
|
"color": "purple",
|
|
"text-color": "white"},
|
|
"SO": { "name": "Sonstiges",
|
|
"color": "pink",
|
|
"text-color": "white"}
|
|
}
|
|
|
|
# Styling
|
|
h1 = "text-5xl font-bold"
|
|
h2 = "text-4xl font-medium"
|
|
h3 = "text-3xl font-light"
|
|
h4 = "text-2xl"
|
|
|
|
# SVGs:
|
|
|
|
no_photo_svg = f'''<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
|
<svg height="800px" width="800px" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
viewBox="0 0 496.158 496.158" xml:space="preserve">
|
|
<path style="fill:#D61E1E;" d="M248.082,0.003C111.07,0.003,0,111.063,0,248.085c0,137.001,111.07,248.07,248.082,248.07
|
|
c137.006,0,248.076-111.069,248.076-248.07C496.158,111.062,385.088,0.003,248.082,0.003z"/>
|
|
<path style="fill:#F4EDED;" d="M248.082,39.002C132.609,39.002,39,132.602,39,248.084c0,115.463,93.609,209.072,209.082,209.072
|
|
c115.467,0,209.076-93.609,209.076-209.072C457.158,132.602,363.549,39.002,248.082,39.002z"/>
|
|
<g>
|
|
<path style="fill:#5B5147;" d="M145.23,144.237h-24.44c-3.21,0-5.819,4.741-5.819,10.605s2.609,10.611,5.819,10.611h24.44
|
|
c3.217,0,5.826-4.747,5.826-10.611C151.057,148.978,148.447,144.237,145.23,144.237z"/>
|
|
<path style="fill:#5B5147;" d="M380.289,172.06H226.545c-2.025-9.851-9.416-17.176-18.244-17.176h-92.199
|
|
c-10.403,0-18.818,10.125-18.818,22.592V328.9c0,10.254,8.314,18.581,18.58,18.581h264.425c10.262,0,18.586-8.327,18.586-18.581
|
|
V190.655C398.875,180.38,390.551,172.06,380.289,172.06z"/>
|
|
</g>
|
|
<path style="fill:#F4EDED;" d="M248.076,166.711c-51.133,0-92.604,41.462-92.604,92.602c0,51.146,41.471,92.608,92.604,92.608
|
|
c51.139,0,92.6-41.462,92.6-92.608C340.676,208.174,299.215,166.711,248.076,166.711z"/>
|
|
<path style="fill:#5B5147;" d="M248.086,171.416c-48.547,0-87.909,39.355-87.909,87.909c0,48.537,39.362,87.898,87.909,87.898
|
|
c48.543,0,87.896-39.361,87.896-87.898C335.981,210.771,296.629,171.416,248.086,171.416z"/>
|
|
<path style="fill:#F4EDED;" d="M248.611,205.005c-29.992,0-54.312,24.31-54.312,54.308c0,29.991,24.319,54.321,54.312,54.321
|
|
s54.318-24.33,54.318-54.321C302.93,229.315,278.603,205.005,248.611,205.005z"/>
|
|
<path style="fill:#5B5147;" d="M248.611,209.528c-27.494,0-49.789,22.286-49.789,49.786c0,27.494,22.295,49.798,49.789,49.798
|
|
c27.496,0,49.795-22.304,49.795-49.798C298.406,231.814,276.107,209.528,248.611,209.528z"/>
|
|
<g>
|
|
<path style="fill:#F4EDED;" d="M230.224,215.002c-14.401,0-26.065,11.674-26.065,26.067c0,14.399,11.664,26.073,26.065,26.073
|
|
c14.391,0,26.065-11.674,26.065-26.073C256.289,226.676,244.614,215.002,230.224,215.002z"/>
|
|
<path style="fill:#F4EDED;" d="M159.698,165.453h-45.712c-3.756,0-6.805,3.045-6.805,6.792v25.594c0,3.04,2.004,5.575,4.756,6.448
|
|
c0.65,0.209,1.328,0.35,2.049,0.35h45.712c3.76,0,6.793-3.04,6.793-6.798v-25.594C166.491,168.498,163.458,165.453,159.698,165.453
|
|
z"/>
|
|
</g>
|
|
<path style="fill:#D61E1E;" d="M85.85,60.394c-9.086,7.86-17.596,16.37-25.456,25.456l349.914,349.914
|
|
c9.086-7.861,17.596-16.37,25.456-25.456L85.85,60.394z"/>
|
|
</svg>''' |