mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-07 04:20:12 +02:00
add migration to clear all original store settings (#1396)
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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();
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user