From d3584a9931292e58b995fc2aa777567990917663 Mon Sep 17 00:00:00 2001 From: WerWolvTranslationBot <124004309+WerWolvTranslationBot@users.noreply.github.com> Date: Wed, 31 May 2023 13:36:02 +0200 Subject: Translations update from Weblate (#469) * Translated using Weblate (Chinese (Traditional)) Currently translated at 100.0% (100 of 100 strings) Translation: Decky/Decky Translate-URL: https://weblate.werwolv.net/projects/decky/decky/zh_Hant/ * Translated using Weblate (German) Currently translated at 100.0% (100 of 100 strings) Translation: Decky/Decky Translate-URL: https://weblate.werwolv.net/projects/decky/decky/de/ * Translated using Weblate (Italian) Currently translated at 91.8% (102 of 111 strings) Translation: Decky/Decky Translate-URL: https://weblate.werwolv.net/projects/decky/decky/it/ * Translated using Weblate (Italian) Currently translated at 100.0% (111 of 111 strings) Translation: Decky/Decky Translate-URL: https://weblate.werwolv.net/projects/decky/decky/it/ --------- Co-authored-by: david082321 Co-authored-by: Jonas Dellinger Co-authored-by: Marco Rodolfi --- backend/locales/de-DE.json | 6 +++--- backend/locales/it-IT.json | 31 ++++++++++++++++++++++++++++++- backend/locales/zh-TW.json | 8 +++++--- 3 files changed, 38 insertions(+), 7 deletions(-) diff --git a/backend/locales/de-DE.json b/backend/locales/de-DE.json index 992f4d13..6c734093 100644 --- a/backend/locales/de-DE.json +++ b/backend/locales/de-DE.json @@ -27,20 +27,20 @@ "install": { "button_idle": "Installieren", "button_processing": "Wird installiert", - "desc": "Bist du dir sicher, dass du {{artifact}}{{version}} installieren willst?", + "desc": "Bist du dir sicher, dass du {{artifact}} {{version}} installieren willst?", "title": "Installiere {{artifact}}" }, "reinstall": { "button_idle": "Neu installieren", "button_processing": "Wird neu installiert", - "desc": "Bist du dir sicher, dass du {{artifact}}{{version}} neu installieren willst?", + "desc": "Bist du dir sicher, dass du {{artifact}} {{version}} neu installieren willst?", "title": "Neu installation {{artifact}}" }, "update": { "button_idle": "Aktualisieren", "button_processing": "Wird aktualisiert", "title": "Aktualisiere {{artifact}}", - "desc": "Bist du dir sicher, dass du {{artifact}}{{version}} aktualisieren willst?" + "desc": "Bist du dir sicher, dass du {{artifact}} {{version}} aktualisieren willst?" }, "no_hash": "Diese Erweiterung besitzt keine Prüfsumme, Installation auf eigene Gefahr." }, diff --git a/backend/locales/it-IT.json b/backend/locales/it-IT.json index e5eec32d..c935aa56 100644 --- a/backend/locales/it-IT.json +++ b/backend/locales/it-IT.json @@ -50,7 +50,10 @@ "reinstall": "Reinstalla", "reload": "Ricarica", "uninstall": "Rimuovi", - "update_to": "Aggiorna a {{name}}" + "update_to": "Aggiorna a {{name}}", + "update_all_one": "Aggiorna un plugin", + "update_all_many": "Aggiorna {{count}} plugins", + "update_all_other": "Aggiorna {{count}} plugins" }, "PluginLoader": { "decky_title": "Decky", @@ -180,5 +183,31 @@ "reloading": "Ricaricando", "updating": "Aggiornando" } + }, + "MultiplePluginsInstallModal": { + "title": { + "mixed_one": "Modifica un plugin", + "mixed_many": "Modifica {{count}} plugins", + "mixed_other": "Modifica {{count}} plugins", + "update_one": "Aggiorna un plugin", + "update_many": "Aggiorna {{count}} plugins", + "update_other": "Aggiorna {{count}} plugins", + "reinstall_one": "Reinstalla un plugin", + "reinstall_many": "Reinstalla {{count}} plugins", + "reinstall_other": "Reinstalla {{count}} plugins", + "install_one": "Installa un plugin", + "install_many": "Installa {{count}} plugins", + "install_other": "Installa {{count}} plugins" + }, + "confirm": "Sei sicuro di voler effettuare le modifiche seguenti?", + "ok_button": { + "idle": "Conferma", + "loading": "Elaboro" + }, + "description": { + "install": "Installa {{name}} {{version}}", + "update": "Aggiorna {{name}} alla versione {{version}}", + "reinstall": "Reinstalla {{name}} {{version}}" + } } } diff --git a/backend/locales/zh-TW.json b/backend/locales/zh-TW.json index 34972048..2b3358bc 100644 --- a/backend/locales/zh-TW.json +++ b/backend/locales/zh-TW.json @@ -55,7 +55,7 @@ "PluginLoader": { "decky_title": "Decky", "error": "錯誤", - "plugin_error_uninstall": "如果您要解除安裝外掛程式,請在 Decky 選單,按下 <0>。", + "plugin_error_uninstall": "載入 {{name}} 導致上述異常。這通常意味著該外掛程式需要針對新版本的 SteamUI 進行更新。在 Decky 設定中檢查是否存在更新,或評估刪除此外掛程式。", "plugin_load_error": { "message": "載入外掛程式 {{name}} 發生錯誤", "toast": "{{name}} 載入出錯" @@ -65,7 +65,8 @@ "title": "解除安裝 {{name}}", "desc": "您確定要解除安裝 {{name}} 嗎?" }, - "decky_update_available": "可更新至版本 {{tag_name}}!" + "decky_update_available": "可更新至版本 {{tag_name}}!", + "plugin_update_other": "可更新 {{count}} 個外掛程式!" }, "RemoteDebugging": { "remote_cef": { @@ -95,7 +96,8 @@ "desc": "啟用與執行 React DevTools 的電腦的連接。改變這個設定將重新載入 Steam。啟用前必須設定 IP 位址。", "ip_label": "IP", "label": "啟用 React DevTools" - } + }, + "header": "其他" }, "SettingsGeneralIndex": { "about": { -- cgit v1.2.3 From f4c0a8b5aa3353ad1a9909ddc55b06802169d6d0 Mon Sep 17 00:00:00 2001 From: Witherking25 Date: Thu, 1 Jun 2023 19:01:21 -0400 Subject: add cef console button to developer settings (#441) * add cef console button * Small fix: handle missing localization in backend plus a small typo in the english language (#443) * Hotfix for i18n where the detector was overriding localStorage * Please, pnpm, cooperate * Small fix regarding the backend getting hammered when switching to not supported languages plus a small english typo * Add a get_tab_id function to utilities * Go straight to SharedJSContext into console button * clean up some log statements, and some extra parentheses --------- Co-authored-by: Marco Rodolfi Co-authored-by: Party Wumpus <48649272+PartyWumpus@users.noreply.github.com> --- backend/locales/en-US.json | 5 +++++ backend/utilities.py | 8 ++++++-- .../components/settings/pages/developer/index.tsx | 20 +++++++++++++++++++- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/backend/locales/en-US.json b/backend/locales/en-US.json index 12a33f37..a347351b 100644 --- a/backend/locales/en-US.json +++ b/backend/locales/en-US.json @@ -100,6 +100,11 @@ } }, "SettingsDeveloperIndex": { + "cef_console": { + "button": "Open Console", + "desc": "Opens the CEF Console. Only useful for debugging purposes. Stuff here is potentially dangerous and should only be used if you are a plugin dev, or are directed here by one.", + "label": "CEF Console" + }, "header": "Other", "react_devtools": { "desc": "Enables connection to a computer running React DevTools. Changing this setting will reload Steam. Set the IP address before enabling.", diff --git a/backend/utilities.py b/backend/utilities.py index 94f5e26b..45a32d3e 100644 --- a/backend/utilities.py +++ b/backend/utilities.py @@ -7,7 +7,7 @@ from asyncio import sleep, start_server, gather, open_connection from aiohttp import ClientSession, web from logging import getLogger -from injector import inject_to_tab, get_gamepadui_tab, close_old_tabs +from injector import inject_to_tab, get_gamepadui_tab, close_old_tabs, get_tab import helpers import subprocess from localplatform import service_stop, service_start @@ -32,7 +32,8 @@ class Utilities: "get_setting": self.get_setting, "filepicker_ls": self.filepicker_ls, "disable_rdt": self.disable_rdt, - "enable_rdt": self.enable_rdt + "enable_rdt": self.enable_rdt, + "get_tab_id": self.get_tab_id } self.logger = getLogger("Utilities") @@ -287,3 +288,6 @@ class Utilities: await close_old_tabs() await tab.evaluate_js("location.reload();", False, True, False) self.logger.info("React DevTools disabled") + + async def get_tab_id(self, name): + return (await get_tab(name)).id diff --git a/frontend/src/components/settings/pages/developer/index.tsx b/frontend/src/components/settings/pages/developer/index.tsx index 774bb449..812ff052 100644 --- a/frontend/src/components/settings/pages/developer/index.tsx +++ b/frontend/src/components/settings/pages/developer/index.tsx @@ -4,12 +4,13 @@ import { DialogControlsSection, DialogControlsSectionHeader, Field, + Navigation, TextField, Toggle, } from 'decky-frontend-lib'; import { useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; -import { FaFileArchive, FaLink, FaReact, FaSteamSymbol } from 'react-icons/fa'; +import { FaFileArchive, FaLink, FaReact, FaSteamSymbol, FaTerminal } from 'react-icons/fa'; import { setShouldConnectToReactDevTools, setShowValveInternal } from '../../../../developer'; import { installFromURL } from '../../../../store'; @@ -75,6 +76,23 @@ export default function DeveloperSettings() { {t('SettingsDeveloperIndex.header')} + {t('SettingsDeveloperIndex.cef_console.desc')}} + icon={} + > + { + let res = await window.DeckyPluginLoader.callServerMethod('get_tab_id', { "name": "SharedJSContext" }); + if (res.success) { + Navigation.NavigateToExternalWeb("localhost:8080/devtools/inspector.html?ws=localhost:8080/devtools/page/"+res.result); + } else { + console.error('Unable to find ID for SharedJSContext tab ', res.result); + Navigation.NavigateToExternalWeb("localhost:8080"); + } + }}> + {t('SettingsDeveloperIndex.cef_console.button')} + + Date: Fri, 2 Jun 2023 00:26:08 +0100 Subject: Attempt to appease the linter I think the first navigation being on one line looks nicer, but it's over the 120 character limit :( --- .../components/settings/pages/developer/index.tsx | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/frontend/src/components/settings/pages/developer/index.tsx b/frontend/src/components/settings/pages/developer/index.tsx index 812ff052..200f13ab 100644 --- a/frontend/src/components/settings/pages/developer/index.tsx +++ b/frontend/src/components/settings/pages/developer/index.tsx @@ -81,15 +81,19 @@ export default function DeveloperSettings() { description={{t('SettingsDeveloperIndex.cef_console.desc')}} icon={} > - { - let res = await window.DeckyPluginLoader.callServerMethod('get_tab_id', { "name": "SharedJSContext" }); - if (res.success) { - Navigation.NavigateToExternalWeb("localhost:8080/devtools/inspector.html?ws=localhost:8080/devtools/page/"+res.result); - } else { - console.error('Unable to find ID for SharedJSContext tab ', res.result); - Navigation.NavigateToExternalWeb("localhost:8080"); - } - }}> + { + let res = await window.DeckyPluginLoader.callServerMethod('get_tab_id', { name: 'SharedJSContext' }); + if (res.success) { + Navigation.NavigateToExternalWeb( + 'localhost:8080/devtools/inspector.html?ws=localhost:8080/devtools/page/' + res.result, + ); + } else { + console.error('Unable to find ID for SharedJSContext tab ', res.result); + Navigation.NavigateToExternalWeb('localhost:8080'); + } + }} + > {t('SettingsDeveloperIndex.cef_console.button')} -- cgit v1.2.3 From 2e8e0fc7c153cdeae055f4f0a7158afbae0e3485 Mon Sep 17 00:00:00 2001 From: suchmememanyskill <38142618+suchmememanyskill@users.noreply.github.com> Date: Fri, 2 Jun 2023 03:44:55 +0200 Subject: Plugin backend reload (#463) Co-authored-by: beebls <102569435+beebls@users.noreply.github.com> --- backend/loader.py | 17 +++++++++++++---- .../components/settings/pages/plugin_list/index.tsx | 18 +++++++++++++++++- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/backend/loader.py b/backend/loader.py index d8b97bbd..d07b1c08 100644 --- a/backend/loader.py +++ b/backend/loader.py @@ -62,19 +62,19 @@ class Loader: self.logger = getLogger("Loader") self.plugin_path = plugin_path self.logger.info(f"plugin_path: {self.plugin_path}") - self.plugins = {} + self.plugins : dict[str, PluginWrapper] = {} self.watcher = None self.live_reload = live_reload + self.reload_queue = Queue() + self.loop.create_task(self.handle_reloads()) if live_reload: - self.reload_queue = Queue() self.observer = Observer() self.watcher = FileChangeHandler(self.reload_queue, plugin_path) self.observer.schedule(self.watcher, self.plugin_path, recursive=True) self.observer.start() - self.loop.create_task(self.handle_reloads()) self.loop.create_task(self.enable_reload_wait()) - + server_instance.add_routes([ web.get("/frontend/{path:.*}", self.handle_frontend_assets), web.get("/locales/{path:.*}", self.handle_frontend_locales), @@ -82,6 +82,7 @@ class Loader: web.get("/plugins/{plugin_name}/frontend_bundle", self.handle_frontend_bundle), web.post("/plugins/{plugin_name}/methods/{method_name}", self.handle_plugin_method_call), web.get("/plugins/{plugin_name}/assets/{path:.*}", self.handle_plugin_frontend_assets), + web.post("/plugins/{plugin_name}/reload", self.handle_backend_reload_request), # The following is legacy plugin code. web.get("/plugins/load_main/{name}", self.load_plugin_main_view), @@ -217,3 +218,11 @@ class Loader: return web.Response(text=await tab.get_steam_resource(f"https://steamloopback.host/{request.match_info['path']}"), content_type="text/html") except Exception as e: return web.Response(text=str(e), status=400) + + async def handle_backend_reload_request(self, request): + plugin_name : str = request.match_info["plugin_name"] + plugin = self.plugins[plugin_name] + + await self.reload_queue.put((plugin.file, plugin.plugin_directory)) + + return web.Response(status=200) \ No newline at end of file diff --git a/frontend/src/components/settings/pages/plugin_list/index.tsx b/frontend/src/components/settings/pages/plugin_list/index.tsx index 17f6d99d..fab8ec2b 100644 --- a/frontend/src/components/settings/pages/plugin_list/index.tsx +++ b/frontend/src/components/settings/pages/plugin_list/index.tsx @@ -44,7 +44,23 @@ function PluginInteractables(props: { entry: ReorderableEntry }) { const showCtxMenu = (e: MouseEvent | GamepadEvent) => { showContextMenu( - window.DeckyPluginLoader.importPlugin(pluginName, data?.version)}> + { + try { + fetch(`http://127.0.0.1:1337/plugins/${pluginName}/reload`, { + method: 'POST', + credentials: 'include', + headers: { + Authentication: window.deckyAuthToken, + }, + }); + } catch (err) { + console.error('Error Reloading Plugin Backend', err); + } + + window.DeckyPluginLoader.importPlugin(pluginName, data?.version); + }} + > {t('PluginListIndex.reload')}