mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-06-28 05:59:14 +00:00
Compare commits
5 Commits
v2.12.0-pre1
...
v2.12.3
| Author | SHA1 | Date | |
|---|---|---|---|
| 5053a52f32 | |||
| 5bfc53231d | |||
| 2b4e3318ca | |||
| b84dcd99ad | |||
| 34fb7bb538 |
@@ -93,7 +93,7 @@
|
||||
"update_to": "{{name}} を更新"
|
||||
},
|
||||
"PluginListLabel": {
|
||||
"hidden": "クイックアクセスメニューから非表示にします"
|
||||
"hidden": "クイックアクセスメニューから表示されません"
|
||||
},
|
||||
"PluginLoader": {
|
||||
"error": "エラー",
|
||||
@@ -124,7 +124,7 @@
|
||||
},
|
||||
"third_party_plugins": {
|
||||
"button_install": "インストール",
|
||||
"button_zip": "ブラウズ",
|
||||
"button_zip": "開く",
|
||||
"header": "サードパーティプラグイン",
|
||||
"label_desc": "URL",
|
||||
"label_url": "URLからプラグインをインストール",
|
||||
@@ -138,7 +138,7 @@
|
||||
"header": "その他"
|
||||
},
|
||||
"PluginView": {
|
||||
"hidden_other": "{{count}} 個のプラグインがこのリストから非表示になります"
|
||||
"hidden_other": "{{count}} 個のプラグインがこのリストから非表示になっています"
|
||||
},
|
||||
"SettingsGeneralIndex": {
|
||||
"about": {
|
||||
|
||||
@@ -113,7 +113,9 @@
|
||||
"reinstall": "Reinstalacja",
|
||||
"show": "Szybki dostęp: Pokaż",
|
||||
"uninstall": "Odinstaluj",
|
||||
"update_to": "Zaktualizuj do {{name}}"
|
||||
"update_to": "Zaktualizuj do {{name}}",
|
||||
"unfreeze": "Odblokuj aktualizacje",
|
||||
"freeze": "Zablokuj aktualizacje"
|
||||
},
|
||||
"PluginLoader": {
|
||||
"decky_title": "Decky",
|
||||
@@ -199,7 +201,8 @@
|
||||
"SettingsIndex": {
|
||||
"developer_title": "Deweloper",
|
||||
"general_title": "Ogólne",
|
||||
"plugins_title": "Pluginy"
|
||||
"plugins_title": "Pluginy",
|
||||
"testing_title": "Testowanie"
|
||||
},
|
||||
"Store": {
|
||||
"store_contrib": {
|
||||
@@ -225,7 +228,11 @@
|
||||
"alph_asce": "Alfabetycznie (od Z do A)",
|
||||
"alph_desc": "Alfabetycznie (od A do Z)",
|
||||
"title": "Przeglądaj",
|
||||
"about": "Informacje"
|
||||
"about": "Informacje",
|
||||
"date_desc": "Od najnowszych",
|
||||
"downloads_desc": "Najwięcej pobrań",
|
||||
"downloads_asce": "Najmniej pobrań",
|
||||
"date_asce": "Od najstarszych"
|
||||
},
|
||||
"store_testing_cta": "Rozważ przetestowanie nowych pluginów, aby pomóc zespołowi Decky Loader!",
|
||||
"store_testing_warning": {
|
||||
@@ -263,5 +270,8 @@
|
||||
"TitleView": {
|
||||
"settings_desc": "Otwórz ustawienia Decky",
|
||||
"decky_store_desc": "Otwórz sklep Decky"
|
||||
},
|
||||
"Testing": {
|
||||
"download": "Pobierz"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ class PluginBrowser:
|
||||
# logger.debug("current plugins: %s", snapshot_string)
|
||||
if name in self.plugins:
|
||||
logger.debug("Plugin %s was found", name)
|
||||
self.plugins[name].stop()
|
||||
self.plugins[name].stop(uninstall=True)
|
||||
logger.debug("Plugin %s was stopped", name)
|
||||
del self.plugins[name]
|
||||
logger.debug("Plugin %s was removed from the dictionary", name)
|
||||
|
||||
@@ -156,6 +156,12 @@ async def service_start(service_name : str) -> bool:
|
||||
res = run(cmd, stdout=PIPE, stderr=STDOUT)
|
||||
return res.returncode == 0
|
||||
|
||||
async def restart_webhelper() -> bool:
|
||||
logger.info("Restarting steamwebhelper")
|
||||
# TODO move to pkill
|
||||
res = run(["killall", "-s", "SIGTERM", "steamwebhelper"], stdout=DEVNULL, stderr=DEVNULL)
|
||||
return res.returncode == 0
|
||||
|
||||
def get_privileged_path() -> str:
|
||||
path = os.getenv("PRIVILEGED_PATH")
|
||||
|
||||
|
||||
+6
-6
@@ -2,9 +2,9 @@
|
||||
import sys
|
||||
from typing import Dict
|
||||
from .localplatform import (chmod, chown, service_stop, service_start,
|
||||
ON_WINDOWS, get_log_level, get_live_reload,
|
||||
ON_WINDOWS, ON_LINUX, get_log_level, get_live_reload,
|
||||
get_server_port, get_server_host, get_chown_plugin_path,
|
||||
get_privileged_path)
|
||||
get_privileged_path, restart_webhelper)
|
||||
if hasattr(sys, '_MEIPASS'):
|
||||
chmod(sys._MEIPASS, 755) # type: ignore
|
||||
# Full imports
|
||||
@@ -158,10 +158,10 @@ class PluginManager:
|
||||
async def inject_javascript(self, tab: Tab, first: bool=False, request: Request|None=None):
|
||||
logger.info("Loading Decky frontend!")
|
||||
try:
|
||||
if first:
|
||||
if await tab.has_global_var("deckyHasLoaded", False):
|
||||
await close_old_tabs()
|
||||
await tab.evaluate_js("try{if (window.deckyHasLoaded){setTimeout(() => location.reload(), 100)}else{window.deckyHasLoaded = true;(async()=>{try{while(!window.SP_REACT){await new Promise(r => setTimeout(r, 10))};await import('http://localhost:1337/frontend/index.js')}catch(e){console.error(e)};})();}}catch(e){console.error(e)}", False, False, False)
|
||||
# if first:
|
||||
if ON_LINUX and await tab.has_global_var("deckyHasLoaded", False):
|
||||
await restart_webhelper()
|
||||
await tab.evaluate_js("try{if (window.deckyHasLoaded){setTimeout(() => SteamClient.Browser.RestartJSContext(), 100)}else{window.deckyHasLoaded = true;(async()=>{try{while(!window.webpackChunksteamui){await new Promise(r => setTimeout(r, 10))};await import('http://localhost:1337/frontend/index.js')}catch(e){console.error(e)};})();}}catch(e){console.error(e)}", False, False, False)
|
||||
except:
|
||||
logger.info("Failed to inject JavaScript into tab\n" + format_exc())
|
||||
pass
|
||||
|
||||
+21
-4
@@ -78,7 +78,7 @@ class PluginWrapper:
|
||||
|
||||
# append the plugin's `py_modules` to the recognized python paths
|
||||
syspath.append(path.join(environ["DECKY_PLUGIN_DIR"], "py_modules"))
|
||||
|
||||
|
||||
#TODO: FIX IN A LESS CURSED WAY
|
||||
keys = [key.replace("src.", "") for key in sysmodules if key.startswith("src.")]
|
||||
for key in keys:
|
||||
@@ -113,12 +113,29 @@ class PluginWrapper:
|
||||
self.log.error("Failed to unload " + self.name + "!\n" + format_exc())
|
||||
exit(0)
|
||||
|
||||
async def _uninstall(self):
|
||||
try:
|
||||
self.log.info("Attempting to uninstall with plugin " + self.name + "'s \"_uninstall\" function.\n")
|
||||
if hasattr(self.Plugin, "_uninstall"):
|
||||
await self.Plugin._uninstall(self.Plugin)
|
||||
self.log.info("Uninstalled " + self.name + "\n")
|
||||
else:
|
||||
self.log.info("Could not find \"_uninstall\" in " + self.name + "'s main.py" + "\n")
|
||||
except:
|
||||
self.log.error("Failed to uninstall " + self.name + "!\n" + format_exc())
|
||||
exit(0)
|
||||
|
||||
async def _on_new_message(self, message : str) -> str|None:
|
||||
data = loads(message)
|
||||
|
||||
if "stop" in data:
|
||||
self.log.info("Calling Loader unload function.")
|
||||
await self._unload()
|
||||
|
||||
if data.get('uninstall'):
|
||||
self.log.info("Calling Loader uninstall function.")
|
||||
await self._uninstall()
|
||||
|
||||
get_event_loop().stop()
|
||||
while get_event_loop().is_running():
|
||||
await sleep(0)
|
||||
@@ -141,12 +158,12 @@ class PluginWrapper:
|
||||
multiprocessing.Process(target=self._init).start()
|
||||
return self
|
||||
|
||||
def stop(self):
|
||||
def stop(self, uninstall: bool = False):
|
||||
if self.passive:
|
||||
return
|
||||
|
||||
async def _(self: PluginWrapper):
|
||||
await self.socket.write_single_line(dumps({ "stop": True }, ensure_ascii=False))
|
||||
await self.socket.write_single_line(dumps({ "stop": True, "uninstall": uninstall }, ensure_ascii=False))
|
||||
await self.socket.close_socket_connection()
|
||||
|
||||
get_event_loop().create_task(_(self))
|
||||
@@ -155,7 +172,7 @@ class PluginWrapper:
|
||||
if self.passive:
|
||||
raise RuntimeError("This plugin is passive (aka does not implement main.py)")
|
||||
async with self.method_call_lock:
|
||||
# reader, writer =
|
||||
# reader, writer =
|
||||
await self.socket.get_socket_connection()
|
||||
|
||||
await self.socket.write_single_line(dumps({ "method": method_name, "args": kwargs }, ensure_ascii=False))
|
||||
|
||||
@@ -360,7 +360,7 @@ class Utilities:
|
||||
tab = await get_gamepadui_tab()
|
||||
self.rdt_script_id = None
|
||||
await close_old_tabs()
|
||||
await tab.evaluate_js("location.reload();", False, True, False)
|
||||
await tab.evaluate_js("SteamClient.Browser.RestartJSContext();", False, True, False)
|
||||
self.logger.info("React DevTools disabled")
|
||||
|
||||
async def get_user_info(self) -> Dict[str, str]:
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
// Sets up DFL, then loads start.ts which starts up the loader
|
||||
interface Window {
|
||||
SP_REACTDOM: any;
|
||||
}
|
||||
(async () => {
|
||||
if (!window.SP_REACT) {
|
||||
console.debug('Setting up React globals...');
|
||||
// deliberate partial import
|
||||
const DFLWebpack = await import('decky-frontend-lib/dist/webpack');
|
||||
// TODO move these finds to dfl in v4
|
||||
window.SP_REACT = DFLWebpack.findModule((m) => m.Component && m.PureComponent && m.useLayoutEffect);
|
||||
window.SP_REACTDOM = DFLWebpack.findModule((m) => m.createPortal && m.createRoot);
|
||||
}
|
||||
console.debug('Setting up decky-frontend-lib...');
|
||||
window.DFL = await import('decky-frontend-lib');
|
||||
await import('./start');
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import reloadFix from './reload';
|
||||
// import reloadFix from './reload';
|
||||
import restartFix from './restart';
|
||||
let fixes: Function[] = [];
|
||||
|
||||
@@ -7,6 +7,6 @@ export function deinitSteamFixes() {
|
||||
}
|
||||
|
||||
export async function initSteamFixes() {
|
||||
fixes.push(await reloadFix());
|
||||
// fixes.push(await reloadFix());
|
||||
fixes.push(await restartFix());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user