summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorxXJSONDeruloXx <danielhimebauch@gmail.com>2026-09-10 00:25:58 -0400
committerxXJSONDeruloXx <danielhimebauch@gmail.com>2026-09-10 00:25:58 -0400
commitbc75bb93d5aa9aa176262a138f47d3a1d53afbcb (patch)
tree8679659a3b64b57761127c6619b57f7f8d780a0b /src
parentfb4d053213bdbda271a54b517a11a89c4780f80a (diff)
downloaddecky-lsfg-vk-bc75bb93d5aa9aa176262a138f47d3a1d53afbcb.tar.gz
decky-lsfg-vk-bc75bb93d5aa9aa176262a138f47d3a1d53afbcb.zip
fix: simplify Flatpak runtime toggles
Diffstat (limited to 'src')
-rw-r--r--src/api/lsfgApi.ts17
-rw-r--r--src/components/SetupTab.tsx76
2 files changed, 3 insertions, 90 deletions
diff --git a/src/api/lsfgApi.ts b/src/api/lsfgApi.ts
index 16b6eab..8179ef9 100644
--- a/src/api/lsfgApi.ts
+++ b/src/api/lsfgApi.ts
@@ -124,17 +124,6 @@ export interface FlatpakExtensionStatus {
extension_id: string;
supported_branches: string[];
installed_branches: string[];
- owned_branches: string[];
- ownership_uncertain: boolean;
-}
-
-export interface FlatpakCleanupResult {
- success: boolean;
- message: string;
- error?: string | null;
- removed_branches: string[];
- preserved_branches: string[];
- ownership_uncertain: boolean;
}
export interface FlatpakExtensionToggleResult {
@@ -144,8 +133,6 @@ export interface FlatpakExtensionToggleResult {
runtime_branch: string;
enabled: boolean;
installed: boolean;
- owned_by_plugin: boolean;
- preserved: boolean;
}
// API functions
@@ -162,10 +149,6 @@ export const setFlatpakExtensionEnabled = callable<
[string, boolean],
FlatpakExtensionToggleResult
>("set_flatpak_extension_enabled");
-export const removePluginOwnedFlatpakExtensions = callable<
- [],
- FlatpakCleanupResult
->("remove_plugin_owned_flatpak_extensions");
export const getGameConfigs = callable<[], GameConfigsResult>("get_game_configs");
export const getInstalledGames = callable<[], InstalledGamesResult>("get_installed_games");
diff --git a/src/components/SetupTab.tsx b/src/components/SetupTab.tsx
index df43c5e..aec0e93 100644
--- a/src/components/SetupTab.tsx
+++ b/src/components/SetupTab.tsx
@@ -1,8 +1,7 @@
-import { ButtonItem, ConfirmModal, Field, PanelSection, PanelSectionRow, ToggleField, showModal } from "@decky/ui";
+import { ButtonItem, Field, PanelSection, PanelSectionRow, ToggleField } from "@decky/ui";
import { useEffect, useState } from "react";
import {
getFlatpakSupportStatus,
- removePluginOwnedFlatpakExtensions,
setFlatpakExtensionEnabled,
type FlatpakExtensionStatus,
type SteamBranchStatus,
@@ -41,8 +40,6 @@ function FlatpakSupportDiagnostics({ relevant }: { relevant: boolean }) {
extension_id: "",
supported_branches: [],
installed_branches: [],
- owned_branches: [],
- ownership_uncertain: false,
});
}
};
@@ -67,61 +64,10 @@ function FlatpakSupportDiagnostics({ relevant }: { relevant: boolean }) {
}
};
- const confirmDisable = (version: string) => {
- showModal(
- <ConfirmModal
- strTitle={`Disable Flatpak runtime ${version}?`}
- strDescription="Only runtime extensions installed by this plugin can be removed. Pre-existing extensions are preserved."
- strOKButtonText="Disable"
- strCancelButtonText="Cancel"
- onOK={() => void runExtensionOperation(version, false)}
- onCancel={() => {}}
- />,
- );
- };
-
const handleExtensionToggle = (version: string, enabled: boolean) => {
- const installed = status.installed_branches.includes(version);
- const owned = status.owned_branches.includes(version);
- if (!enabled && installed && !owned) {
- showErrorToast(
- "Flatpak runtime preserved",
- `${version} was not installed by this plugin, so it will remain installed.`,
- );
- void refresh();
- return;
- }
- if (!enabled && installed && owned) {
- confirmDisable(version);
- return;
- }
void runExtensionOperation(version, enabled);
};
- const confirmCleanup = () => {
- showModal(
- <ConfirmModal
- strTitle="Remove plugin-installed Flatpak extensions?"
- strDescription="Shared runtime branches recorded as installed by this plugin will be removed. Existing unowned branches are preserved."
- strOKButtonText="Remove extensions"
- strCancelButtonText="Cancel"
- onOK={async () => {
- setOperation("cleanup");
- try {
- const result = await removePluginOwnedFlatpakExtensions();
- if (!result.success) throw new Error(result.error || result.message || "Flatpak cleanup failed");
- await refresh();
- } catch (error) {
- showErrorToast("Flatpak cleanup failed", String(error));
- } finally {
- setOperation(null);
- }
- }}
- onCancel={() => {}}
- />,
- );
- };
-
return (
<PanelSection title="Flatpak support">
<PanelSectionRow>
@@ -147,31 +93,15 @@ function FlatpakSupportDiagnostics({ relevant }: { relevant: boolean }) {
: operation === `disable-${branch}`
? "Uninstalling..."
: status.installed_branches.includes(branch)
- ? status.owned_branches.includes(branch)
- ? "Installed · plugin-owned"
- : "Installed · pre-existing (preserved)"
+ ? "Installed"
: "Not installed"
}
checked={status.installed_branches.includes(branch)}
onChange={(enabled) => handleExtensionToggle(branch, enabled)}
- disabled={operation !== null || status.ownership_uncertain}
+ disabled={operation !== null}
/>
</PanelSectionRow>
))}
- {status.ownership_uncertain && (
- <PanelSectionRow>
- <Field label="Ownership metadata is uncertain" description="Cleanup is disabled until the metadata is repaired." />
- </PanelSectionRow>
- )}
- <PanelSectionRow>
- <ButtonItem
- layout="below"
- disabled={operation !== null || status.ownership_uncertain || status.owned_branches.length === 0}
- onClick={confirmCleanup}
- >
- {operation === "cleanup" ? "Removing..." : "Remove plugin-installed extensions"}
- </ButtonItem>
- </PanelSectionRow>
</>
)}
</PanelSection>