Show live Horizon terrain and radar views in the web panel

This commit is contained in:
2026-12-02 18:52:41 +03:00
parent 7612d15963
commit 20fdb23b39
15 changed files with 818 additions and 120 deletions
+8 -6
View File
@@ -94,14 +94,15 @@ class Store:
with self.lock, self.db:
self.db.execute("DELETE FROM pairings")
def append(self, snapshot, public):
def append(self, snapshot, public, *, capture_frame=True):
session, world, tick = snapshot["session"], snapshot["world"], snapshot["tick"]
active = next((raid["id"] for raid in snapshot["raids"] if raid["active"]), 0)
now = time.time()
frame = zlib.compress(compact(public).encode("utf-8"), level=1)
frame = zlib.compress(compact(public).encode("utf-8"), level=1) if capture_frame else None
with self.lock, self.db:
self.db.execute("INSERT OR IGNORE INTO frames VALUES (?, ?, ?, ?, ?)",
(session, tick, world, now, frame))
if frame is not None:
self.db.execute("INSERT OR IGNORE INTO frames VALUES (?, ?, ?, ?, ?)",
(session, tick, world, now, frame))
for raid in snapshot["raids"]:
fields = (session, raid["id"], world, now, raid["start"], raid["length"],
int(raid["active"]), int(raid["gap"] or raid["limited"]))
@@ -122,8 +123,9 @@ class Store:
(SELECT rowid FROM raids ORDER BY time DESC LIMIT -1 OFFSET ?)""", (MAX_RAIDS,)).rowcount
if removed or gone:
self.db.execute("INSERT OR REPLACE INTO metadata VALUES ('history_limited','1')")
self.db.execute("""DELETE FROM frames WHERE rowid IN
(SELECT rowid FROM frames ORDER BY time DESC LIMIT -1 OFFSET ?)""", (MAX_FRAMES,))
if frame is not None:
self.db.execute("""DELETE FROM frames WHERE rowid IN
(SELECT rowid FROM frames ORDER BY time DESC LIMIT -1 OFFSET ?)""", (MAX_FRAMES,))
def raids(self):
with self.lock: