{
this.callServerMethod('confirm_plugin_install', { request_id });
}}
onCancel={() => {
this.callServerMethod('cancel_plugin_install', { request_id });
}}
>
{hash == 'False' ?
!!!!NO HASH PROVIDED!!!!
: null}
Install {artifact}
{version ? ' version ' + version : null}?
,
);
}
public dismountAll() {
for (const plugin of this.plugins) {
this.log(`Dismounting ${plugin.name}`);
plugin.onDismount?.();
}
}
public deinit() {
this.routerHook.removeRoute('/decky/store');
this.routerHook.removeRoute('/decky/settings');
}
public async importPlugin(name: string) {
if (this.reloadLock) {
this.log('Reload currently in progress, adding to queue', name);
this.pluginReloadQueue.push(name);
return;
}
try {
this.reloadLock = true;
this.log(`Trying to load ${name}`);
const oldPlugin = this.plugins.find(
(plugin) => plugin.name === name || plugin.name === name.replace('$LEGACY_', ''),
);
if (oldPlugin) {
oldPlugin.onDismount?.();
this.plugins = this.plugins.filter((plugin) => plugin !== oldPlugin);
}
if (name.startsWith('$LEGACY_')) {
await this.importLegacyPlugin(name.replace('$LEGACY_', ''));
} else {
await this.importReactPlugin(name);
}
this.deckyState.setPlugins(this.plugins);
this.log(`Loaded ${name}`);
} catch (e) {
throw e;
} finally {
this.reloadLock = false;
const nextPlugin = this.pluginReloadQueue.shift();
if (nextPlugin) {
this.importPlugin(nextPlugin);
}
}
}
private async importReactPlugin(name: string) {
let res = await fetch(`http://127.0.0.1:1337/plugins/${name}/frontend_bundle`);
if (res.ok) {
let plugin = await eval(await res.text())(this.createPluginAPI(name));
this.plugins.push({
...plugin,
name: name,
});
} else throw new Error(`${name} frontend_bundle not OK`);
}
private async importLegacyPlugin(name: string) {
const url = `http://127.0.0.1:1337/plugins/load_main/${name}`;
this.plugins.push({
name: name,
icon: