Retro Bulletin Board Systems on atproto. Web app and TUI. lazy mirror of alyraffauf/atbbs atbbs.xyz
forums python tui atproto bbs
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

tui: cleanup db, last account wins

+11 -5
+11 -5
tui/app.py
··· 82 82 home.connect(self._dial) 83 83 84 84 def _restore_session(self) -> None: 85 - """Load the most recent session from the database.""" 85 + """Load the stored session. The TUI is single-user: if stale extra 86 + rows exist from a previous version, keep the newest and drop the rest.""" 86 87 import sqlite3 87 88 88 89 try: 89 90 con = sqlite3.connect(self.session_store.db_path) 90 91 con.row_factory = sqlite3.Row 91 - row = con.execute("SELECT * FROM oauth_session LIMIT 1").fetchone() 92 + rows = con.execute( 93 + "SELECT * FROM oauth_session ORDER BY rowid DESC" 94 + ).fetchall() 92 95 con.close() 93 - if row: 94 - self.user_session = dict(row) 95 - self.sub_title = self.user_session.get("handle", "") 96 + if not rows: 97 + return 98 + self.user_session = dict(rows[0]) 99 + self.sub_title = self.user_session.get("handle", "") 100 + for extra in rows[1:]: 101 + self.session_store.delete_session(extra["did"]) 96 102 except Exception: 97 103 pass 98 104