diff options
| author | Christopher Lott <chris@MacBook-Air-von-Christopher.fritz.box> | 2026-05-07 22:44:59 +0200 |
|---|---|---|
| committer | Christopher Lott <chris@MacBook-Air-von-Christopher.fritz.box> | 2026-05-07 22:44:59 +0200 |
| commit | 0a9ed38d9e5e3f67efc0ecdc0d549d67ccb86fb8 (patch) | |
| tree | 02ae7ff4b1a8d8db528e55bd00d58b044e29aa57 /src | |
| parent | 97a70cd68813f2174fe145ee79784e509d11a742 (diff) | |
| download | decky-lsfg-vk-0a9ed38d9e5e3f67efc0ecdc0d549d67ccb86fb8.tar.gz decky-lsfg-vk-0a9ed38d9e5e3f67efc0ecdc0d549d67ccb86fb8.zip | |
remove dead code across frontend and backend
- Remove TS ConfigurationManager class in configSchema.ts (called
non-existent backend methods; only getDefaults() was used, replaced
with direct import)
- Remove Python update_config method and create_config_from_args (unreachable
since plugin.py routes through update_config_from_dict; also carried a
duplicate @staticmethod that would crash at runtime)
- Delete configuration_helpers_generated.py entirely (all three functions
were unused)
- Remove their generators from generate_python_boilerplate.py
- Remove dead generated code from config_schema_generated.py
(create_config_dict, get_function_parameters, TOML_FIELDS, SCRIPT_FIELDS)
- Remove duplicate import in config_schema.py
- Remove unused config prop from UsageInstructions component
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/Content.tsx | 2 | ||||
| -rw-r--r-- | src/components/UsageInstructions.tsx | 7 | ||||
| -rw-r--r-- | src/config/configSchema.ts | 118 | ||||
| -rw-r--r-- | src/hooks/useLsfgHooks.ts | 8 |
4 files changed, 6 insertions, 129 deletions
diff --git a/src/components/Content.tsx b/src/components/Content.tsx index 3dc2696..3f94745 100644 --- a/src/components/Content.tsx +++ b/src/components/Content.tsx @@ -143,7 +143,7 @@ export function Content() { </> )} - <UsageInstructions config={config} /> + <UsageInstructions /> <PanelSectionRow> <ButtonItem diff --git a/src/components/UsageInstructions.tsx b/src/components/UsageInstructions.tsx index 0c27517..5f032b8 100644 --- a/src/components/UsageInstructions.tsx +++ b/src/components/UsageInstructions.tsx @@ -1,11 +1,6 @@ import { PanelSectionRow } from "@decky/ui"; -import { ConfigurationData } from "../config/configSchema"; -interface UsageInstructionsProps { - config: ConfigurationData; -} - -export function UsageInstructions({ config: _config }: UsageInstructionsProps) { +export function UsageInstructions() { return ( <> <PanelSectionRow> diff --git a/src/config/configSchema.ts b/src/config/configSchema.ts index 6c6cf19..8b4fc1e 100644 --- a/src/config/configSchema.ts +++ b/src/config/configSchema.ts @@ -1,15 +1,3 @@ -/** - * Configuration schema and management for LSFG VK plugin - * - * This file re-exports auto-generated configuration constants from generatedConfigSchema.ts - * and provides the ConfigurationManager class for handling configuration operations. - */ - -import { callable } from "@decky/api"; -import type { ConfigurationData } from './generatedConfigSchema'; -import { getDefaults } from './generatedConfigSchema'; -import { updateLsfgConfig } from "../api/lsfgApi"; - export { ConfigFieldType, ConfigField, @@ -23,109 +11,3 @@ export { DISABLE_STEAMDECK_MODE, MANGOHUD_WORKAROUND, DISABLE_VKBASALT, FORCE_ENABLE_VKBASALT, ENABLE_WSI, ENABLE_ZINK } from './generatedConfigSchema'; - -/** - * Configuration management class - * Handles CRUD operations for plugin configuration - */ -export class ConfigurationManager { - private static instance: ConfigurationManager; - private _config: ConfigurationData | null = null; - - private getConfiguration = callable<[], { success: boolean; data?: ConfigurationData; error?: string }>("get_configuration"); - private resetConfiguration = callable<[], { success: boolean; data?: ConfigurationData; error?: string }>("reset_configuration"); - - private constructor() {} - - static getInstance(): ConfigurationManager { - if (!ConfigurationManager.instance) { - ConfigurationManager.instance = new ConfigurationManager(); - } - return ConfigurationManager.instance; - } - - /** - * Get default configuration values - */ - static getDefaults(): ConfigurationData { - return getDefaults(); - } - - /** - * Load configuration from backend - */ - async loadConfig(): Promise<ConfigurationData> { - try { - const result = await this.getConfiguration(); - if (result.success && result.data) { - this._config = result.data; - return this._config; - } else { - throw new Error(result.error || 'Failed to load configuration'); - } - } catch (error) { - console.error('Error loading configuration:', error); - throw error; - } - } - - /** - * Save configuration to backend - */ - async saveConfig(config: ConfigurationData): Promise<void> { - try { - const result = await updateLsfgConfig(config); - if (result.success) { - this._config = config; - } else { - throw new Error(result.error || 'Failed to save configuration'); - } - } catch (error) { - console.error('Error saving configuration:', error); - throw error; - } - } - - /** - * Update a single configuration field - */ - async updateField(fieldName: keyof ConfigurationData, value: any): Promise<void> { - if (!this._config) { - await this.loadConfig(); - } - - const updatedConfig = { - ...this._config!, - [fieldName]: value - }; - - await this.saveConfig(updatedConfig); - } - - /** - * Get current configuration (cached) - */ - getConfig(): ConfigurationData | null { - return this._config; - } - - /** - * Reset configuration to defaults - */ - async resetToDefaults(): Promise<ConfigurationData> { - try { - const result = await this.resetConfiguration(); - if (result.success && result.data) { - this._config = result.data; - return this._config; - } else { - throw new Error(result.error || 'Failed to reset configuration'); - } - } catch (error) { - console.error('Error resetting configuration:', error); - throw error; - } - } -} - -export const configManager = ConfigurationManager.getInstance(); diff --git a/src/hooks/useLsfgHooks.ts b/src/hooks/useLsfgHooks.ts index adc18ba..d9bbe3e 100644 --- a/src/hooks/useLsfgHooks.ts +++ b/src/hooks/useLsfgHooks.ts @@ -6,7 +6,7 @@ import { updateLsfgConfigFromObject, type ConfigUpdateResult } from "../api/lsfgApi"; -import { ConfigurationData, ConfigurationManager } from "../config/configSchema"; +import { ConfigurationData, getDefaults } from "../config/configSchema"; import { showErrorToast, ToastMessages } from "../utils/toastUtils"; export function useInstallationStatus() { @@ -71,7 +71,7 @@ export function useDllDetection() { } export function useLsfgConfig() { - const [config, setConfig] = useState<ConfigurationData>(() => ConfigurationManager.getDefaults()); + const [config, setConfig] = useState<ConfigurationData>(() => getDefaults()); const loadLsfgConfig = useCallback(async () => { try { @@ -80,11 +80,11 @@ export function useLsfgConfig() { setConfig(result.config); } else { console.log("lsfg config not available, using defaults:", result.error); - setConfig(ConfigurationManager.getDefaults()); + setConfig(getDefaults()); } } catch (error) { console.error("Error loading lsfg config:", error); - setConfig(ConfigurationManager.getDefaults()); + setConfig(getDefaults()); } }, []); |
