aboutsummaryrefslogtreecommitdiff
path: root/watcher.py
diff options
context:
space:
mode:
authorJason McCormick <jason@mfamily.org>2026-11-05 18:37:48 -0500
committerJason McCormick <jason@mfamily.org>2026-11-05 18:37:48 -0500
commitc2382d8b4cf93489614c5fe70a604ab698b9f613 (patch)
tree8a8b28d010292271b24b9c3cd6bc175fc58e2a95 /watcher.py
parent75719aa37f7317f3a8feeb516f1444edb4274410 (diff)
feat: 1-minute watcher and per-stanza email subject/header
Run the notification timer every minute and shrink the scan window to match. Each upload URI stanza may now set subject and body_header to override the default notification text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'watcher.py')
-rw-r--r--watcher.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/watcher.py b/watcher.py
index 9799bae..e5df0b6 100644
--- a/watcher.py
+++ b/watcher.py
@@ -20,7 +20,7 @@ from urllib.parse import quote
from server import DEFAULT_CONFIG_FILE, AppConfig, load_config
-SCAN_INTERVAL_SECONDS = 5 * 60
+SCAN_INTERVAL_SECONDS = 60
IMAGE_SUFFIXES = {".jpg", ".png", ".heic"}
SUBJECT = "New upload received"
BODY = "A new file has been uploaded to your private drop."
@@ -71,11 +71,11 @@ def build_message(config: AppConfig, target: str, target_dir: Path, filenames: l
message = EmailMessage()
message["From"] = config.smtp.send_as
message["To"] = config.recipients[target]
- message["Subject"] = SUBJECT
+ message["Subject"] = config.subjects.get(target, SUBJECT)
message["Date"] = formatdate(localtime=True)
message["Message-ID"] = make_msgid(domain=config.smtp.send_as.rsplit("@", 1)[1])
prefix = config.view_url_prefixes.get(target)
- sections = [BODY]
+ sections = [config.body_headers.get(target, BODY)]
for name in filenames:
# Stored names are server-generated hex plus an extension, so they are URL-safe.
heading = prefix + quote(name) if prefix else f"File: {name}"