mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-07-05 17:29:54 +00:00
Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b3a5f9659f | |||
| d444248f62 | |||
| 9570d0b0c2 | |||
| 8a90605a64 | |||
| 9d0dbbb790 | |||
| 2303023ad4 | |||
| 599279c137 | |||
| 44be6ba3dd | |||
| 5e270de990 | |||
| 52b40b7d0c | |||
| 3cb150b9fb | |||
| bac1ef5f4d | |||
| d9ab176bc7 | |||
| ff856c7148 | |||
| 62293d2316 | |||
| e00d517119 | |||
| 241aec26e8 | |||
| 491d298fd7 | |||
| 262b62ea4f | |||
| 4cde25c43e | |||
| b8bf9f343c | |||
| 4cf80595ad | |||
| 4c23549748 | |||
| 7b21e81caa | |||
| c2443ee2c5 | |||
| df52ebe7ed | |||
| b93fc8b557 | |||
| 88e7919a12 | |||
| 28c7254ef6 |
Vendored
+1
-1
@@ -120,7 +120,7 @@
|
||||
"dependsOn": [
|
||||
"checkforsettings"
|
||||
],
|
||||
"command": "ssh -t ${config:deckuser}@${config:deckip} -p ${config:deckport} ${config:deckkey} 'export PATH=${config:deckdir}/.local/bin:$PATH; export PLUGIN_PATH=${config:deckdir}/homebrew/plugins; export CHOWN_PLUGIN_PATH=0; export LOG_LEVEL=DEBUG; cd ${config:deckdir}/homebrew/dev/pluginloader/backend; echo '${config:deckpass}' | poetry run sh -c \"cd ${config:deckdir}/homebrew/services; sudo -SE env \"PATH=\\$PATH\" python3 ${config:deckdir}/homebrew/dev/pluginloader/backend/main.py\"'",
|
||||
"command": "ssh ${config:deckuser}@${config:deckip} -p ${config:deckport} ${config:deckkey} 'export PATH=${config:deckdir}/.local/bin:$PATH; export PLUGIN_PATH=${config:deckdir}/homebrew/plugins; export CHOWN_PLUGIN_PATH=0; export LOG_LEVEL=DEBUG; cd ${config:deckdir}/homebrew/dev/pluginloader/backend; echo '${config:deckpass}' | poetry run sh -c \"cd ${config:deckdir}/homebrew/services; sudo -SE env \"PATH=\\$PATH\" python3 ${config:deckdir}/homebrew/dev/pluginloader/backend/main.py\"'",
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
|
||||
@@ -52,9 +52,6 @@ async def csrf_middleware(request: Request, handler: Handler):
|
||||
return await handler(request)
|
||||
return Response(text='Forbidden', status=403)
|
||||
|
||||
def create_inject_script(script: str) -> str:
|
||||
return "try{if (window.deckyHasLoaded){setTimeout(() => SteamClient.Browser.RestartJSContext(), 100)}else{window.deckyHasLoaded = true;(async()=>{try{await import('http://localhost:1337/frontend/%s?v=%s')}catch(e){console.error(e)};})();}}catch(e){console.error(e)}" % (script, get_loader_version(), )
|
||||
|
||||
# Get the default homebrew path unless a home_path is specified. home_path argument is deprecated
|
||||
def get_homebrew_path() -> str:
|
||||
return localplatform.get_unprivileged_path()
|
||||
@@ -84,7 +81,7 @@ def get_loader_version() -> str:
|
||||
|
||||
return version_str
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to execute get_loader_version(): {str(e)}")
|
||||
logger.warn(f"Failed to execute get_loader_version(): {str(e)}")
|
||||
return "unknown"
|
||||
|
||||
user_agent = f"Decky/{get_loader_version()} (https://decky.xyz)"
|
||||
@@ -96,13 +93,9 @@ def get_system_pythonpaths() -> list[str]:
|
||||
proc = subprocess.run(["python3" if localplatform.ON_LINUX else "python", "-c", "import sys; print('\\n'.join(x for x in sys.path if x))"],
|
||||
# TODO make this less insane
|
||||
capture_output=True, user=localplatform.localplatform._get_user_id() if localplatform.ON_LINUX else None, env={} if localplatform.ON_LINUX else None) # pyright: ignore [reportPrivateUsage]
|
||||
|
||||
proc.check_returncode()
|
||||
|
||||
versions = [x.strip() for x in proc.stdout.decode().strip().split("\n")]
|
||||
return [x for x in versions if x and not x.isspace()]
|
||||
return [x.strip() for x in proc.stdout.decode().strip().split("\n")]
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to execute get_system_pythonpaths(): {str(e)}")
|
||||
logger.warn(f"Failed to execute get_system_pythonpaths(): {str(e)}")
|
||||
return []
|
||||
|
||||
# Download Remote Binaries to local Plugin
|
||||
|
||||
@@ -46,7 +46,7 @@ class Tab:
|
||||
async for message in self.websocket:
|
||||
data = message.json()
|
||||
yield data
|
||||
logger.warning(f"The Tab {self.title} socket has been disconnected while listening for messages.")
|
||||
logger.warn(f"The Tab {self.title} socket has been disconnected while listening for messages.")
|
||||
await self.close_websocket()
|
||||
|
||||
async def _send_devtools_cmd(self, dc: Dict[str, Any], receive: bool = True):
|
||||
@@ -381,10 +381,10 @@ async def get_tabs() -> List[Tab]:
|
||||
na = True
|
||||
await sleep(5)
|
||||
except ClientOSError:
|
||||
logger.warning(f"The request to {BASE_ADDRESS}/json was reset")
|
||||
logger.warn(f"The request to {BASE_ADDRESS}/json was reset")
|
||||
await sleep(1)
|
||||
except TimeoutError:
|
||||
logger.warning(f"The request to {BASE_ADDRESS}/json timed out")
|
||||
logger.warn(f"The request to {BASE_ADDRESS}/json timed out")
|
||||
await sleep(1)
|
||||
else:
|
||||
break
|
||||
|
||||
@@ -104,15 +104,10 @@ class Loader:
|
||||
async def enable_reload_wait(self):
|
||||
if self.live_reload:
|
||||
await sleep(10)
|
||||
if self.watcher and self.live_reload:
|
||||
if self.watcher:
|
||||
self.logger.info("Hot reload enabled")
|
||||
self.watcher.disabled = False
|
||||
|
||||
async def disable_reload(self):
|
||||
if self.watcher:
|
||||
self.watcher.disabled = True
|
||||
self.live_reload = False
|
||||
|
||||
async def handle_frontend_assets(self, request: web.Request):
|
||||
file = Path(__file__).parent.joinpath("static").joinpath(request.match_info["path"])
|
||||
return web.FileResponse(file, headers={"Cache-Control": "no-cache"})
|
||||
|
||||
@@ -205,15 +205,6 @@
|
||||
"testing_title": "Testování"
|
||||
},
|
||||
"Store": {
|
||||
"download_progress_info": {
|
||||
"download_zip": "Stahování pluginu",
|
||||
"increment_count": "Zvyšující se počet stahování",
|
||||
"installing_plugin": "Instalování pluginu",
|
||||
"open_zip": "Otevírání ZIP souboru",
|
||||
"parse_zip": "Analýza ZIP souboru",
|
||||
"start": "Inicializace",
|
||||
"uninstalling_previous": "Odinstalování předchozí kopie"
|
||||
},
|
||||
"store_contrib": {
|
||||
"desc": "Pokud byste chtěli přispět do obchodu Decky Plugin Store, podívejte se na repozitář SteamDeckHomebrew/decky-plugin-template na GitHubu. Informace o vývoji a distribuci jsou k dispozici v README.",
|
||||
"label": "Přispívání"
|
||||
@@ -262,11 +253,7 @@
|
||||
}
|
||||
},
|
||||
"Testing": {
|
||||
"download": "Stáhnout",
|
||||
"error": "Chyba při instalaci PR",
|
||||
"header": "Následující verze Decky Loaderu jsou vytvořeny z otevřených Pull Requestů třetích stran. Tým Decky Loaderu neověřil jejich funkčnost ani zabezpečení a mohou být zastaralé.",
|
||||
"loading": "Načítání Pull Requestů...",
|
||||
"start_download_toast": "Stahování PR #{{id}}"
|
||||
"download": "Stáhnout"
|
||||
},
|
||||
"TitleView": {
|
||||
"decky_store_desc": "Otevřít obchod Decky",
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"label": "Canal de actualización",
|
||||
"prerelease": "Prelanzamiento",
|
||||
"stable": "Estable",
|
||||
"testing": "En pruebas"
|
||||
"testing": "Pruebas"
|
||||
}
|
||||
},
|
||||
"Developer": {
|
||||
@@ -12,41 +12,9 @@
|
||||
"disabling": "Desactivando DevTools de React",
|
||||
"enabling": "Activando DevTools de React"
|
||||
},
|
||||
"DropdownMultiselect": {
|
||||
"button": {
|
||||
"back": "Volver"
|
||||
}
|
||||
},
|
||||
"FilePickerError": {
|
||||
"errors": {
|
||||
"file_not_found": "La ruta especificada no es válida. Por favor revísala e introdúcela correctamente.",
|
||||
"perm_denied": "No tienes acceso a la ruta especificada. Por favor revisa si tu usuario (deck en Steam Deck) tiene el permiso correspondiente para acceder a la ruta/archivo especificado.",
|
||||
"unknown": "Ha ocurrido un error desconocido. El error sin procesar es:{{raw_error}}"
|
||||
}
|
||||
},
|
||||
"FilePickerIndex": {
|
||||
"file": {
|
||||
"select": "Selecciona este archivo"
|
||||
},
|
||||
"files": {
|
||||
"all_files": "Todos los archivos",
|
||||
"file_type": "Tipo de archivo",
|
||||
"show_hidden": "Mostrar archivos ocultos"
|
||||
},
|
||||
"filter": {
|
||||
"created_asce": "Creado (Más antiguo)",
|
||||
"created_desc": "Creado (Más reciente)",
|
||||
"modified_asce": "Modificado (Más antiguo)",
|
||||
"modified_desc": "Modificado (Más reciente)",
|
||||
"name_asce": "Z-A",
|
||||
"name_desc": "A-Z",
|
||||
"size_asce": "Tamaño (Más pequeño)",
|
||||
"size_desc": "Tamaño (Más grande)"
|
||||
},
|
||||
"folder": {
|
||||
"label": "Carpeta",
|
||||
"select": "Usar esta carpeta",
|
||||
"show_more": "Mostrar más archivos"
|
||||
"select": "Usar esta carpeta"
|
||||
}
|
||||
},
|
||||
"MultiplePluginsInstallModal": {
|
||||
@@ -76,9 +44,9 @@
|
||||
}
|
||||
},
|
||||
"PluginCard": {
|
||||
"plugin_full_access": "Este plugin tiene acceso completo a tu Steam Deck.",
|
||||
"plugin_full_access": "Este plugin tiene acceso completo a su Steam Deck.",
|
||||
"plugin_install": "Instalar",
|
||||
"plugin_no_desc": "No se ha proporcionado una descripción.",
|
||||
"plugin_no_desc": "No se proporcionó una descripción.",
|
||||
"plugin_version_label": "Versión de Plugin"
|
||||
},
|
||||
"PluginInstallModal": {
|
||||
@@ -103,26 +71,19 @@
|
||||
}
|
||||
},
|
||||
"PluginListIndex": {
|
||||
"freeze": "Congelar actualizaciones",
|
||||
"hide": "Acceso rápido: Esconder",
|
||||
"no_plugin": "¡No hay plugins instalados!",
|
||||
"plugin_actions": "Acciones de Plugin",
|
||||
"plugin_actions": "Acciones de plugin",
|
||||
"reinstall": "Reinstalar",
|
||||
"reload": "Recargar",
|
||||
"show": "Acceso rápido: Mostrar",
|
||||
"unfreeze": "Permitir actualizaciones",
|
||||
"uninstall": "Desinstalar",
|
||||
"update_all_many": "Actualizar {{count}} plugins",
|
||||
"update_all_one": "Actualizar 1 plugin",
|
||||
"update_all_other": "Actualizar {{count}} plugins",
|
||||
"update_to": "Actualizar a {{name}}"
|
||||
},
|
||||
"PluginListLabel": {
|
||||
"hidden": "Escondido del menú de acceso rápido"
|
||||
},
|
||||
"PluginLoader": {
|
||||
"decky_title": "Decky",
|
||||
"decky_update_available": "¡Actualización para {{tag_name}} disponible!",
|
||||
"decky_update_available": "¡Actualización {{tag_name}} disponible!",
|
||||
"error": "Error",
|
||||
"plugin_error_uninstall": "Al cargar {{name}} se ha producido una excepción como se muestra arriba. Esto suele significar que el plugin requiere una actualización para la nueva versión de SteamUI. Comprueba si hay una actualización disponible o valora eliminarlo en los ajustes de Decky, en la sección Plugins.",
|
||||
"plugin_load_error": {
|
||||
@@ -139,19 +100,19 @@
|
||||
"plugin_update_other": "¡Actualizaciones disponibles para {{count}} plugins!"
|
||||
},
|
||||
"PluginView": {
|
||||
"hidden_many": "{{count}} plugins están escondidos de esta lista",
|
||||
"hidden_one": "1 plugin está escondido de esta lista",
|
||||
"hidden_other": "{{count}} plugins están escondidos de esta lista"
|
||||
"hidden_many": "",
|
||||
"hidden_one": "",
|
||||
"hidden_other": ""
|
||||
},
|
||||
"RemoteDebugging": {
|
||||
"remote_cef": {
|
||||
"desc": "Permitir acceso no autenticado al depurador del CEF a cualquier persona en tu red",
|
||||
"desc": "Permitir acceso no autenticado al CEF debugger a cualquier persona en su red",
|
||||
"label": "Permitir depuración remota del CEF"
|
||||
}
|
||||
},
|
||||
"SettingsDeveloperIndex": {
|
||||
"cef_console": {
|
||||
"button": "Abrir Consola",
|
||||
"button": "Abrir consola",
|
||||
"desc": "Abre la consola del CEF. Solamente es útil para propósitos de depuración. Las cosas que hagas aquí pueden ser potencialmente peligrosas y solo se debería usar si eres un desarrollador de plugins, o uno te ha dirigido aquí.",
|
||||
"label": "Consola CEF"
|
||||
},
|
||||
@@ -186,11 +147,6 @@
|
||||
"developer_mode": {
|
||||
"label": "Modo desarrollador"
|
||||
},
|
||||
"notifications": {
|
||||
"decky_updates_label": "Actualización de Decky disponible",
|
||||
"header": "Notificaciones",
|
||||
"plugin_updates_label": "Actualizaciones de plugin disponibles"
|
||||
},
|
||||
"other": {
|
||||
"header": "Otros"
|
||||
},
|
||||
@@ -201,21 +157,11 @@
|
||||
"SettingsIndex": {
|
||||
"developer_title": "Desarrollador",
|
||||
"general_title": "General",
|
||||
"plugins_title": "Plugins",
|
||||
"testing_title": "En pruebas"
|
||||
"plugins_title": "Plugins"
|
||||
},
|
||||
"Store": {
|
||||
"download_progress_info": {
|
||||
"download_zip": "Descargando plugin",
|
||||
"increment_count": "Incrementando el contador de descargas",
|
||||
"installing_plugin": "Instalando plugin",
|
||||
"open_zip": "Abriendo archivo zip",
|
||||
"parse_zip": "Analizando archivo zip",
|
||||
"start": "Iniciando",
|
||||
"uninstalling_previous": "Desinstalando copia previa"
|
||||
},
|
||||
"store_contrib": {
|
||||
"desc": "Si desea contribuir a la tienda de plugins de Decky, consulta el repositorio SteamDeckHomebrew/decky-plugin-template en GitHub. Hay información disponible acerca del desarrollo y distribución en el archivo README.",
|
||||
"desc": "Si desea contribuir a la tienda de plugins de Decky, mira el repositorio SteamDeckHomebrew/decky-plugin-template en GitHub. Hay información acerca del desarrollo y distribución en el archivo README.",
|
||||
"label": "Contribuyendo"
|
||||
},
|
||||
"store_filter": {
|
||||
@@ -227,7 +173,7 @@
|
||||
},
|
||||
"store_sort": {
|
||||
"label": "Ordenar",
|
||||
"label_def": "Actualizado por última vez (Más reciente)"
|
||||
"label_def": "Actualizado por última vez (Nuevos)"
|
||||
},
|
||||
"store_source": {
|
||||
"desc": "El código fuente de los plugins está disponible en el repositiorio SteamDeckHomebrew/decky-plugin-database en GitHub.",
|
||||
@@ -237,17 +183,9 @@
|
||||
"about": "Información",
|
||||
"alph_asce": "Alfabéticamente (Z-A)",
|
||||
"alph_desc": "Alfabéticamente (A-Z)",
|
||||
"date_asce": "Más antiguo primero",
|
||||
"date_desc": "Más reciente primero",
|
||||
"downloads_asce": "Menos descargados primero",
|
||||
"downloads_desc": "Más descargados primero",
|
||||
"title": "Navegar"
|
||||
},
|
||||
"store_testing_cta": "¡Por favor considera probar plugins nuevos para ayudar al equipo de Decky Loader!",
|
||||
"store_testing_warning": {
|
||||
"desc": "Puedes usar este canal de la tienda para probar versiones inestables de plugins. Recuerda compartir tu experiencia en GitHub con el fin de poder actualizar el plugin para todos los usuarios.",
|
||||
"label": "Bienvenido al canal En Pruebas de la Tienda"
|
||||
}
|
||||
"store_testing_cta": "¡Por favor considera probar plugins nuevos para ayudar al equipo de Decky Loader!"
|
||||
},
|
||||
"StoreSelect": {
|
||||
"custom_store": {
|
||||
@@ -257,21 +195,10 @@
|
||||
"store_channel": {
|
||||
"custom": "Personalizada",
|
||||
"default": "Por defecto",
|
||||
"label": "Canal de la Tienda",
|
||||
"testing": "En pruebas"
|
||||
"label": "Canál de la tienda",
|
||||
"testing": "Pruebas"
|
||||
}
|
||||
},
|
||||
"Testing": {
|
||||
"download": "Descargar",
|
||||
"error": "Error instalando PR",
|
||||
"header": "Las siguientes versiones de Decky Loader han sido compiladas de solicitudes Pull de terceros. El equipo de Decky Loader no ha verificado su funcionalidad o seguridad, y es posible que estén desactulizadas.",
|
||||
"loading": "Cargando abrir Solicitudes de Pull...",
|
||||
"start_download_toast": "Descargando PR #{{id}}"
|
||||
},
|
||||
"TitleView": {
|
||||
"decky_store_desc": "Abrir la tienda de Decky",
|
||||
"settings_desc": "Abrir los ajustes de Decky"
|
||||
},
|
||||
"Updater": {
|
||||
"decky_updates": "Actualizaciones de Decky",
|
||||
"no_patch_notes_desc": "No hay notas de parche para esta versión",
|
||||
|
||||
@@ -95,14 +95,12 @@
|
||||
}
|
||||
},
|
||||
"PluginListIndex": {
|
||||
"freeze": "アップデートを凍結",
|
||||
"hide": "クイックアクセス: 非表示",
|
||||
"no_plugin": "プラグインがインストールされていません!",
|
||||
"plugin_actions": "プラグインアクション",
|
||||
"reinstall": "再インストール",
|
||||
"reload": "再読み込み",
|
||||
"show": "クイックアクセス: 表示",
|
||||
"unfreeze": "アップデートを許可",
|
||||
"uninstall": "アンインストール",
|
||||
"update_all_other": "{{count}} 個のプラグインをアップデート",
|
||||
"update_to": "{{name}} を更新"
|
||||
@@ -187,19 +185,9 @@
|
||||
"SettingsIndex": {
|
||||
"developer_title": "開発者",
|
||||
"general_title": "一般",
|
||||
"plugins_title": "プラグイン",
|
||||
"testing_title": "テスト"
|
||||
"plugins_title": "プラグイン"
|
||||
},
|
||||
"Store": {
|
||||
"download_progress_info": {
|
||||
"download_zip": "プラグインのダウンロード中",
|
||||
"increment_count": "ダウンロード数の増加",
|
||||
"installing_plugin": "プラグインのインストール中",
|
||||
"open_zip": "zipファイルを展開中",
|
||||
"parse_zip": "zipファイルの解析中",
|
||||
"start": "初期化中",
|
||||
"uninstalling_previous": "以前のコピーのアンインストール"
|
||||
},
|
||||
"store_contrib": {
|
||||
"desc": "Decky Plugin Storeに貢献したい場合は、GitHubのSteamDeckHomebrew/decky-plugin-templateリポジトリを確認してください。 開発と配布に関する情報は README で入手できます。",
|
||||
"label": "貢献"
|
||||
@@ -223,10 +211,6 @@
|
||||
"about": "概要",
|
||||
"alph_asce": "アルファベット(Z to A)",
|
||||
"alph_desc": "アルファベット(A to Z)",
|
||||
"date_asce": "古い順",
|
||||
"date_desc": "新しい順",
|
||||
"downloads_asce": "ダウンロード数が少ない順",
|
||||
"downloads_desc": "ダウンロード数が多い順",
|
||||
"title": "閲覧"
|
||||
},
|
||||
"store_testing_cta": "Decky Loaderチームを支援するために、新しいプラグインのテストを検討してください!",
|
||||
@@ -247,13 +231,6 @@
|
||||
"testing": "テスト"
|
||||
}
|
||||
},
|
||||
"Testing": {
|
||||
"download": "ダウンロード",
|
||||
"error": "PRのインストールエラー",
|
||||
"header": "Decky Loaderの以下のバージョンは、公開されているサードパーティのPull Requestからビルドされたものです。 Decky Loaderチームはその機能や安全性を検証しておらず、内容も古い可能性があります。",
|
||||
"loading": "Pull Requestの読み込み中...",
|
||||
"start_download_toast": "PR #{{id}}のダウンロード中"
|
||||
},
|
||||
"TitleView": {
|
||||
"decky_store_desc": "Deckyストアを開く",
|
||||
"settings_desc": "Decky設定を開く"
|
||||
|
||||
@@ -205,15 +205,6 @@
|
||||
"testing_title": "Тестирование"
|
||||
},
|
||||
"Store": {
|
||||
"download_progress_info": {
|
||||
"download_zip": "Скачивание плагина",
|
||||
"increment_count": "Увеличение количества загрузок",
|
||||
"installing_plugin": "Установка плагина",
|
||||
"open_zip": "Открытие zip файла",
|
||||
"parse_zip": "Распаковка zip файла",
|
||||
"start": "Инициализация",
|
||||
"uninstalling_previous": "Удаление предыдущей копии"
|
||||
},
|
||||
"store_contrib": {
|
||||
"desc": "Если вы хотите внести свой вклад в магазин плагинов Decky, проверьте репозиторий SteamDeckHomebrew/decky-plugin-template на GitHub. Информация о разработке и распространении доступна в README.",
|
||||
"label": "Помощь проекту"
|
||||
@@ -262,11 +253,7 @@
|
||||
}
|
||||
},
|
||||
"Testing": {
|
||||
"download": "Загрузить",
|
||||
"error": "Ошибка при установке PR",
|
||||
"header": "Данные версии Decky Loader созданы на основе сторонних pull requst. Команда Decky Loader не проверяла их функциональность и безопасность, и они могут быть устаревшими.",
|
||||
"loading": "Загрузка открытых pull requst'ов...",
|
||||
"start_download_toast": "Загрузка PR#{{id}}"
|
||||
"download": "Загрузить"
|
||||
},
|
||||
"TitleView": {
|
||||
"decky_store_desc": "Открыть магазин Decky",
|
||||
|
||||
@@ -37,9 +37,6 @@ def get_live_reload() -> bool:
|
||||
def get_keep_systemd_service() -> bool:
|
||||
return os.getenv("KEEP_SYSTEMD_SERVICE", "0") == "1"
|
||||
|
||||
def get_use_cef_close_workaround() -> bool:
|
||||
return ON_LINUX and os.getenv("USE_CEF_CLOSE_WORKAROUND", "1") == "1"
|
||||
|
||||
def get_log_level() -> int:
|
||||
return {"CRITICAL": 50, "ERROR": 40, "WARNING": 30, "INFO": 20, "DEBUG": 10}[
|
||||
os.getenv("LOG_LEVEL", "INFO")
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from re import compile
|
||||
from asyncio import Lock
|
||||
import os, pwd, grp, sys, logging
|
||||
from subprocess import call, run, DEVNULL, PIPE, STDOUT
|
||||
from ..enums import UserType
|
||||
@@ -203,7 +201,7 @@ def get_unprivileged_path() -> str:
|
||||
path = None
|
||||
|
||||
if path == None:
|
||||
logger.warning("Unprivileged path is not properly configured. Defaulting to /home/deck/homebrew")
|
||||
logger.warn("Unprivileged path is not properly configured. Defaulting to /home/deck/homebrew")
|
||||
path = "/home/deck/homebrew" # We give up
|
||||
|
||||
os.makedirs(path, exist_ok=True)
|
||||
@@ -225,43 +223,7 @@ def get_unprivileged_user() -> str:
|
||||
break
|
||||
|
||||
if user == None:
|
||||
logger.warning("Unprivileged user is not properly configured. Defaulting to 'deck'")
|
||||
logger.warn("Unprivileged user is not properly configured. Defaulting to 'deck'")
|
||||
user = 'deck'
|
||||
|
||||
return user
|
||||
|
||||
# Works around the CEF debugger TCP socket not closing properly when Steam restarts
|
||||
# Group 1 is PID, group 2 is FD. this also filters for "steamwebhelper" in the process name.
|
||||
cef_socket_lsof_regex = compile(r"^p(\d+)(?:\s|.)+csteamwebhelper(?:\s|.)+f(\d+)(?:\s|.)+TST=LISTEN")
|
||||
close_cef_socket_lock = Lock()
|
||||
|
||||
async def close_cef_socket():
|
||||
async with close_cef_socket_lock:
|
||||
if _get_effective_user_id() != 0:
|
||||
logger.warning("Can't close CEF socket as Decky isn't running as root.")
|
||||
return
|
||||
# Look for anything listening TCP on port 8080
|
||||
lsof = run(["lsof", "-F", "-iTCP:8080", "-sTCP:LISTEN"], capture_output=True, text=True)
|
||||
if lsof.returncode != 0 or len(lsof.stdout) < 1:
|
||||
logger.error(f"lsof call failed in close_cef_socket! return code: {str(lsof.returncode)}")
|
||||
return
|
||||
|
||||
lsof_data = cef_socket_lsof_regex.match(lsof.stdout)
|
||||
|
||||
if not lsof_data:
|
||||
logger.error("lsof regex match failed in close_cef_socket!")
|
||||
return
|
||||
|
||||
pid = lsof_data.group(1)
|
||||
fd = lsof_data.group(2)
|
||||
|
||||
logger.info(f"Closing CEF socket with PID {pid} and FD {fd}")
|
||||
|
||||
# Use gdb to inject a close() call for the socket fd into steamwebhelper
|
||||
gdb_ret = run(["gdb", "--nx", "-p", pid, "--batch", "--eval-command", f"call (int)close({fd})"], env={"LD_LIBRARY_PATH": ""})
|
||||
|
||||
if gdb_ret.returncode != 0:
|
||||
logger.error(f"Failed to close CEF socket with gdb! return code: {str(gdb_ret.returncode)}", exc_info=True)
|
||||
return
|
||||
|
||||
logger.info("CEF socket closed")
|
||||
|
||||
@@ -55,7 +55,4 @@ def get_unprivileged_user() -> str:
|
||||
return os.getenv("UNPRIVILEGED_USER", os.getlogin())
|
||||
|
||||
async def restart_webhelper() -> bool:
|
||||
return True # Stubbed
|
||||
|
||||
async def close_cef_socket():
|
||||
return # Stubbed
|
||||
return True # Stubbed
|
||||
@@ -7,24 +7,22 @@ from .localplatform import ON_WINDOWS
|
||||
BUFFER_LIMIT = 2 ** 20 # 1 MiB
|
||||
|
||||
class UnixSocket:
|
||||
def __init__(self):
|
||||
def __init__(self, on_new_message: Callable[[str], Coroutine[Any, Any, Any]]):
|
||||
'''
|
||||
on_new_message takes 1 string argument.
|
||||
It's return value gets used, if not None, to write data to the socket.
|
||||
Method should be async
|
||||
'''
|
||||
self.socket_addr = f"/tmp/plugin_socket_{time.time()}"
|
||||
self.on_new_message = None
|
||||
self.on_new_message = on_new_message
|
||||
self.socket = None
|
||||
self.reader = None
|
||||
self.writer = None
|
||||
self.server_writer = None
|
||||
self.open_lock = asyncio.Lock()
|
||||
self.active = True
|
||||
|
||||
async def setup_server(self, on_new_message: Callable[[str], Coroutine[Any, Any, Any]]):
|
||||
async def setup_server(self):
|
||||
try:
|
||||
self.on_new_message = on_new_message
|
||||
self.socket = await asyncio.start_unix_server(self._listen_for_method_call, path=self.socket_addr, limit=BUFFER_LIMIT)
|
||||
except asyncio.CancelledError:
|
||||
await self.close_socket_connection()
|
||||
@@ -60,8 +58,6 @@ class UnixSocket:
|
||||
if self.socket:
|
||||
self.socket.close()
|
||||
await self.socket.wait_closed()
|
||||
|
||||
self.active = False
|
||||
|
||||
async def read_single_line(self) -> str|None:
|
||||
reader, _ = await self.get_socket_connection()
|
||||
@@ -85,7 +81,7 @@ class UnixSocket:
|
||||
|
||||
async def _read_single_line(self, reader: asyncio.StreamReader) -> str:
|
||||
line = bytearray()
|
||||
while self.active:
|
||||
while True:
|
||||
try:
|
||||
line.extend(await reader.readuntil())
|
||||
except asyncio.LimitOverrunError:
|
||||
@@ -95,7 +91,7 @@ class UnixSocket:
|
||||
line.extend(err.partial)
|
||||
break
|
||||
except asyncio.CancelledError:
|
||||
raise
|
||||
break
|
||||
else:
|
||||
break
|
||||
|
||||
@@ -115,7 +111,7 @@ class UnixSocket:
|
||||
|
||||
async def _listen_for_method_call(self, reader: asyncio.StreamReader, writer: asyncio.StreamWriter):
|
||||
self.server_writer = writer
|
||||
while self.active and self.on_new_message:
|
||||
while True:
|
||||
|
||||
def _(task: asyncio.Task[str|None]):
|
||||
res = task.result()
|
||||
@@ -126,19 +122,18 @@ class UnixSocket:
|
||||
asyncio.create_task(self.on_new_message(line)).add_done_callback(_)
|
||||
|
||||
class PortSocket (UnixSocket):
|
||||
def __init__(self):
|
||||
def __init__(self, on_new_message: Callable[[str], Coroutine[Any, Any, Any]]):
|
||||
'''
|
||||
on_new_message takes 1 string argument.
|
||||
It's return value gets used, if not None, to write data to the socket.
|
||||
Method should be async
|
||||
'''
|
||||
super().__init__()
|
||||
super().__init__(on_new_message)
|
||||
self.host = "127.0.0.1"
|
||||
self.port = random.sample(range(40000, 60000), 1)[0]
|
||||
|
||||
async def setup_server(self, on_new_message: Callable[[str], Coroutine[Any, Any, Any]]):
|
||||
async def setup_server(self):
|
||||
try:
|
||||
self.on_new_message = on_new_message
|
||||
self.socket = await asyncio.start_server(self._listen_for_method_call, host=self.host, port=self.port, limit=BUFFER_LIMIT)
|
||||
except asyncio.CancelledError:
|
||||
await self.close_socket_connection()
|
||||
|
||||
@@ -7,17 +7,14 @@ from .localplatform.localplatform import (chmod, chown, service_stop, service_st
|
||||
get_privileged_path, restart_webhelper)
|
||||
if hasattr(sys, '_MEIPASS'):
|
||||
chmod(sys._MEIPASS, 755) # type: ignore
|
||||
|
||||
# Full imports
|
||||
import multiprocessing
|
||||
multiprocessing.freeze_support()
|
||||
from asyncio import AbstractEventLoop, CancelledError, Task, all_tasks, current_task, gather, new_event_loop, set_event_loop, sleep
|
||||
from logging import basicConfig, getLogger
|
||||
from os import path
|
||||
from traceback import format_exc
|
||||
from time import time
|
||||
import aiohttp_cors # pyright: ignore [reportMissingTypeStubs]
|
||||
import multiprocessing
|
||||
|
||||
import aiohttp_cors # pyright: ignore [reportMissingTypeStubs]
|
||||
# Partial imports
|
||||
from aiohttp import client_exceptions
|
||||
from aiohttp.web import Application, Response, Request, get, run_app, static # pyright: ignore [reportUnknownVariableType]
|
||||
@@ -26,7 +23,7 @@ from setproctitle import getproctitle, setproctitle, setthreadtitle
|
||||
|
||||
# local modules
|
||||
from .browser import PluginBrowser
|
||||
from .helpers import (REMOTE_DEBUGGER_UNIT, create_inject_script, csrf_middleware, get_csrf_token, get_loader_version,
|
||||
from .helpers import (REMOTE_DEBUGGER_UNIT, csrf_middleware, get_csrf_token, get_loader_version,
|
||||
mkdir_as_user, get_system_pythonpaths, get_effective_user_id)
|
||||
|
||||
from .injector import get_gamepadui_tab, Tab
|
||||
@@ -76,9 +73,6 @@ class PluginManager:
|
||||
self.plugin_browser = PluginBrowser(plugin_path, self.plugin_loader.plugins, self.plugin_loader, self.settings)
|
||||
self.utilities = Utilities(self)
|
||||
self.updater = Updater(self)
|
||||
self.last_webhelper_exit: float = 0
|
||||
self.webhelper_crash_count: int = 0
|
||||
self.inject_fallback: bool = False
|
||||
|
||||
jinja_setup(self.web_app)
|
||||
|
||||
@@ -100,33 +94,12 @@ class PluginManager:
|
||||
self.cors.add(route) # pyright: ignore [reportUnknownMemberType]
|
||||
self.web_app.add_routes([static("/static", path.join(path.dirname(__file__), 'static'))])
|
||||
|
||||
async def handle_crash(self):
|
||||
if not self.reinject:
|
||||
return
|
||||
new_time = time()
|
||||
if (new_time - self.last_webhelper_exit < 60):
|
||||
self.webhelper_crash_count += 1
|
||||
logger.warning(f"webhelper crashed within a minute from last crash! crash count: {self.webhelper_crash_count}")
|
||||
else:
|
||||
self.webhelper_crash_count = 0
|
||||
self.last_webhelper_exit = new_time
|
||||
|
||||
# should never happen
|
||||
if (self.webhelper_crash_count > 4):
|
||||
await self.updater.do_shutdown()
|
||||
# Give up
|
||||
exit(0)
|
||||
|
||||
async def shutdown(self, _: Application):
|
||||
try:
|
||||
logger.info(f"Shutting down...")
|
||||
logger.info("Disabling reload...")
|
||||
await self.plugin_loader.disable_reload()
|
||||
logger.info("Killing plugins...")
|
||||
await self.plugin_loader.shutdown_plugins()
|
||||
logger.info("Disconnecting from WS...")
|
||||
self.reinject = False
|
||||
await self.ws.disconnect()
|
||||
self.reinject = False
|
||||
if self.js_ctx_tab:
|
||||
await self.js_ctx_tab.close_websocket()
|
||||
self.js_ctx_tab = None
|
||||
@@ -147,7 +120,7 @@ class PluginManager:
|
||||
pass
|
||||
logger.debug(f"Task {task} finished")
|
||||
except:
|
||||
logger.warning(f"Failed to cancel task {task}:\n" + format_exc())
|
||||
logger.warn(f"Failed to cancel task {task}:\n" + format_exc())
|
||||
pass
|
||||
if current:
|
||||
tasks.remove(current)
|
||||
@@ -212,7 +185,6 @@ class PluginManager:
|
||||
# If this is a forceful disconnect the loop will just stop without any failure message. In this case, injector.py will handle this for us so we don't need to close the socket.
|
||||
# This is because of https://github.com/aio-libs/aiohttp/blob/3ee7091b40a1bc58a8d7846e7878a77640e96996/aiohttp/client_ws.py#L321
|
||||
logger.info("CEF has disconnected...")
|
||||
await self.handle_crash()
|
||||
# At this point the loop starts again and we connect to the freshly started Steam client once it is ready.
|
||||
except Exception:
|
||||
if not self.reinject:
|
||||
@@ -220,7 +192,6 @@ class PluginManager:
|
||||
logger.error("Exception while reading page events " + format_exc())
|
||||
await tab.close_websocket()
|
||||
self.js_ctx_tab = None
|
||||
await self.handle_crash()
|
||||
pass
|
||||
# while True:
|
||||
# await sleep(5)
|
||||
@@ -238,11 +209,7 @@ class PluginManager:
|
||||
await restart_webhelper()
|
||||
await sleep(1) # To give CEF enough time to close down the websocket
|
||||
return # We'll catch the next tab in the main loop
|
||||
await tab.evaluate_js(create_inject_script("index.js" if self.webhelper_crash_count < 3 else "fallback.js"), False, False, False)
|
||||
if self.webhelper_crash_count > 2:
|
||||
self.reinject = False
|
||||
await sleep(1)
|
||||
await self.updater.do_shutdown()
|
||||
await tab.evaluate_js("try{if (window.deckyHasLoaded){setTimeout(() => SteamClient.Browser.RestartJSContext(), 100)}else{window.deckyHasLoaded = true;(async()=>{try{await import('http://localhost:1337/frontend/index.js?v=%s')}catch(e){console.error(e)};})();}}catch(e){console.error(e)}" % (get_loader_version(), ), False, False, False)
|
||||
except:
|
||||
logger.info("Failed to inject JavaScript into tab\n" + format_exc())
|
||||
pass
|
||||
@@ -257,6 +224,9 @@ def main():
|
||||
# Fix windows/flask not recognising that .js means 'application/javascript'
|
||||
import mimetypes
|
||||
mimetypes.add_type('application/javascript', '.js')
|
||||
|
||||
# Required for multiprocessing support in frozen files
|
||||
multiprocessing.freeze_support()
|
||||
else:
|
||||
if get_effective_user_id() != 0:
|
||||
logger.warning(f"decky is running as an unprivileged user, this is not officially supported and may cause issues")
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
from asyncio import CancelledError, Task, create_task, sleep, wait
|
||||
from asyncio import CancelledError, Task, create_task, sleep
|
||||
from json import dumps, load, loads
|
||||
from logging import getLogger
|
||||
from os import path
|
||||
from multiprocessing import Process
|
||||
from time import time
|
||||
from traceback import format_exc
|
||||
|
||||
from .sandboxed_plugin import SandboxedPlugin
|
||||
from .messages import MethodCallRequest, SocketMessageType
|
||||
@@ -44,7 +42,8 @@ class PluginWrapper:
|
||||
|
||||
self.sandboxed_plugin = SandboxedPlugin(self.name, self.passive, self.flags, self.file, self.plugin_directory, self.plugin_path, self.version, self.author, self.api_version)
|
||||
self.proc: Process | None = None
|
||||
self._socket = LocalSocket()
|
||||
# TODO: Maybe make LocalSocket not require on_new_message to make this cleaner
|
||||
self._socket = LocalSocket(self.sandboxed_plugin.on_new_message)
|
||||
self._listener_task: Task[Any]
|
||||
self._method_call_requests: Dict[str, MethodCallRequest] = {}
|
||||
|
||||
@@ -66,7 +65,7 @@ class PluginWrapper:
|
||||
return self.name
|
||||
|
||||
async def _response_listener(self):
|
||||
while self._socket.active:
|
||||
while True:
|
||||
try:
|
||||
line = await self._socket.read_single_line()
|
||||
if line != None:
|
||||
@@ -85,7 +84,7 @@ class PluginWrapper:
|
||||
async def execute_legacy_method(self, method_name: str, kwargs: Dict[Any, Any]):
|
||||
if not self.legacy_method_warning:
|
||||
self.legacy_method_warning = True
|
||||
self.log.warning(f"Plugin {self.name} is using legacy method calls. This will be removed in a future release.")
|
||||
self.log.warn(f"Plugin {self.name} is using legacy method calls. This will be removed in a future release.")
|
||||
if self.passive:
|
||||
raise RuntimeError("This plugin is passive (aka does not implement main.py)")
|
||||
|
||||
@@ -116,40 +115,29 @@ class PluginWrapper:
|
||||
return self
|
||||
|
||||
async def stop(self, uninstall: bool = False):
|
||||
try:
|
||||
start_time = time()
|
||||
if self.passive:
|
||||
return
|
||||
|
||||
_, pending = await wait([
|
||||
create_task(self._socket.write_single_line(dumps({ "stop": True, "uninstall": uninstall }, ensure_ascii=False)))
|
||||
], timeout=1)
|
||||
|
||||
if hasattr(self, "_listener_task"):
|
||||
self._listener_task.cancel()
|
||||
|
||||
await self.kill_if_still_running()
|
||||
|
||||
for pending_task in pending:
|
||||
pending_task.cancel()
|
||||
|
||||
self.log.info(f"Plugin {self.name} has been stopped in {time() - start_time:.1f}s")
|
||||
except Exception as e:
|
||||
self.log.error(f"Error during shutdown for plugin {self.name}: {str(e)}\n{format_exc()}")
|
||||
self.log.info(f"Stopping plugin {self.name}")
|
||||
if self.passive:
|
||||
return
|
||||
if hasattr(self, "_socket"):
|
||||
await self._socket.write_single_line(dumps({ "stop": True, "uninstall": uninstall }, ensure_ascii=False))
|
||||
await self._socket.close_socket_connection()
|
||||
if self.proc:
|
||||
self.proc.join()
|
||||
await self.kill_if_still_running()
|
||||
if hasattr(self, "_listener_task"):
|
||||
self._listener_task.cancel()
|
||||
|
||||
async def kill_if_still_running(self):
|
||||
start_time = time()
|
||||
sigtermed = False
|
||||
time = 0
|
||||
while self.proc and self.proc.is_alive():
|
||||
elapsed_time = time() - start_time
|
||||
if elapsed_time >= 5 and not sigtermed:
|
||||
sigtermed = True
|
||||
self.log.warning(f"Plugin {self.name} still alive 5 seconds after stop request! Sending SIGTERM!")
|
||||
self.terminate()
|
||||
elif elapsed_time >= 10:
|
||||
self.log.warning(f"Plugin {self.name} still alive 10 seconds after stop request! Sending SIGKILL!")
|
||||
self.terminate(True)
|
||||
await sleep(0.1)
|
||||
time += 1
|
||||
if time == 100:
|
||||
self.log.warn(f"Plugin {self.name} still alive 10 seconds after stop request! Sending SIGTERM!")
|
||||
self.terminate()
|
||||
elif time == 200:
|
||||
self.log.warn(f"Plugin {self.name} still alive 20 seconds after stop request! Sending SIGKILL!")
|
||||
self.terminate(True)
|
||||
|
||||
def terminate(self, kill: bool = False):
|
||||
if self.proc and self.proc.is_alive():
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import sys
|
||||
from os import path, environ
|
||||
from signal import SIG_IGN, SIGINT, SIGTERM, getsignal, signal
|
||||
from importlib.util import module_from_spec, spec_from_file_location
|
||||
from json import dumps, loads
|
||||
from logging import getLogger
|
||||
from sys import exit, path as syspath, modules as sysmodules
|
||||
from traceback import format_exc
|
||||
from asyncio import (get_event_loop, new_event_loop,
|
||||
set_event_loop)
|
||||
@@ -12,12 +13,14 @@ from .messages import SocketResponseDict, SocketMessageType
|
||||
from ..localplatform.localsocket import LocalSocket
|
||||
from ..localplatform.localplatform import setgid, setuid, get_username, get_home_path
|
||||
from ..enums import UserType
|
||||
from .. import helpers, settings, injector # pyright: ignore [reportUnusedImport]
|
||||
from .. import helpers
|
||||
|
||||
from typing import List, TypeVar, Any
|
||||
|
||||
DataType = TypeVar("DataType")
|
||||
|
||||
original_term_handler = getsignal(SIGTERM)
|
||||
|
||||
class SandboxedPlugin:
|
||||
def __init__(self,
|
||||
name: str,
|
||||
@@ -45,6 +48,11 @@ class SandboxedPlugin:
|
||||
self._socket = socket
|
||||
|
||||
try:
|
||||
# Ignore signals meant for parent Process
|
||||
# TODO SURELY there's a better way to do this.
|
||||
signal(SIGINT, SIG_IGN)
|
||||
signal(SIGTERM, SIG_IGN)
|
||||
|
||||
setproctitle(f"{self.name} ({self.file})")
|
||||
setthreadtitle(self.name)
|
||||
|
||||
@@ -70,12 +78,12 @@ class SandboxedPlugin:
|
||||
environ["DECKY_PLUGIN_AUTHOR"] = self.author
|
||||
|
||||
# append the plugin's `py_modules` to the recognized python paths
|
||||
sys.path.append(path.join(environ["DECKY_PLUGIN_DIR"], "py_modules"))
|
||||
syspath.append(path.join(environ["DECKY_PLUGIN_DIR"], "py_modules"))
|
||||
|
||||
#TODO: FIX IN A LESS CURSED WAY
|
||||
keys = [key for key in sys.modules if key.startswith("decky_loader.")]
|
||||
keys = [key for key in sysmodules if key.startswith("decky_loader.")]
|
||||
for key in keys:
|
||||
sys.modules[key.replace("decky_loader.", "")] = sys.modules[key]
|
||||
sysmodules[key.replace("decky_loader.", "")] = sysmodules[key]
|
||||
|
||||
from .imports import decky
|
||||
async def emit(event: str, *args: Any) -> None:
|
||||
@@ -87,9 +95,9 @@ class SandboxedPlugin:
|
||||
# copy the docstring over so we don't have to duplicate it
|
||||
emit.__doc__ = decky.emit.__doc__
|
||||
decky.emit = emit
|
||||
sys.modules["decky"] = decky
|
||||
sysmodules["decky"] = decky
|
||||
# provided for compatibility
|
||||
sys.modules["decky_plugin"] = decky
|
||||
sysmodules["decky_plugin"] = decky
|
||||
|
||||
spec = spec_from_file_location("_", self.file)
|
||||
assert spec is not None
|
||||
@@ -112,10 +120,10 @@ class SandboxedPlugin:
|
||||
get_event_loop().create_task(self.Plugin._main())
|
||||
else:
|
||||
get_event_loop().create_task(self.Plugin._main(self.Plugin))
|
||||
get_event_loop().create_task(socket.setup_server(self.on_new_message))
|
||||
get_event_loop().create_task(socket.setup_server())
|
||||
except:
|
||||
self.log.error("Failed to start " + self.name + "!\n" + format_exc())
|
||||
sys.exit(0)
|
||||
exit(0)
|
||||
try:
|
||||
get_event_loop().run_forever()
|
||||
except SystemExit:
|
||||
@@ -159,6 +167,8 @@ class SandboxedPlugin:
|
||||
data = loads(message)
|
||||
|
||||
if "stop" in data:
|
||||
# Incase the loader needs to terminate our process soon
|
||||
signal(SIGTERM, original_term_handler)
|
||||
self.log.info(f"Calling Loader unload function for {self.name}.")
|
||||
await self._unload()
|
||||
|
||||
@@ -170,7 +180,7 @@ class SandboxedPlugin:
|
||||
|
||||
loop = get_event_loop()
|
||||
loop.call_soon_threadsafe(loop.stop)
|
||||
sys.exit(0)
|
||||
exit(0)
|
||||
|
||||
d: SocketResponseDict = {"type": SocketMessageType.RESPONSE, "res": None, "success": True, "id": data["id"]}
|
||||
try:
|
||||
|
||||
@@ -20,8 +20,9 @@ from .browser import PluginInstallRequest, PluginInstallType
|
||||
if TYPE_CHECKING:
|
||||
from .main import PluginManager
|
||||
from .injector import inject_to_tab, get_gamepadui_tab, close_old_tabs, get_tab
|
||||
from .localplatform.localplatform import ON_WINDOWS
|
||||
from . import helpers
|
||||
from .localplatform.localplatform import ON_WINDOWS, service_stop, service_start, get_home_path, get_username, get_use_cef_close_workaround, close_cef_socket, restart_webhelper
|
||||
from .localplatform.localplatform import service_stop, service_start, get_home_path, get_username
|
||||
|
||||
class FilePickerObj(TypedDict):
|
||||
file: Path
|
||||
@@ -77,8 +78,6 @@ class Utilities:
|
||||
context.ws.add_route("utilities/get_tab_id", self.get_tab_id)
|
||||
context.ws.add_route("utilities/get_user_info", self.get_user_info)
|
||||
context.ws.add_route("utilities/http_request", self.http_request_legacy)
|
||||
context.ws.add_route("utilities/restart_webhelper", self.restart_webhelper)
|
||||
context.ws.add_route("utilities/close_cef_socket", self.close_cef_socket)
|
||||
context.ws.add_route("utilities/_call_legacy_utility", self._call_legacy_utility)
|
||||
|
||||
context.web_app.add_routes([
|
||||
@@ -288,13 +287,6 @@ class Utilities:
|
||||
await service_stop(helpers.SSHD_UNIT)
|
||||
return True
|
||||
|
||||
async def close_cef_socket(self):
|
||||
if get_use_cef_close_workaround():
|
||||
await close_cef_socket()
|
||||
|
||||
async def restart_webhelper(self):
|
||||
await restart_webhelper()
|
||||
|
||||
async def filepicker_ls(self,
|
||||
path: str | None = None,
|
||||
include_files: bool = True,
|
||||
|
||||
@@ -50,7 +50,7 @@ class WSRouter:
|
||||
if self.ws != None:
|
||||
await self.ws.send_json(data)
|
||||
else:
|
||||
self.logger.warning("Dropping message as there is no connected socket: %s", data)
|
||||
self.logger.warn("Dropping message as there is no connected socket: %s", data)
|
||||
|
||||
def add_route(self, name: str, route: Route):
|
||||
self.routes[name] = route
|
||||
@@ -69,9 +69,9 @@ class WSRouter:
|
||||
|
||||
if instance_id != self.instance_id:
|
||||
try:
|
||||
self.logger.warning("Ignoring %s reply from stale instance %d with args %s and response %s", route, instance_id, args, res)
|
||||
self.logger.warn("Ignoring %s reply from stale instance %d with args %s and response %s", route, instance_id, args, res)
|
||||
except:
|
||||
self.logger.warning("Ignoring %s reply from stale instance %d (failed to log event data)", route, instance_id)
|
||||
self.logger.warn("Ignoring %s reply from stale instance %d (failed to log event data)", route, instance_id)
|
||||
finally:
|
||||
return
|
||||
|
||||
|
||||
Vendored
-3
@@ -34,13 +34,10 @@ curl -L https://raw.githubusercontent.com/SteamDeckHomebrew/decky-loader/main/di
|
||||
cat > "${HOMEBREW_FOLDER}/services/plugin_loader-backup.service" <<- EOM
|
||||
[Unit]
|
||||
Description=SteamDeck Plugin Loader
|
||||
After=network.target
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
Restart=always
|
||||
KillMode=process
|
||||
TimeoutStopSec=45
|
||||
ExecStart=${HOMEBREW_FOLDER}/services/PluginLoader
|
||||
WorkingDirectory=${HOMEBREW_FOLDER}/services
|
||||
Environment=UNPRIVILEGED_PATH=${HOMEBREW_FOLDER}
|
||||
|
||||
Vendored
-3
@@ -34,13 +34,10 @@ curl -L https://raw.githubusercontent.com/SteamDeckHomebrew/decky-loader/main/di
|
||||
cat > "${HOMEBREW_FOLDER}/services/plugin_loader-backup.service" <<- EOM
|
||||
[Unit]
|
||||
Description=SteamDeck Plugin Loader
|
||||
After=network.target
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
Restart=always
|
||||
KillMode=process
|
||||
TimeoutStopSec=45
|
||||
ExecStart=${HOMEBREW_FOLDER}/services/PluginLoader
|
||||
WorkingDirectory=${HOMEBREW_FOLDER}/services
|
||||
Environment=UNPRIVILEGED_PATH=${HOMEBREW_FOLDER}
|
||||
|
||||
-2
@@ -1,11 +1,9 @@
|
||||
[Unit]
|
||||
Description=SteamDeck Plugin Loader
|
||||
After=network.target
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
Restart=always
|
||||
KillMode=process
|
||||
TimeoutStopSec=45
|
||||
ExecStart=${HOMEBREW_FOLDER}/services/PluginLoader
|
||||
WorkingDirectory=${HOMEBREW_FOLDER}/services
|
||||
|
||||
Vendored
-2
@@ -1,11 +1,9 @@
|
||||
[Unit]
|
||||
Description=SteamDeck Plugin Loader
|
||||
After=network.target
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
Restart=always
|
||||
KillMode=process
|
||||
TimeoutStopSec=45
|
||||
ExecStart=${HOMEBREW_FOLDER}/services/PluginLoader
|
||||
WorkingDirectory=${HOMEBREW_FOLDER}/services
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@decky/ui": "^4.7.1",
|
||||
"@decky/ui": "^4.7.0",
|
||||
"filesize": "^10.1.2",
|
||||
"i18next": "^23.11.5",
|
||||
"i18next-http-backend": "^2.5.2",
|
||||
|
||||
Generated
+5
-5
@@ -9,8 +9,8 @@ importers:
|
||||
.:
|
||||
dependencies:
|
||||
'@decky/ui':
|
||||
specifier: ^4.7.1
|
||||
version: 4.7.1
|
||||
specifier: ^4.7.0
|
||||
version: 4.7.0
|
||||
filesize:
|
||||
specifier: ^10.1.2
|
||||
version: 10.1.2
|
||||
@@ -215,8 +215,8 @@ packages:
|
||||
'@decky/api@1.1.1':
|
||||
resolution: {integrity: sha512-R5fkBRHBt5QIQY7Q0AlbVIhlIZ/nTzwBOoi8Rt4Go2fjFnoMKPInCJl6cPjXzimGwl2pyqKJgY6VnH6ar0XrHQ==}
|
||||
|
||||
'@decky/ui@4.7.1':
|
||||
resolution: {integrity: sha512-yJwBgW+J2cMDfMkmcDFtzsubhUjekFZAtCnP55QEJ/1UKGR7sLNOvDLFYi1h5PI0K4L1XYcAMKHwbYFFTzcDTA==}
|
||||
'@decky/ui@4.7.0':
|
||||
resolution: {integrity: sha512-klNWF5tnZVqzuUgFbw+pThiZjK7gKEtwbEZAo4aAuPJSVobpl/euTx9NAxY95QPCFMDgxCo6X6ioEA2nMfHfLA==}
|
||||
|
||||
'@esbuild/aix-ppc64@0.20.2':
|
||||
resolution: {integrity: sha512-D+EBOJHXdNZcLJRBkhENNG8Wji2kgc9AZ9KiPr1JuZjsNtyHzrsfLRrY0tk2H2aoFu6RANO1y1iPPUCDYWkb5g==}
|
||||
@@ -2289,7 +2289,7 @@ snapshots:
|
||||
|
||||
'@decky/api@1.1.1': {}
|
||||
|
||||
'@decky/ui@4.7.1': {}
|
||||
'@decky/ui@4.7.0': {}
|
||||
|
||||
'@esbuild/aix-ppc64@0.20.2':
|
||||
optional: true
|
||||
|
||||
+44
-58
@@ -11,62 +11,48 @@ import { visualizer } from 'rollup-plugin-visualizer';
|
||||
|
||||
const hiddenWarnings = ['THIS_IS_UNDEFINED', 'EVAL'];
|
||||
|
||||
export default defineConfig([
|
||||
// Main bundle
|
||||
{
|
||||
input: 'src/index.ts',
|
||||
plugins: [
|
||||
del({ targets: ['../backend/decky_loader/static/*', '!../backend/decky_loader/static/fallback.js'], force: true }),
|
||||
commonjs(),
|
||||
nodeResolve({
|
||||
browser: true,
|
||||
}),
|
||||
externalGlobals({
|
||||
react: 'SP_REACT',
|
||||
'react-dom': 'SP_REACTDOM',
|
||||
// hack to shut up react-markdown
|
||||
process: '{cwd: () => {}}',
|
||||
path: '{dirname: () => {}, join: () => {}, basename: () => {}, extname: () => {}}',
|
||||
url: '{fileURLToPath: (f) => f}',
|
||||
}),
|
||||
typescript(),
|
||||
json(),
|
||||
replace({
|
||||
preventAssignment: false,
|
||||
'process.env.NODE_ENV': JSON.stringify('production'),
|
||||
}),
|
||||
image(),
|
||||
visualizer(),
|
||||
],
|
||||
preserveEntrySignatures: false,
|
||||
treeshake: {
|
||||
// Assume all external modules have imports with side effects (the default) while allowing decky libraries to treeshake
|
||||
pureExternalImports: true,
|
||||
preset: 'smallest'
|
||||
},
|
||||
output: {
|
||||
dir: '../backend/decky_loader/static',
|
||||
format: 'esm',
|
||||
chunkFileNames: (chunkInfo) => {
|
||||
return 'chunk-[hash].js';
|
||||
},
|
||||
sourcemap: true,
|
||||
sourcemapPathTransform: (relativeSourcePath) => relativeSourcePath.replace(/^\.\.\//, `decky://decky/loader/`),
|
||||
},
|
||||
onwarn: function (message, handleWarning) {
|
||||
if (hiddenWarnings.some((warning) => message.code === warning)) return;
|
||||
handleWarning(message);
|
||||
},
|
||||
export default defineConfig({
|
||||
input: 'src/index.ts',
|
||||
plugins: [
|
||||
del({ targets: '../backend/decky_loader/static/*', force: true }),
|
||||
commonjs(),
|
||||
nodeResolve({
|
||||
browser: true,
|
||||
}),
|
||||
externalGlobals({
|
||||
react: 'SP_REACT',
|
||||
'react-dom': 'SP_REACTDOM',
|
||||
// hack to shut up react-markdown
|
||||
process: '{cwd: () => {}}',
|
||||
path: '{dirname: () => {}, join: () => {}, basename: () => {}, extname: () => {}}',
|
||||
url: '{fileURLToPath: (f) => f}',
|
||||
}),
|
||||
typescript(),
|
||||
json(),
|
||||
replace({
|
||||
preventAssignment: false,
|
||||
'process.env.NODE_ENV': JSON.stringify('production'),
|
||||
}),
|
||||
image(),
|
||||
visualizer(),
|
||||
],
|
||||
preserveEntrySignatures: false,
|
||||
treeshake: {
|
||||
// Assume all external modules have imports with side effects (the default) while allowing decky libraries to treeshake
|
||||
pureExternalImports: true,
|
||||
preset: 'smallest'
|
||||
},
|
||||
// Fallback
|
||||
{
|
||||
input: 'src/fallback.ts',
|
||||
plugins: [
|
||||
typescript()
|
||||
],
|
||||
output: {
|
||||
file: '../backend/decky_loader/static/fallback.js',
|
||||
format: 'esm',
|
||||
}
|
||||
}
|
||||
]);
|
||||
output: {
|
||||
dir: '../backend/decky_loader/static',
|
||||
format: 'esm',
|
||||
chunkFileNames: (chunkInfo) => {
|
||||
return 'chunk-[hash].js';
|
||||
},
|
||||
sourcemap: true,
|
||||
sourcemapPathTransform: (relativeSourcePath) => relativeSourcePath.replace(/^\.\.\//, `decky://decky/loader/`),
|
||||
},
|
||||
onwarn: function (message, handleWarning) {
|
||||
if (hiddenWarnings.some((warning) => message.code === warning)) return;
|
||||
handleWarning(message);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -94,7 +94,7 @@ const DeckyErrorBoundary: FunctionComponent<DeckyErrorBoundaryProps> = ({ error,
|
||||
style={{ marginRight: '5px', padding: '5px' }}
|
||||
onClick={() => {
|
||||
addLogLine('Restarting Steam...');
|
||||
SteamClient.User.StartRestart(false);
|
||||
SteamClient.User.StartRestart();
|
||||
}}
|
||||
>
|
||||
Restart Steam
|
||||
@@ -121,7 +121,7 @@ const DeckyErrorBoundary: FunctionComponent<DeckyErrorBoundaryProps> = ({ error,
|
||||
doShutdown();
|
||||
await sleep(5000);
|
||||
addLogLine('Restarting Steam...');
|
||||
SteamClient.User.StartRestart(false);
|
||||
SteamClient.User.StartRestart();
|
||||
}}
|
||||
>
|
||||
Disable Decky until next boot
|
||||
@@ -166,7 +166,7 @@ const DeckyErrorBoundary: FunctionComponent<DeckyErrorBoundaryProps> = ({ error,
|
||||
await sleep(2000);
|
||||
addLogLine('Restarting Steam...');
|
||||
await sleep(500);
|
||||
SteamClient.User.StartRestart(false);
|
||||
SteamClient.User.StartRestart();
|
||||
}}
|
||||
>
|
||||
Uninstall {errorSource} and restart Decky
|
||||
|
||||
@@ -66,6 +66,8 @@ function PluginInteractables(props: { entry: ReorderableEntry<PluginTableData> }
|
||||
} catch (err) {
|
||||
console.error('Error Reloading Plugin Backend', err);
|
||||
}
|
||||
|
||||
DeckyPluginLoader.importPlugin(name, version);
|
||||
}}
|
||||
>
|
||||
{t('PluginListIndex.reload')}
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
// THIS FILE MUST BE ENTIRELY SELF-CONTAINED! DO NOT USE PACKAGES!
|
||||
interface Window {
|
||||
FocusNavController: any;
|
||||
GamepadNavTree: any;
|
||||
deckyFallbackLoaded?: boolean;
|
||||
}
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
if (window.deckyFallbackLoaded) return;
|
||||
window.deckyFallbackLoaded = true;
|
||||
|
||||
// #region utils
|
||||
function sleep(ms: number) {
|
||||
return new Promise((res) => setTimeout(res, ms));
|
||||
}
|
||||
// #endregion
|
||||
|
||||
// #region DeckyIcon
|
||||
const fallbackIcon = `
|
||||
<svg class="fallbackDeckyIcon" xmlns="http://www.w3.org/2000/svg" height="100%" width="100%" viewBox="0 0 512 456">
|
||||
<g>
|
||||
<path
|
||||
style="fill: none;"
|
||||
d="M154.33,72.51v49.79c11.78-0.17,23.48,2,34.42,6.39c10.93,4.39,20.89,10.91,29.28,19.18
|
||||
c8.39,8.27,15.06,18.13,19.61,29c4.55,10.87,6.89,22.54,6.89,34.32c0,11.78-2.34,23.45-6.89,34.32
|
||||
c-4.55,10.87-11.21,20.73-19.61,29c-8.39,8.27-18.35,14.79-29.28,19.18c-10.94,4.39-22.63,6.56-34.42,6.39v49.77
|
||||
c36.78,0,72.05-14.61,98.05-40.62c26-26.01,40.61-61.28,40.61-98.05c0-36.78-14.61-72.05-40.61-98.05
|
||||
C226.38,87.12,191.11,72.51,154.33,72.51z"
|
||||
/>
|
||||
|
||||
<ellipse
|
||||
transform="matrix(0.982 -0.1891 0.1891 0.982 -37.1795 32.9988)"
|
||||
style="fill: none;"
|
||||
cx="154.33"
|
||||
cy="211.33"
|
||||
rx="69.33"
|
||||
ry="69.33"
|
||||
/>
|
||||
<path style="fill: none;" d="M430,97h-52v187h52c7.18,0,13-5.82,13-13V110C443,102.82,437.18,97,430,97z" />
|
||||
<path
|
||||
style="fill: currentColor;"
|
||||
d="M432,27h-54V0H0v361c0,52.47,42.53,95,95,95h188c52.47,0,95-42.53,95-95v-7h54c44.18,0,80-35.82,80-80V107
|
||||
C512,62.82,476.18,27,432,27z M85,211.33c0-38.29,31.04-69.33,69.33-69.33c38.29,0,69.33,31.04,69.33,69.33
|
||||
c0,38.29-31.04,69.33-69.33,69.33C116.04,280.67,85,249.62,85,211.33z M252.39,309.23c-26.01,26-61.28,40.62-98.05,40.62v-49.77
|
||||
c11.78,0.17,23.48-2,34.42-6.39c10.93-4.39,20.89-10.91,29.28-19.18c8.39-8.27,15.06-18.13,19.61-29
|
||||
c4.55-10.87,6.89-22.53,6.89-34.32c0-11.78-2.34-23.45-6.89-34.32c-4.55-10.87-11.21-20.73-19.61-29
|
||||
c-8.39-8.27-18.35-14.79-29.28-19.18c-10.94-4.39-22.63-6.56-34.42-6.39V72.51c36.78,0,72.05,14.61,98.05,40.61
|
||||
c26,26.01,40.61,61.28,40.61,98.05C293,247.96,278.39,283.23,252.39,309.23z M443,271c0,7.18-5.82,13-13,13h-52V97h52
|
||||
c7.18,0,13,5.82,13,13V271z"
|
||||
/>
|
||||
</g>
|
||||
</svg>
|
||||
`;
|
||||
// #endregion
|
||||
|
||||
// #region findSP
|
||||
// from @decky/ui
|
||||
function getFocusNavController(): any {
|
||||
return window.GamepadNavTree?.m_context?.m_controller || window.FocusNavController;
|
||||
}
|
||||
|
||||
function getGamepadNavigationTrees(): any {
|
||||
const focusNav = getFocusNavController();
|
||||
const context = focusNav.m_ActiveContext || focusNav.m_LastActiveContext;
|
||||
return context?.m_rgGamepadNavigationTrees;
|
||||
}
|
||||
|
||||
function findSP(): Window {
|
||||
// old (SP as host)
|
||||
if (document.title == 'SP') return window;
|
||||
// new (SP as popup)
|
||||
const navTrees = getGamepadNavigationTrees();
|
||||
return navTrees?.find((x: any) => x.m_ID == 'root_1_').Root.Element.ownerDocument.defaultView;
|
||||
}
|
||||
// #endregion
|
||||
|
||||
const fallbackCSS = `
|
||||
.fallbackContainer {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
flex-direction: column;
|
||||
z-index: 99999999;
|
||||
pointer-events: none;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
backdrop-filter: blur(8px) brightness(40%);
|
||||
}
|
||||
.fallbackDeckyIcon {
|
||||
width: 96px;
|
||||
height: 96px;
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
`;
|
||||
|
||||
const fallbackHTML = `
|
||||
<style>${fallbackCSS}</style>
|
||||
${fallbackIcon}
|
||||
<span class="fallbackText">
|
||||
<b>A crash loop has been detected and Decky has been disabled for this boot.</b>
|
||||
<br>
|
||||
<i>Steam will restart in 10 seconds...</i>
|
||||
</span>
|
||||
`;
|
||||
|
||||
await sleep(4000);
|
||||
|
||||
const win = findSP() || window;
|
||||
|
||||
const container = Object.assign(document.createElement('div'), {
|
||||
innerHTML: fallbackHTML,
|
||||
});
|
||||
container.classList.add('fallbackContainer');
|
||||
|
||||
win.document.body.appendChild(container);
|
||||
|
||||
await sleep(10000);
|
||||
|
||||
SteamClient.User.StartShutdown(false);
|
||||
} catch (e) {
|
||||
console.error('Error showing fallback!', e);
|
||||
}
|
||||
})();
|
||||
@@ -7,7 +7,7 @@ interface Window {
|
||||
(async () => {
|
||||
// Wait for main webpack chunks to definitely be loaded
|
||||
console.time('[Decky:Boot] Waiting for main Webpack chunks...');
|
||||
while (!window.webpackChunksteamui || window.webpackChunksteamui.length < 5) {
|
||||
while (!window.webpackChunksteamui || window.webpackChunksteamui.length < 8) {
|
||||
await new Promise((r) => setTimeout(r, 10)); // Can't use DFL sleep here.
|
||||
}
|
||||
console.timeEnd('[Decky:Boot] Waiting for main Webpack chunks...');
|
||||
|
||||
@@ -79,7 +79,7 @@ class PluginLoader extends Logger {
|
||||
|
||||
private reloadLock: boolean = false;
|
||||
// stores a list of plugin names which requested to be reloaded
|
||||
private pluginReloadQueue: { name: string; version?: string; loadType: PluginLoadType }[] = [];
|
||||
private pluginReloadQueue: { name: string; version?: string }[] = [];
|
||||
|
||||
private loaderUpdateToast?: ToastNotification;
|
||||
private pluginUpdateToast?: ToastNotification;
|
||||
@@ -172,32 +172,11 @@ class PluginLoader extends Logger {
|
||||
.then(() => this.log('Initialized'));
|
||||
}
|
||||
|
||||
private checkForSP(): boolean {
|
||||
try {
|
||||
return !!findSP();
|
||||
} catch (e) {
|
||||
this.warn('Error checking for SP tab', e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private async runCrashChecker() {
|
||||
const spExists = this.checkForSP();
|
||||
await sleep(5000);
|
||||
if (spExists && !this.checkForSP()) {
|
||||
// SP died after plugin loaded. Give up and let the loader's crash loop detection handle it.
|
||||
this.error('SP died during startup. Restarting webhelper.');
|
||||
await this.restartWebhelper();
|
||||
}
|
||||
}
|
||||
|
||||
private getPluginsFromBackend = DeckyBackend.callable<
|
||||
[],
|
||||
{ name: string; version: string; load_type: PluginLoadType }[]
|
||||
>('loader/get_plugins');
|
||||
|
||||
private restartWebhelper = DeckyBackend.callable<[], void>('utilities/restart_webhelper');
|
||||
|
||||
private async loadPlugins() {
|
||||
let registration: any;
|
||||
const uiMode = await new Promise(
|
||||
@@ -213,7 +192,6 @@ class PluginLoader extends Logger {
|
||||
await sleep(100);
|
||||
}
|
||||
}
|
||||
this.runCrashChecker();
|
||||
const plugins = await this.getPluginsFromBackend();
|
||||
const pluginLoadPromises = [];
|
||||
const loadStart = performance.now();
|
||||
@@ -369,11 +347,11 @@ class PluginLoader extends Logger {
|
||||
this.errorBoundaryHook.deinit();
|
||||
}
|
||||
|
||||
public unloadPlugin(name: string, skipStateUpdate: boolean = false) {
|
||||
public unloadPlugin(name: string) {
|
||||
const plugin = this.plugins.find((plugin) => plugin.name === name);
|
||||
plugin?.onDismount?.();
|
||||
this.plugins = this.plugins.filter((p) => p !== plugin);
|
||||
if (!skipStateUpdate) this.deckyState.setPlugins(this.plugins);
|
||||
this.deckyState.setPlugins(this.plugins);
|
||||
}
|
||||
|
||||
public async importPlugin(
|
||||
@@ -384,7 +362,7 @@ class PluginLoader extends Logger {
|
||||
) {
|
||||
if (useQueue && this.reloadLock) {
|
||||
this.log('Reload currently in progress, adding to queue', name);
|
||||
this.pluginReloadQueue.push({ name, version: version, loadType });
|
||||
this.pluginReloadQueue.push({ name, version: version });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -392,7 +370,7 @@ class PluginLoader extends Logger {
|
||||
if (useQueue) this.reloadLock = true;
|
||||
this.log(`Trying to load ${name}`);
|
||||
|
||||
this.unloadPlugin(name, true);
|
||||
this.unloadPlugin(name);
|
||||
const startTime = performance.now();
|
||||
await this.importReactPlugin(name, version, loadType);
|
||||
const endTime = performance.now();
|
||||
@@ -406,7 +384,7 @@ class PluginLoader extends Logger {
|
||||
this.reloadLock = false;
|
||||
const nextPlugin = this.pluginReloadQueue.shift();
|
||||
if (nextPlugin) {
|
||||
this.importPlugin(nextPlugin.name, nextPlugin.version, loadType);
|
||||
this.importPlugin(nextPlugin.name, nextPlugin.version);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -417,7 +395,6 @@ class PluginLoader extends Logger {
|
||||
version?: string,
|
||||
loadType: PluginLoadType = PluginLoadType.ESMODULE_V1,
|
||||
) {
|
||||
let spExists = this.checkForSP();
|
||||
try {
|
||||
switch (loadType) {
|
||||
case PluginLoadType.ESMODULE_V1:
|
||||
@@ -428,7 +405,6 @@ class PluginLoader extends Logger {
|
||||
...plugin,
|
||||
name: name,
|
||||
version: version,
|
||||
loadType,
|
||||
});
|
||||
break;
|
||||
|
||||
@@ -448,7 +424,6 @@ class PluginLoader extends Logger {
|
||||
...plugin,
|
||||
name: name,
|
||||
version: version,
|
||||
loadType,
|
||||
});
|
||||
} else throw new Error(`${name} frontend_bundle not OK`);
|
||||
break;
|
||||
@@ -467,7 +442,7 @@ class PluginLoader extends Logger {
|
||||
</PanelSectionRow>
|
||||
<PanelSectionRow>
|
||||
<pre style={{ overflowX: 'scroll' }}>
|
||||
<code>{e instanceof Error ? '' + e.stack : JSON.stringify(e)}</code>
|
||||
<code>{e instanceof Error ? e.stack : JSON.stringify(e)}</code>
|
||||
</pre>
|
||||
</PanelSectionRow>
|
||||
<PanelSectionRow>
|
||||
@@ -486,7 +461,6 @@ class PluginLoader extends Logger {
|
||||
version: version,
|
||||
content: <TheError />,
|
||||
icon: <FaExclamationCircle />,
|
||||
loadType,
|
||||
});
|
||||
this.toaster.toast({
|
||||
title: (
|
||||
@@ -500,12 +474,6 @@ class PluginLoader extends Logger {
|
||||
icon: <FaExclamationCircle />,
|
||||
});
|
||||
}
|
||||
|
||||
if (spExists && !this.checkForSP()) {
|
||||
// SP died after plugin loaded. Give up and let the loader's crash loop detection handle it.
|
||||
this.error('SP died after loading plugin. Restarting webhelper.');
|
||||
await this.restartWebhelper();
|
||||
}
|
||||
}
|
||||
|
||||
async callServerMethod(methodName: string, args = {}) {
|
||||
|
||||
@@ -6,7 +6,6 @@ export enum PluginLoadType {
|
||||
export interface Plugin {
|
||||
name: string;
|
||||
version?: string;
|
||||
loadType?: PluginLoadType;
|
||||
icon: JSX.Element;
|
||||
content?: JSX.Element;
|
||||
onDismount?(): void;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// import restartFix from './restart';
|
||||
import cefSocketFix from './socket';
|
||||
|
||||
// import reloadFix from './reload';
|
||||
import restartFix from './restart';
|
||||
let fixes: Function[] = [];
|
||||
|
||||
export function deinitSteamFixes() {
|
||||
@@ -8,6 +7,6 @@ export function deinitSteamFixes() {
|
||||
}
|
||||
|
||||
export async function initSteamFixes() {
|
||||
fixes.push(cefSocketFix());
|
||||
// fixes.push(await restartFix());
|
||||
// fixes.push(await reloadFix());
|
||||
fixes.push(await restartFix());
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
import Logger from '../logger';
|
||||
|
||||
const logger = new Logger('CEFSocketFix');
|
||||
|
||||
const closeCEFSocket = DeckyBackend.callable<[], void>('utilities/close_cef_socket');
|
||||
|
||||
export default function cefSocketFix() {
|
||||
const reg = window.SteamClient?.User?.RegisterForShutdownStart(async () => {
|
||||
logger.log('Closing CEF socket before shutdown');
|
||||
await closeCEFSocket();
|
||||
});
|
||||
|
||||
if (reg) logger.debug('CEF shutdown handler ready');
|
||||
|
||||
return () => reg?.unregister();
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { ToastData, ToastNotification } from '@decky/api';
|
||||
import { ErrorBoundary, Patch, callOriginal, findModuleExport, injectFCTrampoline, replacePatch } from '@decky/ui';
|
||||
import { Patch, callOriginal, findModuleExport, injectFCTrampoline, replacePatch } from '@decky/ui';
|
||||
|
||||
import Toast from './components/Toast';
|
||||
import Logger from './logger';
|
||||
@@ -34,9 +34,7 @@ class Toaster extends Logger {
|
||||
this.toastPatch = replacePatch(patchedRenderer, 'component', (args: any[]) => {
|
||||
if (args?.[0]?.group?.decky || args?.[0]?.group?.notifications?.[0]?.decky) {
|
||||
return args[0].group.notifications.map((notification: any) => (
|
||||
<ErrorBoundary>
|
||||
<Toast toast={notification.data} newIndicator={notification.bNewIndicator} location={args?.[0]?.location} />
|
||||
</ErrorBoundary>
|
||||
<Toast toast={notification.data} newIndicator={notification.bNewIndicator} location={args?.[0]?.location} />
|
||||
));
|
||||
}
|
||||
return callOriginal;
|
||||
@@ -109,11 +107,7 @@ class Toaster extends Logger {
|
||||
}
|
||||
}, toast.expiration);
|
||||
}
|
||||
try {
|
||||
window.NotificationStore.ProcessNotification(info, toastData, ToastType.New);
|
||||
} catch (e) {
|
||||
this.error('Error while sending toast:', e);
|
||||
}
|
||||
window.NotificationStore.ProcessNotification(info, toastData, ToastType.New);
|
||||
return toastResult;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,10 +22,7 @@ export function getLikelyErrorSourceFromValveError(error: ValveError): ErrorSour
|
||||
}
|
||||
|
||||
export function getLikelyErrorSourceFromValveReactError(error: ValveReactErrorInfo): ErrorSource {
|
||||
// get the first 10 lines of the componentStack to avoid matching against the decky router wrapper for any route errors deeper in the tree
|
||||
return getLikelyErrorSource(
|
||||
error?.error?.stack + '\n' + error.info.componentStack?.split('\n').slice(0, 8).join('\n'),
|
||||
);
|
||||
return getLikelyErrorSource(error?.error?.stack + '\n' + error.info.componentStack);
|
||||
}
|
||||
|
||||
export function getLikelyErrorSource(error?: string): ErrorSource {
|
||||
|
||||
Reference in New Issue
Block a user