aboutsummaryrefslogtreecommitdiffstats
path: root/deckit/server.py
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-10 16:25:12 +0100
committerDanilo M. <danix@danix.xyz>2026-11-10 16:25:12 +0100
commitec140125f208d5f6e507dfe6b8e9abc7236cb21b (patch)
treea6ba7593121981b11f0f8167b1059a572731d15e /deckit/server.py
parentea5a277c6b8bb2ba48b0ca8822797cf6ab0b3405 (diff)
downloaddeck-it-ec140125f208d5f6e507dfe6b8e9abc7236cb21b.tar.gz
deck-it-ec140125f208d5f6e507dfe6b8e9abc7236cb21b.zip
feat(assistant): a faint picture behind the Assistant tab
`[assistant] background` names an image (none by default); the server serves it at /api/bg behind the token, and the tab shows its subject from the right side, desaturated and faded out on every side so no edge shows: opacity .24 while the chat is empty, .07 during a conversation. Tuned on the 1280x800 tablet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'deckit/server.py')
-rw-r--r--deckit/server.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/deckit/server.py b/deckit/server.py
index 835b612..19edbef 100644
--- a/deckit/server.py
+++ b/deckit/server.py
@@ -108,6 +108,16 @@ def art():
return None
+def background():
+ """The Assistant tab's backdrop, `[assistant] background`; None when unset."""
+ name = CFG.get("assistant", {}).get("background", "")
+ path = Path(name).expanduser()
+ try:
+ return (path.read_bytes(), mimetypes.guess_type(path)[0] or "image/jpeg") if name else None
+ except OSError:
+ return None
+
+
_font = {}
@@ -194,6 +204,9 @@ class Handler(BaseHTTPRequestHandler):
if len(parts) == 2 and parts[1] == "art":
image = art()
return self._send(200, image[0], image[1], cache=True) if image else self._send(404)
+ if len(parts) == 2 and parts[1] == "bg":
+ image = background()
+ return self._send(200, image[0], image[1], cache=True) if image else self._send(404)
if len(parts) == 2 and parts[1] == "modules":
return self._json(REGISTRY.names())
if len(parts) == 2: