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 | prefs = dict(DEFAULT_PREFS) |
| 1177 | if not username: |
| 1178 | return prefs |
| 1179 | try: |
| 1180 | conn = db_connect() |
| 1181 | row = conn.execute( |
| 1182 | "SELECT accent_key, font_key, ui_theme_key FROM user_prefs WHERE username=?", |
| 1183 | (username,), |
| 1184 | ).fetchone() |
| 1185 | conn.close() |
| 1186 | if row: |
| 1187 | ak = (row["accent_key"] or "").strip() |
| 1188 | fk = (row["font_key"] or "").strip() |
| 1189 | tk = (row["ui_theme_key"] or "").strip() if "ui_theme_key" in row.keys() else "" |
| 1190 | if ak in ACCENT_PRESETS: |
no outgoing calls
no test coverage detected