Commit Diff


commit - 7c41d2555ab3a031a8ec5b52779a65413fc33939
commit + 3e30fc1ff40964a1f98ac42ab395898930878131
blob - 0ef848b046556ce47cd1009940c80817b1a60558
blob + cea5f1d2a22257deeca388cba3768c50ed9aaf22
--- lonk.py
+++ lonk.py
@@ -234,6 +234,7 @@ def _create_schema(db_con):
                 html TEXT,
                 date TEXT,
                 public INTEGER,
+                handles TEXT,
                 FOREIGN KEY (client_id) REFERENCES client (client_id),
                 UNIQUE (convoy, client_id),
                 UNIQUE (honk_id, client_id)
@@ -278,7 +279,7 @@ def db_connect():
 
 
 class _LonkTreeItem:
-    def __init__(self, convoy_id, convoy, honk_id, honker, url, html, date, public):
+    def __init__(self, convoy_id, convoy, honk_id, honker, url, html, date, public, handles):
         self.convoy_id = convoy_id
         self.convoy = convoy
         self.honk_id = honk_id
@@ -287,6 +288,7 @@ class _LonkTreeItem:
         self.html = html
         self.date = date
         self.public = bool(public)
+        self.handles = handles
         self.donks = []
         self.reposters = []
         self.thread = []
@@ -304,6 +306,7 @@ class _LonkTreeItem:
                 "HTML": self.html,
                 "Date": self.date,
                 "Public": self.public,
+                "Handles": self.handles,
                 "Donks": [
                     {"URL": donk[0], "Media": donk[1], "Desc": donk[2]}
                     for donk in self.donks
@@ -323,7 +326,7 @@ def page_lonk(db_con, client_id, lonk_url, honk_url):
 
         if convoy not in lonk_page:
             row = db_con.execute(
-                "SELECT convoy_id, convoy, honk_id, honker, url, html, date, public FROM convoy WHERE client_id=? AND convoy=?",
+                "SELECT convoy_id, convoy, honk_id, honker, url, html, date, public, handles FROM convoy WHERE client_id=? AND convoy=?",
                 (client_id, convoy)
             ).fetchone()
             if row:
@@ -347,17 +350,17 @@ def page_lonk(db_con, client_id, lonk_url, honk_url):
                 row = db_con.execute(
                     """
                     INSERT INTO 
-                        convoy(convoy, client_id, honk_id, honker, url, html, date, public)
+                        convoy(convoy, client_id, honk_id, honker, url, html, date, public, handles)
                     VALUES 
-                        (?, ?, ?, ?, ?, ?, ?, ?)
+                        (?, ?, ?, ?, ?, ?, ?, ?, ?)
                     RETURNING
                         convoy_id
                     """,
-                    (convoy, client_id, honk["ID"], honker, honk["XID"], honk["HTML"], honk["Date"], is_public)
+                    (convoy, client_id, honk["ID"], honker, honk["XID"], honk["HTML"], honk["Date"], is_public, honk["Handles"])
                 ).fetchone()
                 convoy_id, = row
                 lonk_page[convoy] = _LonkTreeItem(
-                    convoy_id, convoy, honk["ID"], honker, honk["XID"], honk["HTML"], honk["Date"], is_public
+                    convoy_id, convoy, honk["ID"], honker, honk["XID"], honk["HTML"], honk["Date"], is_public, honk["Handles"]
                 )
 
                 for donk in (honk.get("Donks") or []):
@@ -376,7 +379,7 @@ def page_lonk(db_con, client_id, lonk_url, honk_url):
                         _save_convoy(convoy, honker, honk_in_convoy)
                         break
                 else:
-                    _save_convoy(convoy, None, {"ID": None, "XID": None, "HTML": None, "Date": None})
+                    _save_convoy(convoy, None, {"ID": None, "XID": None, "HTML": None, "Date": None, "Handles": None})
             else:
                 _save_convoy(convoy, honk.get("Oondle") or honk["Handle"], honk)