mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-07-05 17:31:39 +02:00
refactor: use public key prefix for DB filename instead of device name
DB filename changes from {device_name}.db to mc_{pubkey[:8]}.db,
making it stable across device renames and preparing for multi-device support.
Existing databases are auto-migrated at startup by probing the device table.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -80,6 +80,12 @@ class Database:
|
||||
row = conn.execute("SELECT * FROM device WHERE id = 1").fetchone()
|
||||
return dict(row) if row else None
|
||||
|
||||
def get_public_key(self) -> Optional[str]:
|
||||
"""Get device public key (used for DB filename resolution)."""
|
||||
with self._connect() as conn:
|
||||
row = conn.execute("SELECT public_key FROM device WHERE id = 1").fetchone()
|
||||
return row['public_key'] if row and row['public_key'] else None
|
||||
|
||||
# ================================================================
|
||||
# Contacts
|
||||
# ================================================================
|
||||
|
||||
Reference in New Issue
Block a user