added background to notes widget

This commit is contained in:
2026-01-23 10:19:39 +01:00
parent 468cc2c86d
commit 0eff35fea7
2 changed files with 6 additions and 5 deletions
+5 -4
View File
@@ -64,7 +64,7 @@ data:
return False return False
@APP.get("/notes") @APP.get("/notes")
def notes_widget(key: str = "", user: str = "default", accent: str = "ffffff"): def notes_widget(key: str = "", user: str = "default", accent: str = "ffffff", bgcolor: str = ""):
"""Serve the notes widget HTML page for a specific user with optional theme.""" """Serve the notes widget HTML page for a specific user with optional theme."""
expected_key = os.environ.get("GLANCE_HELPER_KEY", "") expected_key = os.environ.get("GLANCE_HELPER_KEY", "")
if key != expected_key: if key != expected_key:
@@ -73,6 +73,8 @@ data:
safe_user = re.sub(r'[^a-zA-Z0-9_-]', '', user) or "default" safe_user = re.sub(r'[^a-zA-Z0-9_-]', '', user) or "default"
# Sanitize accent color (hex only, default to white) # Sanitize accent color (hex only, default to white)
safe_accent = re.sub(r'[^a-fA-F0-9]', '', accent)[:6] or "ffffff" safe_accent = re.sub(r'[^a-fA-F0-9]', '', accent)[:6] or "ffffff"
# Sanitize bgcolor (hex only, default to dark purple matching Orsi's theme)
safe_bgcolor = re.sub(r'[^a-fA-F0-9]', '', bgcolor)[:6] or "2d1f3d"
current_notes = load_notes(safe_user) current_notes = load_notes(safe_user)
escaped_notes = current_notes.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;").replace('"', "&quot;") escaped_notes = current_notes.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;").replace('"', "&quot;")
@@ -88,16 +90,15 @@ data:
--accent-20: #{safe_accent}33; --accent-20: #{safe_accent}33;
--accent-40: #{safe_accent}66; --accent-40: #{safe_accent}66;
--accent-60: #{safe_accent}99; --accent-60: #{safe_accent}99;
--bgcolor: #{safe_bgcolor};
}} }}
* {{ margin: 0; padding: 0; box-sizing: border-box; }} * {{ margin: 0; padding: 0; box-sizing: border-box; }}
html, body {{ html, body {{
background: transparent !important; background: var(--bgcolor);
height: 100%; height: 100%;
}} }}
body {{ body {{
background: transparent;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
height: 100vh;
}} }}
.container {{ .container {{
display: flex; display: flex;
+1 -1
View File
@@ -593,7 +593,7 @@ data:
widgets: widgets:
- type: iframe - type: iframe
css-class: iframe-no-tint css-class: iframe-no-tint
source: https://glance-helper.dooplex.hu/notes?key=oplQqnLnJK2vErRVYJpvVUcSDBOSbCHZSbsYY2bwSifgTMfT&user=orsi&accent=e292ff source: source: https://glance-helper.dooplex.hu/notes?key=oplQqnLnJK2vErRVYJpvVUcSDBOSbCHZSbsYY2bwSifgTMfT&user=orsi&accent=e292ff&bgcolor=2d1f3d
height: 250 height: 250
title: Quick Notes title: Quick Notes
- type: bookmarks - type: bookmarks