add migration to clear all original store settings (#1396)

This commit is contained in:
jeffvli
2025-12-15 19:07:12 -08:00
parent 614761efd7
commit 96d2699a2d
5 changed files with 36 additions and 4 deletions
+1
View File
@@ -30,6 +30,7 @@
"toggleSmartPlaylistEditor": "toggle $t(entity.smartPlaylist) editor",
"viewPlaylists": "view $t(entity.playlist_other)",
"viewMore": "view more",
"openApplicationDirectory": "open application directory",
"openIn": {
"lastfm": "Open in Last.fm",
"musicbrainz": "Open in MusicBrainz"
+3
View File
@@ -11,6 +11,9 @@ export const store = new Store({
'>=0.21.2': (store) => {
store.set('window_bar_style', 'linux');
},
'>=1.0.0': (store) => {
store.clear();
},
},
});
+8
View File
@@ -693,3 +693,11 @@ if (!ipcMain.eventNames().includes('open-item')) {
});
});
}
// Register 'open-application-directory' handler globally, ensuring it is only registered once
if (!ipcMain.eventNames().includes('open-application-directory')) {
ipcMain.handle('open-application-directory', async () => {
const userDataPath = app.getPath('userData');
shell.openPath(userDataPath);
});
}
+5
View File
@@ -6,6 +6,10 @@ const openItem = async (path: string) => {
return ipcRenderer.invoke('open-item', path);
};
const openApplicationDirectory = async () => {
return ipcRenderer.invoke('open-application-directory');
};
const playerErrorListener = (cb: (event: IpcRendererEvent, data: { code: number }) => void) => {
ipcRenderer.on('player-error-listener', cb);
};
@@ -42,6 +46,7 @@ export const utils = {
isWindows,
logger,
mainMessageListener,
openApplicationDirectory,
openItem,
playerErrorListener,
};
@@ -94,10 +94,25 @@ export const CacheSettings = () => {
},
];
const handleOpenApplicationDirectory = async () => {
if (isElectron() && window.api?.utils) {
await window.api.utils.openApplicationDirectory();
}
};
return (
<SettingsSection
options={options}
title={t('page.setting.cache', { postProcess: 'sentenceCase' })}
/>
<>
<SettingsSection
options={options}
title={t('page.setting.cache', { postProcess: 'sentenceCase' })}
/>
{isElectron() && (
<Button onClick={handleOpenApplicationDirectory} variant="default">
{t('action.openApplicationDirectory', {
postProcess: 'sentenceCase',
})}
</Button>
)}
</>
);
};