mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-07-11 23:11:56 +00:00
Fix: add an API compatibility layer for the old file picker and change the new implementation as V2
This commit is contained in:
+34
-31
@@ -24,6 +24,9 @@
|
||||
}
|
||||
},
|
||||
"FilePickerIndex": {
|
||||
"file": {
|
||||
"select": "Select this file"
|
||||
},
|
||||
"files": {
|
||||
"all_files": "All Files",
|
||||
"file_type": "File Type",
|
||||
@@ -45,12 +48,27 @@
|
||||
"show_more": "Show more files"
|
||||
}
|
||||
},
|
||||
"PluginView": {
|
||||
"hidden_one": "1 plugin is hidden from this list",
|
||||
"hidden_other": "{{count}} plugins are hidden from this list"
|
||||
"MultiplePluginsInstallModal": {
|
||||
"confirm": "Are you sure you want to make the following modifications?",
|
||||
"description": {
|
||||
"install": "Install {{name}} {{version}}",
|
||||
"reinstall": "Reinstall {{name}} {{version}}",
|
||||
"update": "Update {{name}} to {{version}}"
|
||||
},
|
||||
"PluginListLabel": {
|
||||
"hidden": "Hidden from the quick access menu"
|
||||
"ok_button": {
|
||||
"idle": "Confirm",
|
||||
"loading": "Working"
|
||||
},
|
||||
"title": {
|
||||
"install_one": "Install 1 plugin",
|
||||
"install_other": "Install {{count}} plugins",
|
||||
"mixed_one": "Modify {{count}} plugin",
|
||||
"mixed_other": "Modify {{count}} plugins",
|
||||
"reinstall_one": "Reinstall 1 plugin",
|
||||
"reinstall_other": "Reinstall {{count}} plugins",
|
||||
"update_one": "Update 1 plugin",
|
||||
"update_other": "Update {{count}} plugins"
|
||||
}
|
||||
},
|
||||
"PluginCard": {
|
||||
"plugin_full_access": "This plugin has full access to your Steam Deck.",
|
||||
@@ -79,39 +97,20 @@
|
||||
"title": "Update {{artifact}}"
|
||||
}
|
||||
},
|
||||
"MultiplePluginsInstallModal": {
|
||||
"title": {
|
||||
"mixed_one": "Modify {{count}} plugin",
|
||||
"mixed_other": "Modify {{count}} plugins",
|
||||
"update_one": "Update 1 plugin",
|
||||
"update_other": "Update {{count}} plugins",
|
||||
"reinstall_one": "Reinstall 1 plugin",
|
||||
"reinstall_other": "Reinstall {{count}} plugins",
|
||||
"install_one": "Install 1 plugin",
|
||||
"install_other": "Install {{count}} plugins"
|
||||
},
|
||||
"ok_button": {
|
||||
"idle": "Confirm",
|
||||
"loading": "Working"
|
||||
},
|
||||
"confirm": "Are you sure you want to make the following modifications?",
|
||||
"description": {
|
||||
"install": "Install {{name}} {{version}}",
|
||||
"update": "Update {{name}} to {{version}}",
|
||||
"reinstall": "Reinstall {{name}} {{version}}"
|
||||
}
|
||||
},
|
||||
"PluginListIndex": {
|
||||
"hide": "Quick access: Hide",
|
||||
"no_plugin": "No plugins installed!",
|
||||
"plugin_actions": "Plugin Actions",
|
||||
"reinstall": "Reinstall",
|
||||
"reload": "Reload",
|
||||
"uninstall": "Uninstall",
|
||||
"update_to": "Update to {{name}}",
|
||||
"show": "Quick access: Show",
|
||||
"hide": "Quick access: Hide",
|
||||
"uninstall": "Uninstall",
|
||||
"update_all_one": "Update 1 plugin",
|
||||
"update_all_other": "Update {{count}} plugins"
|
||||
"update_all_other": "Update {{count}} plugins",
|
||||
"update_to": "Update to {{name}}"
|
||||
},
|
||||
"PluginListLabel": {
|
||||
"hidden": "Hidden from the quick access menu"
|
||||
},
|
||||
"PluginLoader": {
|
||||
"decky_title": "Decky",
|
||||
@@ -130,6 +129,10 @@
|
||||
"plugin_update_one": "Updates available for 1 plugin!",
|
||||
"plugin_update_other": "Updates available for {{count}} plugins!"
|
||||
},
|
||||
"PluginView": {
|
||||
"hidden_one": "1 plugin is hidden from this list",
|
||||
"hidden_other": "{{count}} plugins are hidden from this list"
|
||||
},
|
||||
"RemoteDebugging": {
|
||||
"remote_cef": {
|
||||
"desc": "Allow unauthenticated access to the CEF debugger to anyone in your network",
|
||||
|
||||
+45
-42
@@ -24,6 +24,9 @@
|
||||
}
|
||||
},
|
||||
"FilePickerIndex": {
|
||||
"file": {
|
||||
"select": "Seleziona questo file"
|
||||
},
|
||||
"files": {
|
||||
"all_files": "Tutti i file",
|
||||
"file_type": "Tipo di file",
|
||||
@@ -45,6 +48,32 @@
|
||||
"show_more": "Mostra più file"
|
||||
}
|
||||
},
|
||||
"MultiplePluginsInstallModal": {
|
||||
"confirm": "Sei sicuro di voler effettuare le modifiche seguenti?",
|
||||
"description": {
|
||||
"install": "Installa {{name}} {{version}}",
|
||||
"reinstall": "Reinstalla {{name}} {{version}}",
|
||||
"update": "Aggiorna {{name}} alla versione {{version}}"
|
||||
},
|
||||
"ok_button": {
|
||||
"idle": "Conferma",
|
||||
"loading": "Elaboro"
|
||||
},
|
||||
"title": {
|
||||
"install_one": "Installa un plugin",
|
||||
"install_many": "Installa {{count}} plugins",
|
||||
"install_other": "Installa {{count}} plugins",
|
||||
"mixed_one": "Modifica un plugin",
|
||||
"mixed_many": "Modifica {{count}} plugins",
|
||||
"mixed_other": "Modifica {{count}} plugins",
|
||||
"reinstall_one": "Reinstalla un plugin",
|
||||
"reinstall_many": "Reinstalla {{count}} plugins",
|
||||
"reinstall_other": "Reinstalla {{count}} plugins",
|
||||
"update_one": "Aggiorna un plugin",
|
||||
"update_many": "Aggiorna {{count}} plugins",
|
||||
"update_other": "Aggiorna {{count}} plugins"
|
||||
}
|
||||
},
|
||||
"PluginCard": {
|
||||
"plugin_full_access": "Questo plugin ha accesso completo al tuo Steam Deck.",
|
||||
"plugin_install": "Installa",
|
||||
@@ -73,17 +102,20 @@
|
||||
}
|
||||
},
|
||||
"PluginListIndex": {
|
||||
"hide": "Accesso rapido: Nascondi",
|
||||
"no_plugin": "Nessun plugin installato!",
|
||||
"plugin_actions": "Operazioni sui plugins",
|
||||
"reinstall": "Reinstalla",
|
||||
"reload": "Ricarica",
|
||||
"show": "Accesso rapido: Mostra",
|
||||
"uninstall": "Rimuovi",
|
||||
"update_to": "Aggiorna a {{name}}",
|
||||
"update_all_one": "Aggiorna un plugin",
|
||||
"update_all_many": "Aggiorna {{count}} plugins",
|
||||
"update_all_other": "Aggiorna {{count}} plugins",
|
||||
"show": "Accesso rapido: Mostra",
|
||||
"hide": "Accesso rapido: Nascondi"
|
||||
"update_to": "Aggiorna a {{name}}"
|
||||
},
|
||||
"PluginListLabel": {
|
||||
"hidden": "Nascosti dal menu di accesso rapido"
|
||||
},
|
||||
"PluginLoader": {
|
||||
"decky_title": "Decky",
|
||||
@@ -103,6 +135,11 @@
|
||||
"plugin_update_many": "Aggiornamenti disponibili per {{count}} plugins!",
|
||||
"plugin_update_other": "Aggiornamenti disponibili per {{count}} plugins!"
|
||||
},
|
||||
"PluginView": {
|
||||
"hidden_one": "Un plugin è nascosto dalla lista",
|
||||
"hidden_many": "Sono nascosti {{count}} plugin dalla lista",
|
||||
"hidden_other": "Sono nascosti {{count}} plugin dalla lista"
|
||||
},
|
||||
"RemoteDebugging": {
|
||||
"remote_cef": {
|
||||
"desc": "Permetti l'accesso non autenticato al debugger di CEF da tutti gli indirizzi sulla tua rete locale",
|
||||
@@ -110,6 +147,11 @@
|
||||
}
|
||||
},
|
||||
"SettingsDeveloperIndex": {
|
||||
"cef_console": {
|
||||
"button": "Apri la console",
|
||||
"desc": "Apri la console di CEF. Utile solamente per ragioni di debug. Questa opzione deve essere usata solo se sei uno sviluppatore di plugin o se uno di questi ti ha chiesto di farlo, visto che questa feature potrebbe essere potenzialmente pericolosa.",
|
||||
"label": "Console CEF"
|
||||
},
|
||||
"header": "Altro",
|
||||
"react_devtools": {
|
||||
"desc": "Abilita la connessione ad un computer che esegue i DevTools di React. Steam verrà ricaricato se lo stato cambia. Imposta il tuo indirizzo IP prima di abilitarlo.",
|
||||
@@ -132,11 +174,6 @@
|
||||
"desc1": "Abilita il menu di sviluppo interno di Valve.",
|
||||
"desc2": "Non toccare nulla in questo menu se non sai quello che fa.",
|
||||
"label": "Abilita Menu Sviluppatore"
|
||||
},
|
||||
"cef_console": {
|
||||
"label": "Console CEF",
|
||||
"button": "Apri la console",
|
||||
"desc": "Apri la console di CEF. Utile solamente per ragioni di debug. Questa opzione deve essere usata solo se sei uno sviluppatore di plugin o se uno di questi ti ha chiesto di farlo, visto che questa feature potrebbe essere potenzialmente pericolosa."
|
||||
}
|
||||
},
|
||||
"SettingsGeneralIndex": {
|
||||
@@ -218,39 +255,5 @@
|
||||
"reloading": "Ricaricando",
|
||||
"updating": "Aggiornando"
|
||||
}
|
||||
},
|
||||
"MultiplePluginsInstallModal": {
|
||||
"title": {
|
||||
"mixed_one": "Modifica un plugin",
|
||||
"mixed_many": "Modifica {{count}} plugins",
|
||||
"mixed_other": "Modifica {{count}} plugins",
|
||||
"update_one": "Aggiorna un plugin",
|
||||
"update_many": "Aggiorna {{count}} plugins",
|
||||
"update_other": "Aggiorna {{count}} plugins",
|
||||
"reinstall_one": "Reinstalla un plugin",
|
||||
"reinstall_many": "Reinstalla {{count}} plugins",
|
||||
"reinstall_other": "Reinstalla {{count}} plugins",
|
||||
"install_one": "Installa un plugin",
|
||||
"install_many": "Installa {{count}} plugins",
|
||||
"install_other": "Installa {{count}} plugins"
|
||||
},
|
||||
"confirm": "Sei sicuro di voler effettuare le modifiche seguenti?",
|
||||
"ok_button": {
|
||||
"idle": "Conferma",
|
||||
"loading": "Elaboro"
|
||||
},
|
||||
"description": {
|
||||
"install": "Installa {{name}} {{version}}",
|
||||
"update": "Aggiorna {{name}} alla versione {{version}}",
|
||||
"reinstall": "Reinstalla {{name}} {{version}}"
|
||||
}
|
||||
},
|
||||
"PluginView": {
|
||||
"hidden_one": "Un plugin è nascosto dalla lista",
|
||||
"hidden_many": "Sono nascosti {{count}} plugin dalla lista",
|
||||
"hidden_other": "Sono nascosti {{count}} plugin dalla lista"
|
||||
},
|
||||
"PluginListLabel": {
|
||||
"hidden": "Nascosti dal menu di accesso rapido"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ export interface FilePickerProps {
|
||||
allowAllFiles?: boolean;
|
||||
defaultHidden?: boolean;
|
||||
max?: number;
|
||||
fileSelType?: FileSelectionType;
|
||||
onSubmit: (val: { path: string; realpath: string }) => void;
|
||||
closeModal?: () => void;
|
||||
}
|
||||
@@ -48,6 +49,12 @@ export interface File {
|
||||
created: number;
|
||||
}
|
||||
|
||||
export enum FileSelectionType {
|
||||
FILE,
|
||||
FOLDER,
|
||||
NONE,
|
||||
}
|
||||
|
||||
interface FileListing {
|
||||
realpath: string;
|
||||
files: File[];
|
||||
@@ -127,6 +134,7 @@ const FilePicker: FunctionComponent<FilePickerProps> = ({
|
||||
allowAllFiles = true,
|
||||
defaultHidden = false, // false by default makes sense for most users
|
||||
max = 1000,
|
||||
fileSelType = FileSelectionType.NONE,
|
||||
onSubmit,
|
||||
closeModal,
|
||||
}) => {
|
||||
@@ -327,7 +335,7 @@ const FilePicker: FunctionComponent<FilePickerProps> = ({
|
||||
</Focusable>
|
||||
</DialogControlsSection>
|
||||
</DialogBody>
|
||||
{!loading && error === FileErrorTypes.None && !includeFiles && (
|
||||
{!loading && error === FileErrorTypes.None && fileSelType !== FileSelectionType.NONE && (
|
||||
<DialogFooter>
|
||||
<DialogButton
|
||||
className="Primary"
|
||||
@@ -337,7 +345,9 @@ const FilePicker: FunctionComponent<FilePickerProps> = ({
|
||||
closeModal?.();
|
||||
}}
|
||||
>
|
||||
{t('FilePickerIndex.folder.select')}
|
||||
{fileSelType === FileSelectionType.FILE
|
||||
? t('FilePickerIndex.file.select')
|
||||
: t('FilePickerIndex.folder.select')}
|
||||
</DialogButton>
|
||||
</DialogFooter>
|
||||
)}
|
||||
|
||||
@@ -14,7 +14,7 @@ import { FaExclamationCircle, FaPlug } from 'react-icons/fa';
|
||||
|
||||
import { DeckyState, DeckyStateContextProvider, UserInfo, useDeckyState } from './components/DeckyState';
|
||||
import LegacyPlugin from './components/LegacyPlugin';
|
||||
import { File } from './components/modals/filepicker';
|
||||
import { File, FileSelectionType } from './components/modals/filepicker';
|
||||
import { deinitFilepickerPatches, initFilepickerPatches } from './components/modals/filepicker/patches';
|
||||
import MultiplePluginsInstallModal from './components/modals/MultiplePluginsInstallModal';
|
||||
import PluginInstallModal from './components/modals/PluginInstallModal';
|
||||
@@ -360,6 +360,38 @@ class PluginLoader extends Logger {
|
||||
}
|
||||
|
||||
openFilePicker(
|
||||
startPath: string,
|
||||
selectFiles?: boolean,
|
||||
regex?: RegExp,
|
||||
): Promise<{ path: string; realpath: string }> {
|
||||
if (selectFiles) {
|
||||
return this.openFilePickerV2(
|
||||
startPath,
|
||||
true,
|
||||
regex,
|
||||
true,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
FileSelectionType.FILE,
|
||||
);
|
||||
} else {
|
||||
return this.openFilePickerV2(
|
||||
startPath,
|
||||
false,
|
||||
regex,
|
||||
true,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
FileSelectionType.FOLDER,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
openFilePickerV2(
|
||||
startPath: string,
|
||||
includeFiles?: boolean,
|
||||
filter?: RegExp | ((file: File) => boolean),
|
||||
@@ -368,6 +400,7 @@ class PluginLoader extends Logger {
|
||||
showHiddenFiles?: boolean,
|
||||
allowAllFiles?: boolean,
|
||||
max?: number,
|
||||
select?: FileSelectionType,
|
||||
): Promise<{ path: string; realpath: string }> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const Content = ({ closeModal }: { closeModal?: () => void }) => (
|
||||
@@ -389,6 +422,7 @@ class PluginLoader extends Logger {
|
||||
defaultHidden={showHiddenFiles}
|
||||
onSubmit={resolve}
|
||||
closeModal={closeModal}
|
||||
fileSelType={select}
|
||||
max={max}
|
||||
/>
|
||||
</WithSuspense>
|
||||
|
||||
Reference in New Issue
Block a user