mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-07-10 23:21:58 +00:00
6e3c05072c
* add settings utils to use settings outside of components * initial implementation of developer menu * ✨ Add support for addScriptToEvaluateOnNewDocument * React DevTools support * increase chance of RDT successfully injecting * Rewrite toaster hook to not re-create the window * remove friends focus workaround because it's fixed * Expose various DFL utilities as DFL in dev mode * try to fix text field focuss * move focusable to outside field * add onTouchEnd and onClick to focusable * Update pnpm-lock.yaml Co-authored-by: FinalDoom <7464170-FinalDoom@users.noreply.gitlab.com> Co-authored-by: TrainDoctor <traindoctor@protonmail.com>
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
import PluginLoader from './plugin-loader';
|
|
import { DeckyUpdater } from './updater';
|
|
|
|
declare global {
|
|
interface Window {
|
|
DeckyPluginLoader: PluginLoader;
|
|
DeckyUpdater?: DeckyUpdater;
|
|
importDeckyPlugin: Function;
|
|
syncDeckyPlugins: Function;
|
|
deckyHasLoaded: boolean;
|
|
deckyHasConnectedRDT?: boolean;
|
|
deckyAuthToken: string;
|
|
DFL?: any;
|
|
}
|
|
}
|
|
|
|
(async () => {
|
|
window.deckyAuthToken = await fetch('http://127.0.0.1:1337/auth/token').then((r) => r.text());
|
|
|
|
window.DeckyPluginLoader?.dismountAll();
|
|
window.DeckyPluginLoader?.deinit();
|
|
|
|
window.DeckyPluginLoader = new PluginLoader();
|
|
window.DeckyPluginLoader.init();
|
|
window.importDeckyPlugin = function (name: string, version: string) {
|
|
window.DeckyPluginLoader?.importPlugin(name, version);
|
|
};
|
|
|
|
window.syncDeckyPlugins = async function () {
|
|
const plugins = await (
|
|
await fetch('http://127.0.0.1:1337/plugins', {
|
|
credentials: 'include',
|
|
headers: { Authentication: window.deckyAuthToken },
|
|
})
|
|
).json();
|
|
for (const plugin of plugins) {
|
|
if (!window.DeckyPluginLoader.hasPlugin(plugin.name))
|
|
window.DeckyPluginLoader?.importPlugin(plugin.name, plugin.version);
|
|
}
|
|
window.DeckyPluginLoader.checkPluginUpdates();
|
|
};
|
|
|
|
setTimeout(() => window.syncDeckyPlugins(), 5000);
|
|
})();
|