Compare commits

...

3 Commits

Author SHA1 Message Date
f468a789e3 fix: make polling interval configurable
All checks were successful
ci / docker (push) Successful in 1m15s
2026-03-11 15:40:04 +01:00
527fa97dc8 fix: prevent substitutions=none if yaml is empty 2026-03-11 15:17:34 +01:00
000b7d2f43 fix: handle bytes input from ldap better 2026-03-11 15:10:55 +01:00
2 changed files with 14 additions and 3 deletions

View File

@@ -174,6 +174,8 @@ if __name__ == "__main__":
smtp_pass = args.smtp_pass or os.environ.get("SMTP_PASS")
smtp_port = args.smtp_port or os.environ.get("SMTP_PORT")
polling_interval = int(os.environ.get("POLLING_INTERVAL_SECONDS") or 5)
first_run = True
while args.loop or first_run:
@@ -228,7 +230,7 @@ if __name__ == "__main__":
# wait a moment #
if args.loop:
time.sleep(5)
time.sleep(polling_interval)
# handle non-loop runs #
first_run = False

View File

@@ -67,7 +67,7 @@ class UserSettings(db.Model):
"email_priority" : self.email_priority,
"ntfy_priority" : self.ntfy_priority,
}
class DispatchObject(db.Model):
@@ -398,6 +398,15 @@ def save_in_dispatch_queue(persons, title, message, method, link=""):
dispatch_secret = secrets.token_urlsafe(32)
master_method = "any"
# handle bytes input #
def normalize(v):
return v.decode("utf-8") if isinstance(v, bytes) else v
p.username = normalize(p.username)
p.phone = normalize(p.phone)
p.email = normalize(p.email)
obj = DispatchObject(username=p.username,
phone=p.phone,
email=p.email,
@@ -440,7 +449,7 @@ def create_app():
app.config["SUBSTITUTIONS"] = {}
if os.path.isfile(substitution_config_file):
with open(substitution_config_file) as f:
app.config["SUBSTITUTIONS"] = yaml.safe_load(f)
app.config["SUBSTITUTIONS"] = yaml.safe_load(f) or {}
print("Loaded subs:", substitution_config_file, app.config["SUBSTITUTIONS"], file=sys.stderr)