Return a presence scope based on the host used to reach the app. This keeps 'online' accurate per generated link (local vs cloudflared vs tor), so users are only shown online if they're actually active on the same link.
()
| 1175 | # --------------------------- |
| 1176 | # Appearance preference helpers |
| 1177 | # --------------------------- |
| 1178 | |
| 1179 | def get_user_prefs(username: Optional[str]) -> Dict[str, str]: |
| 1180 | """Return saved UI preferences for a user (accent + font). |
| 1181 | |
| 1182 | Falls back to DEFAULT_PREFS if nothing is saved yet. |
| 1183 | """ |
| 1184 | prefs = dict(DEFAULT_PREFS) |
| 1185 | if not username: |
| 1186 | return prefs |
| 1187 | try: |
| 1188 | conn = db_connect() |
| 1189 | row = conn.execute( |
| 1190 | "SELECT accent_key, font_key, ui_theme_key FROM user_prefs WHERE username=?", |
no outgoing calls
no test coverage detected