diff options
| author | botato <63275405+botatooo@users.noreply.github.com> | 2022-08-27 00:01:23 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-26 21:01:23 -0700 |
| commit | b7d7ca04e12690b5e65259c8806e5e895cdc16aa (patch) | |
| tree | 4cca1b72b69622e536dbb1ba13656d39a9420685 /frontend/src/store.tsx | |
| parent | d4d1c2bbabfcec3c62767e614c9d67f516938af2 (diff) | |
| download | decky-loader-9c3e7cc85bc3c230dd17912d0e7513b2fe6d80e7.tar.gz decky-loader-9c3e7cc85bc3c230dd17912d0e7513b2fe6d80e7.zip | |
Refractor plugin backend (#111)v2.0.5-pre18
* refractor uninstall plugin backend
* refractor plugin installation method
* Change formatting in browser.py
* Manually format main.py
* Manually format utilities.py
* remove inconsistency
* remove unnecessary linebreaks
* lol what
* last minute pythoning
* Fix async missing
* lint
* more refractor
* await forgotten
* fix: menu not disappearing after first click
* lint
* bug: fix double click on uninstall
* depricate request installs
* basic patch notes viewer, lazy-load settings and store, build frontend as esmodule, add lazy-loaded react-markdown, backend changes to accomodate ESModule frontend
* refractor uninstall plugin backend
* Change formatting in browser.py
* Manually format main.py
* Manually format utilities.py
* remove unnecessary linebreaks
* lol what
* last minute pythoning
* Fix async missing
* rebase onto main
* fix error, fix React crash if patch notes are opened before remote version info is loaded
Co-authored-by: TrainDoctor <traindoctor@protonmail.com>
Co-authored-by: AAGaming <aa@mail.catvibers.me>
Diffstat (limited to 'frontend/src/store.tsx')
| -rw-r--r-- | frontend/src/store.tsx | 47 |
1 files changed, 13 insertions, 34 deletions
diff --git a/frontend/src/store.tsx b/frontend/src/store.tsx index 3e9d6823..12c8972d 100644 --- a/frontend/src/store.tsx +++ b/frontend/src/store.tsx @@ -42,17 +42,10 @@ export function getLegacyPluginList(): Promise<LegacyStorePlugin[]> { } export async function installFromURL(url: string) { - const formData = new FormData(); const splitURL = url.split('/'); - formData.append('name', splitURL[splitURL.length - 1].replace('.zip', '')); - formData.append('artifact', url); - await fetch('http://localhost:1337/browser/install_plugin', { - method: 'POST', - body: formData, - credentials: 'include', - headers: { - Authentication: window.deckyAuthToken, - }, + await window.DeckyPluginLoader.callServerMethod('install_plugin', { + name: splitURL[splitURL.length - 1].replace('.zip', ''), + artifact: url, }); } @@ -60,18 +53,11 @@ export function requestLegacyPluginInstall(plugin: LegacyStorePlugin, selectedVe showModal( <ModalRoot onOK={() => { - const formData = new FormData(); - formData.append('name', plugin.artifact); - formData.append('artifact', `https://github.com/${plugin.artifact}/archive/refs/tags/${selectedVer}.zip`); - formData.append('version', selectedVer); - formData.append('hash', plugin.versions[selectedVer]); - fetch('http://localhost:1337/browser/install_plugin', { - method: 'POST', - body: formData, - credentials: 'include', - headers: { - Authentication: window.deckyAuthToken, - }, + window.DeckyPluginLoader.callServerMethod('install_plugin', { + name: plugin.artifact, + artifact: `https://github.com/${plugin.artifact}/archive/refs/tags/${selectedVer}.zip`, + version: selectedVer, + hash: plugin.versions[selectedVer], }); }} onCancel={() => { @@ -89,18 +75,11 @@ export function requestLegacyPluginInstall(plugin: LegacyStorePlugin, selectedVe } export async function requestPluginInstall(plugin: string, selectedVer: StorePluginVersion) { - const formData = new FormData(); - formData.append('name', plugin); - formData.append('artifact', `https://cdn.tzatzikiweeb.moe/file/steam-deck-homebrew/versions/${selectedVer.hash}.zip`); - formData.append('version', selectedVer.name); - formData.append('hash', selectedVer.hash); - await fetch('http://localhost:1337/browser/install_plugin', { - method: 'POST', - body: formData, - credentials: 'include', - headers: { - Authentication: window.deckyAuthToken, - }, + await window.DeckyPluginLoader.callServerMethod('install_plugin', { + name: plugin, + artifact: `https://cdn.tzatzikiweeb.moe/file/steam-deck-homebrew/versions/${selectedVer.hash}.zip`, + version: selectedVer.name, + hash: selectedVer.hash, }); } |
