mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-06-17 08:47:49 +00:00
fix installing plugins
This commit is contained in:
+4
-5
@@ -40,8 +40,7 @@ class PluginBrowser:
|
|||||||
Popen(["chmod", "-R", "555", self.plugin_path])
|
Popen(["chmod", "-R", "555", self.plugin_path])
|
||||||
return True
|
return True
|
||||||
|
|
||||||
async def _install(self, artifact, version, hash):
|
async def _install(self, name, version, hash):
|
||||||
name = artifact.split("/")[-1]
|
|
||||||
rmtree(path.join(self.plugin_path, name), ignore_errors=True)
|
rmtree(path.join(self.plugin_path, name), ignore_errors=True)
|
||||||
self.log.info(f"Installing {artifact} (Version: {version})")
|
self.log.info(f"Installing {artifact} (Version: {version})")
|
||||||
async with ClientSession() as client:
|
async with ClientSession() as client:
|
||||||
@@ -73,15 +72,15 @@ class PluginBrowser:
|
|||||||
|
|
||||||
async def install_plugin(self, request):
|
async def install_plugin(self, request):
|
||||||
data = await request.post()
|
data = await request.post()
|
||||||
get_event_loop().create_task(self.request_plugin_install(data["artifact"], data.get("version", "dev"), data.get("hash", False)))
|
get_event_loop().create_task(self.request_plugin_install(data.get("name", "No name"), data.get("version", "dev"), data.get("hash", False)))
|
||||||
return web.Response(text="Requested plugin install")
|
return web.Response(text="Requested plugin install")
|
||||||
|
|
||||||
async def request_plugin_install(self, artifact, version, hash):
|
async def request_plugin_install(self, name, version, hash):
|
||||||
request_id = str(time())
|
request_id = str(time())
|
||||||
self.install_requests[request_id] = PluginInstallContext(artifact, version, hash)
|
self.install_requests[request_id] = PluginInstallContext(artifact, version, hash)
|
||||||
tab = await get_tab("SP")
|
tab = await get_tab("SP")
|
||||||
await tab.open_websocket()
|
await tab.open_websocket()
|
||||||
await tab.evaluate_js(f"DeckyPluginLoader.addPluginInstallPrompt('{artifact}', '{version}', '{request_id}', '{hash}')")
|
await tab.evaluate_js(f"DeckyPluginLoader.addPluginInstallPrompt('{name}', '{version}', '{request_id}', '{hash}')")
|
||||||
|
|
||||||
async def confirm_plugin_install(self, request_id):
|
async def confirm_plugin_install(self, request_id):
|
||||||
request = self.install_requests.pop(request_id)
|
request = self.install_requests.pop(request_id)
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ export interface StorePlugin {
|
|||||||
|
|
||||||
export async function installFromURL(url: string) {
|
export async function installFromURL(url: string) {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
|
const splitURL = url.split('/');
|
||||||
|
formData.append('name', splitURL[splitURL.length - 1].replace('.zip', ''));
|
||||||
formData.append('artifact', url);
|
formData.append('artifact', url);
|
||||||
await fetch('http://localhost:1337/browser/install_plugin', {
|
await fetch('http://localhost:1337/browser/install_plugin', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -28,6 +30,7 @@ export async function installFromURL(url: string) {
|
|||||||
|
|
||||||
export async function requestPluginInstall(plugin: StorePlugin, selectedVer: StorePluginVersion) {
|
export async function requestPluginInstall(plugin: StorePlugin, selectedVer: StorePluginVersion) {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
|
formData.append('name', plugin.name);
|
||||||
formData.append('artifact', `https://cdn.tzatzikiweeb.moe/file/steam-deck-homebrew/versions/${selectedVer.hash}.zip`);
|
formData.append('artifact', `https://cdn.tzatzikiweeb.moe/file/steam-deck-homebrew/versions/${selectedVer.hash}.zip`);
|
||||||
formData.append('version', selectedVer.name);
|
formData.append('version', selectedVer.name);
|
||||||
formData.append('hash', selectedVer.hash);
|
formData.append('hash', selectedVer.hash);
|
||||||
|
|||||||
Reference in New Issue
Block a user