adding the edge and vivaldi browser for installing the extension to, generate uuids when the browser not have a alias set

This commit is contained in:
2026-04-10 01:48:18 +02:00
parent e8cbf64919
commit 7b9a877731
4 changed files with 102 additions and 19 deletions
+12 -3
View File
@@ -75,6 +75,15 @@ def _socket_path_for(alias: str) -> str:
return str(SOCKET_DIR / f"{safe}.sock")
def _resolve_profile_alias(first_msg: dict | None) -> str:
"""Return a unique alias when the extension did not provide one."""
if first_msg and first_msg.get("type") == "hello":
alias = first_msg.get("alias")
if alias and alias != DEFAULT_ALIAS:
return alias
return str(uuid.uuid4())
# --- Thread A: read messages from extension (stdin) ---
def stdin_reader(alias: str):
@@ -191,10 +200,10 @@ def main():
# Wait for the hello handshake to learn the profile alias
first_msg = read_native_message(stdin)
if first_msg and first_msg.get("type") == "hello":
alias = first_msg.get("alias") or DEFAULT_ALIAS
alias = _resolve_profile_alias(first_msg)
else:
# No hello — fall back to default, re-queue message if it was a command
alias = DEFAULT_ALIAS
# No hello — use a generated alias and re-queue the first command if needed.
alias = str(uuid.uuid4())
if first_msg:
msg_id = first_msg.get("id")
if msg_id: