mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-07-11 14:51:57 +00:00
Merge drop-legacy to main.
This commit is contained in:
@@ -11,17 +11,10 @@ import {
|
|||||||
} from 'decky-frontend-lib';
|
} from 'decky-frontend-lib';
|
||||||
import { FC, useRef, useState } from 'react';
|
import { FC, useRef, useState } from 'react';
|
||||||
|
|
||||||
import {
|
import { StorePlugin, StorePluginVersion, requestPluginInstall } from '../../store';
|
||||||
LegacyStorePlugin,
|
|
||||||
StorePlugin,
|
|
||||||
StorePluginVersion,
|
|
||||||
isLegacyPlugin,
|
|
||||||
requestLegacyPluginInstall,
|
|
||||||
requestPluginInstall,
|
|
||||||
} from '../../store';
|
|
||||||
|
|
||||||
interface PluginCardProps {
|
interface PluginCardProps {
|
||||||
plugin: StorePlugin | LegacyStorePlugin;
|
plugin: StorePlugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PluginCard: FC<PluginCardProps> = ({ plugin }) => {
|
const PluginCard: FC<PluginCardProps> = ({ plugin }) => {
|
||||||
@@ -63,22 +56,13 @@ const PluginCard: FC<PluginCardProps> = ({ plugin }) => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className="deckyStoreCardHeader" style={{ display: 'flex', alignItems: 'center' }}>
|
<div className="deckyStoreCardHeader" style={{ display: 'flex', alignItems: 'center' }}>
|
||||||
<a
|
<div
|
||||||
style={{ fontSize: '18pt', padding: '10px' }}
|
style={{ fontSize: '18pt', padding: '10px' }}
|
||||||
className={joinClassNames(staticClasses.Text)}
|
className={joinClassNames(staticClasses.Text)}
|
||||||
// onClick={() => Router.NavigateToExternalWeb('https://github.com/' + plugin.artifact)}
|
// onClick={() => Router.NavigateToExternalWeb('https://github.com/' + plugin.artifact)}
|
||||||
>
|
>
|
||||||
{isLegacyPlugin(plugin) ? (
|
{plugin.name}
|
||||||
<div className="deckyStoreCardNameContainer">
|
</div>
|
||||||
<span className="deckyStoreCardLegacyRepoOwner" style={{ color: 'grey' }}>
|
|
||||||
{plugin.artifact.split('/')[0]}/
|
|
||||||
</span>
|
|
||||||
{plugin.artifact.split('/')[1]}
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
plugin.name
|
|
||||||
)}
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
@@ -94,17 +78,10 @@ const PluginCard: FC<PluginCardProps> = ({ plugin }) => {
|
|||||||
width: 'auto',
|
width: 'auto',
|
||||||
height: '160px',
|
height: '160px',
|
||||||
}}
|
}}
|
||||||
src={
|
src={`https://cdn.tzatzikiweeb.moe/file/steam-deck-homebrew/artifact_images/${plugin.name.replace(
|
||||||
isLegacyPlugin(plugin)
|
'/',
|
||||||
? `https://cdn.tzatzikiweeb.moe/file/steam-deck-homebrew/artifact_images/${plugin.artifact.replace(
|
'_',
|
||||||
'/',
|
)}.png`}
|
||||||
'_',
|
|
||||||
)}.png`
|
|
||||||
: `https://cdn.tzatzikiweeb.moe/file/steam-deck-homebrew/artifact_images/${plugin.name.replace(
|
|
||||||
'/',
|
|
||||||
'_',
|
|
||||||
)}.png`
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
@@ -152,19 +129,6 @@ const PluginCard: FC<PluginCardProps> = ({ plugin }) => {
|
|||||||
{tag == 'root' ? 'Requires root' : tag}
|
{tag == 'root' ? 'Requires root' : tag}
|
||||||
</span>
|
</span>
|
||||||
))}
|
))}
|
||||||
{isLegacyPlugin(plugin) && (
|
|
||||||
<span
|
|
||||||
className="deckyStoreCardTag deckyStoreCardLegacyTag"
|
|
||||||
style={{
|
|
||||||
color: '#232120',
|
|
||||||
padding: '5px',
|
|
||||||
borderRadius: '5px',
|
|
||||||
background: '#EDE841',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
legacy
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -194,11 +158,7 @@ const PluginCard: FC<PluginCardProps> = ({ plugin }) => {
|
|||||||
<DialogButton
|
<DialogButton
|
||||||
className="deckyStoreCardInstallButton"
|
className="deckyStoreCardInstallButton"
|
||||||
ref={buttonRef}
|
ref={buttonRef}
|
||||||
onClick={() =>
|
onClick={() => requestPluginInstall(plugin.name, plugin.versions[selectedOption])}
|
||||||
isLegacyPlugin(plugin)
|
|
||||||
? requestLegacyPluginInstall(plugin, Object.keys(plugin.versions)[selectedOption])
|
|
||||||
: requestPluginInstall(plugin.name, plugin.versions[selectedOption])
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
Install
|
Install
|
||||||
</DialogButton>
|
</DialogButton>
|
||||||
@@ -211,15 +171,10 @@ const PluginCard: FC<PluginCardProps> = ({ plugin }) => {
|
|||||||
>
|
>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
rgOptions={
|
rgOptions={
|
||||||
(isLegacyPlugin(plugin)
|
plugin.versions.map((version: StorePluginVersion, index) => ({
|
||||||
? Object.keys(plugin.versions).map((v, k) => ({
|
data: index,
|
||||||
data: k,
|
label: version.name,
|
||||||
label: v,
|
})) as SingleDropdownOption[]
|
||||||
}))
|
|
||||||
: plugin.versions.map((version: StorePluginVersion, index) => ({
|
|
||||||
data: index,
|
|
||||||
label: version.name,
|
|
||||||
}))) as SingleDropdownOption[]
|
|
||||||
}
|
}
|
||||||
strDefaultLabel={'Select a version'}
|
strDefaultLabel={'Select a version'}
|
||||||
selectedOption={selectedOption}
|
selectedOption={selectedOption}
|
||||||
|
|||||||
@@ -2,14 +2,13 @@ import { SteamSpinner } from 'decky-frontend-lib';
|
|||||||
import { FC, useEffect, useState } from 'react';
|
import { FC, useEffect, useState } from 'react';
|
||||||
|
|
||||||
import Logger from '../../logger';
|
import Logger from '../../logger';
|
||||||
import { LegacyStorePlugin, StorePlugin, getLegacyPluginList, getPluginList } from '../../store';
|
import { StorePlugin, getPluginList } from '../../store';
|
||||||
import PluginCard from './PluginCard';
|
import PluginCard from './PluginCard';
|
||||||
|
|
||||||
const logger = new Logger('FilePicker');
|
const logger = new Logger('FilePicker');
|
||||||
|
|
||||||
const StorePage: FC<{}> = () => {
|
const StorePage: FC<{}> = () => {
|
||||||
const [data, setData] = useState<StorePlugin[] | null>(null);
|
const [data, setData] = useState<StorePlugin[] | null>(null);
|
||||||
const [legacyData, setLegacyData] = useState<LegacyStorePlugin[] | null>(null);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
(async () => {
|
(async () => {
|
||||||
@@ -17,11 +16,6 @@ const StorePage: FC<{}> = () => {
|
|||||||
logger.log('got data!', res);
|
logger.log('got data!', res);
|
||||||
setData(res);
|
setData(res);
|
||||||
})();
|
})();
|
||||||
(async () => {
|
|
||||||
const res = await getLegacyPluginList();
|
|
||||||
logger.log('got legacy data!', res);
|
|
||||||
setLegacyData(res);
|
|
||||||
})();
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -49,11 +43,6 @@ const StorePage: FC<{}> = () => {
|
|||||||
{data.map((plugin: StorePlugin) => (
|
{data.map((plugin: StorePlugin) => (
|
||||||
<PluginCard plugin={plugin} />
|
<PluginCard plugin={plugin} />
|
||||||
))}
|
))}
|
||||||
{!legacyData ? (
|
|
||||||
<SteamSpinner />
|
|
||||||
) : (
|
|
||||||
legacyData.map((plugin: LegacyStorePlugin) => <PluginCard plugin={plugin} />)
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+1
-48
@@ -1,5 +1,3 @@
|
|||||||
import { ConfirmModal, showModal, staticClasses } from 'decky-frontend-lib';
|
|
||||||
|
|
||||||
import { Plugin } from './plugin';
|
import { Plugin } from './plugin';
|
||||||
|
|
||||||
export interface StorePluginVersion {
|
export interface StorePluginVersion {
|
||||||
@@ -17,22 +15,12 @@ export interface StorePlugin {
|
|||||||
image_url: string;
|
image_url: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface LegacyStorePlugin {
|
|
||||||
artifact: string;
|
|
||||||
versions: {
|
|
||||||
[version: string]: string;
|
|
||||||
};
|
|
||||||
author: string;
|
|
||||||
description: string;
|
|
||||||
tags: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
// name: version
|
// name: version
|
||||||
export type PluginUpdateMapping = Map<string, StorePluginVersion>;
|
export type PluginUpdateMapping = Map<string, StorePluginVersion>;
|
||||||
|
|
||||||
export async function getPluginList(): Promise<StorePlugin[]> {
|
export async function getPluginList(): Promise<StorePlugin[]> {
|
||||||
let version = await window.DeckyPluginLoader.updateVersion();
|
let version = await window.DeckyPluginLoader.updateVersion();
|
||||||
return fetch('https://beta.deckbrew.xyz/plugins', {
|
return fetch('https://plugins.deckbrew.xyz/plugins', {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
'X-Decky-Version': version.current,
|
'X-Decky-Version': version.current,
|
||||||
@@ -40,12 +28,6 @@ export async function getPluginList(): Promise<StorePlugin[]> {
|
|||||||
}).then((r) => r.json());
|
}).then((r) => r.json());
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getLegacyPluginList(): Promise<LegacyStorePlugin[]> {
|
|
||||||
return fetch('https://plugins.deckbrew.xyz/get_plugins', {
|
|
||||||
method: 'GET',
|
|
||||||
}).then((r) => r.json());
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function installFromURL(url: string) {
|
export async function installFromURL(url: string) {
|
||||||
const splitURL = url.split('/');
|
const splitURL = url.split('/');
|
||||||
await window.DeckyPluginLoader.callServerMethod('install_plugin', {
|
await window.DeckyPluginLoader.callServerMethod('install_plugin', {
|
||||||
@@ -54,31 +36,6 @@ export async function installFromURL(url: string) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function requestLegacyPluginInstall(plugin: LegacyStorePlugin, selectedVer: string) {
|
|
||||||
showModal(
|
|
||||||
<ConfirmModal
|
|
||||||
onOK={() => {
|
|
||||||
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
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div className={staticClasses.Title} style={{ flexDirection: 'column', boxShadow: 'unset' }}>
|
|
||||||
Using legacy plugins
|
|
||||||
</div>
|
|
||||||
You are currently installing a <b>legacy</b> 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.
|
|
||||||
</ConfirmModal>,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function requestPluginInstall(plugin: string, selectedVer: StorePluginVersion) {
|
export async function requestPluginInstall(plugin: string, selectedVer: StorePluginVersion) {
|
||||||
await window.DeckyPluginLoader.callServerMethod('install_plugin', {
|
await window.DeckyPluginLoader.callServerMethod('install_plugin', {
|
||||||
name: plugin,
|
name: plugin,
|
||||||
@@ -99,7 +56,3 @@ export async function checkForUpdates(plugins: Plugin[]): Promise<PluginUpdateMa
|
|||||||
}
|
}
|
||||||
return updateMap;
|
return updateMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isLegacyPlugin(plugin: LegacyStorePlugin | StorePlugin): plugin is LegacyStorePlugin {
|
|
||||||
return 'artifact' in plugin;
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user