Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions webext/app/credential_manager_shim.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from enum import Enum
import json
import logging
import os
from pathlib import Path
import re
import secrets
import signal
Expand Down Expand Up @@ -473,25 +475,36 @@ async def get_passkey(interface, options, origin, top_origin):
return response_json


def discover_app_id():
desktop_file_name = os.environ.get("GIO_LAUNCHED_DESKTOP_FILE")
if not desktop_file_name:
logging.debug("Browser was not launched from a desktop entry.")
return None

return Path(desktop_file_name).stem


async def get_interface():
global INTERFACE
if INTERFACE and INTERFACE.bus.connected:
return INTERFACE

bus = await MessageBus().connect()
logging.debug("Connected to bus")
import os

logging.info(os.getcwd())

app_id = discover_app_id() or APP_ID
logging.info(f"Registering with the portal as {app_id}")

msg = Message(
"org.freedesktop.portal.Desktop",
"/org/freedesktop/portal/desktop",
"org.freedesktop.host.portal.Registry",
"Register",
signature="sa{sv}",
body=[
APP_ID,
app_id,
{},
],
)
Expand Down