From 4ad15568cd2802f9499bd3961c5fe24391745502 Mon Sep 17 00:00:00 2001 From: TrainDoctor Date: Sun, 23 Oct 2022 13:04:00 -0700 Subject: Merge drop-legacy to main. --- frontend/src/components/store/PluginCard.tsx | 73 ++++++---------------------- frontend/src/components/store/Store.tsx | 13 +---- frontend/src/store.tsx | 49 +------------------ 3 files changed, 16 insertions(+), 119 deletions(-) diff --git a/frontend/src/components/store/PluginCard.tsx b/frontend/src/components/store/PluginCard.tsx index 0155ff99..03f11b4a 100644 --- a/frontend/src/components/store/PluginCard.tsx +++ b/frontend/src/components/store/PluginCard.tsx @@ -11,17 +11,10 @@ import { } from 'decky-frontend-lib'; import { FC, useRef, useState } from 'react'; -import { - LegacyStorePlugin, - StorePlugin, - StorePluginVersion, - isLegacyPlugin, - requestLegacyPluginInstall, - requestPluginInstall, -} from '../../store'; +import { StorePlugin, StorePluginVersion, requestPluginInstall } from '../../store'; interface PluginCardProps { - plugin: StorePlugin | LegacyStorePlugin; + plugin: StorePlugin; } const PluginCard: FC = ({ plugin }) => { @@ -63,22 +56,13 @@ const PluginCard: FC = ({ plugin }) => { }} >
- Router.NavigateToExternalWeb('https://github.com/' + plugin.artifact)} > - {isLegacyPlugin(plugin) ? ( -
- - {plugin.artifact.split('/')[0]}/ - - {plugin.artifact.split('/')[1]} -
- ) : ( - plugin.name - )} -
+ {plugin.name} +
= ({ plugin }) => { width: 'auto', height: '160px', }} - src={ - isLegacyPlugin(plugin) - ? `https://cdn.tzatzikiweeb.moe/file/steam-deck-homebrew/artifact_images/${plugin.artifact.replace( - '/', - '_', - )}.png` - : `https://cdn.tzatzikiweeb.moe/file/steam-deck-homebrew/artifact_images/${plugin.name.replace( - '/', - '_', - )}.png` - } + src={`https://cdn.tzatzikiweeb.moe/file/steam-deck-homebrew/artifact_images/${plugin.name.replace( + '/', + '_', + )}.png`} />
= ({ plugin }) => { {tag == 'root' ? 'Requires root' : tag} ))} - {isLegacyPlugin(plugin) && ( - - legacy - - )}

@@ -194,11 +158,7 @@ const PluginCard: FC = ({ plugin }) => { - isLegacyPlugin(plugin) - ? requestLegacyPluginInstall(plugin, Object.keys(plugin.versions)[selectedOption]) - : requestPluginInstall(plugin.name, plugin.versions[selectedOption]) - } + onClick={() => requestPluginInstall(plugin.name, plugin.versions[selectedOption])} > Install @@ -211,15 +171,10 @@ const PluginCard: FC = ({ plugin }) => { > ({ - data: k, - label: v, - })) - : plugin.versions.map((version: StorePluginVersion, index) => ({ - data: index, - label: version.name, - }))) as SingleDropdownOption[] + plugin.versions.map((version: StorePluginVersion, index) => ({ + data: index, + label: version.name, + })) as SingleDropdownOption[] } strDefaultLabel={'Select a version'} selectedOption={selectedOption} diff --git a/frontend/src/components/store/Store.tsx b/frontend/src/components/store/Store.tsx index cb6f34ad..2ffd8efb 100644 --- a/frontend/src/components/store/Store.tsx +++ b/frontend/src/components/store/Store.tsx @@ -2,14 +2,13 @@ import { SteamSpinner } from 'decky-frontend-lib'; import { FC, useEffect, useState } from 'react'; import Logger from '../../logger'; -import { LegacyStorePlugin, StorePlugin, getLegacyPluginList, getPluginList } from '../../store'; +import { StorePlugin, getPluginList } from '../../store'; import PluginCard from './PluginCard'; const logger = new Logger('FilePicker'); const StorePage: FC<{}> = () => { const [data, setData] = useState(null); - const [legacyData, setLegacyData] = useState(null); useEffect(() => { (async () => { @@ -17,11 +16,6 @@ const StorePage: FC<{}> = () => { logger.log('got data!', res); setData(res); })(); - (async () => { - const res = await getLegacyPluginList(); - logger.log('got legacy data!', res); - setLegacyData(res); - })(); }, []); return ( @@ -49,11 +43,6 @@ const StorePage: FC<{}> = () => { {data.map((plugin: StorePlugin) => ( ))} - {!legacyData ? ( - - ) : ( - legacyData.map((plugin: LegacyStorePlugin) => ) - )} )} diff --git a/frontend/src/store.tsx b/frontend/src/store.tsx index 10c35406..cc0e4cf0 100644 --- a/frontend/src/store.tsx +++ b/frontend/src/store.tsx @@ -1,5 +1,3 @@ -import { ConfirmModal, showModal, staticClasses } from 'decky-frontend-lib'; - import { Plugin } from './plugin'; export interface StorePluginVersion { @@ -17,22 +15,12 @@ export interface StorePlugin { image_url: string; } -export interface LegacyStorePlugin { - artifact: string; - versions: { - [version: string]: string; - }; - author: string; - description: string; - tags: string[]; -} - // name: version export type PluginUpdateMapping = Map; export async function getPluginList(): Promise { let version = await window.DeckyPluginLoader.updateVersion(); - return fetch('https://beta.deckbrew.xyz/plugins', { + return fetch('https://plugins.deckbrew.xyz/plugins', { method: 'GET', headers: { 'X-Decky-Version': version.current, @@ -40,12 +28,6 @@ export async function getPluginList(): Promise { }).then((r) => r.json()); } -export function getLegacyPluginList(): Promise { - return fetch('https://plugins.deckbrew.xyz/get_plugins', { - method: 'GET', - }).then((r) => r.json()); -} - export async function installFromURL(url: string) { const splitURL = url.split('/'); await window.DeckyPluginLoader.callServerMethod('install_plugin', { @@ -54,31 +36,6 @@ export async function installFromURL(url: string) { }); } -export function requestLegacyPluginInstall(plugin: LegacyStorePlugin, selectedVer: string) { - showModal( - { - 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={() => { - // do nothing - }} - > -
- Using legacy plugins -
- You are currently installing a legacy plugin. Legacy plugins are no longer supported and may have issues. - Legacy plugins do not support gamepad input. To interact with a legacy plugin, you will need to use the - touchscreen. -
, - ); -} - export async function requestPluginInstall(plugin: string, selectedVer: StorePluginVersion) { await window.DeckyPluginLoader.callServerMethod('install_plugin', { name: plugin, @@ -99,7 +56,3 @@ export async function checkForUpdates(plugins: Plugin[]): Promise