mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-09 20:29:36 +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",
|
"toggleSmartPlaylistEditor": "toggle $t(entity.smartPlaylist) editor",
|
||||||
"viewPlaylists": "view $t(entity.playlist_other)",
|
"viewPlaylists": "view $t(entity.playlist_other)",
|
||||||
"viewMore": "view more",
|
"viewMore": "view more",
|
||||||
|
"openApplicationDirectory": "open application directory",
|
||||||
"openIn": {
|
"openIn": {
|
||||||
"lastfm": "Open in Last.fm",
|
"lastfm": "Open in Last.fm",
|
||||||
"musicbrainz": "Open in MusicBrainz"
|
"musicbrainz": "Open in MusicBrainz"
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ export const store = new Store({
|
|||||||
'>=0.21.2': (store) => {
|
'>=0.21.2': (store) => {
|
||||||
store.set('window_bar_style', 'linux');
|
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);
|
return ipcRenderer.invoke('open-item', path);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const openApplicationDirectory = async () => {
|
||||||
|
return ipcRenderer.invoke('open-application-directory');
|
||||||
|
};
|
||||||
|
|
||||||
const playerErrorListener = (cb: (event: IpcRendererEvent, data: { code: number }) => void) => {
|
const playerErrorListener = (cb: (event: IpcRendererEvent, data: { code: number }) => void) => {
|
||||||
ipcRenderer.on('player-error-listener', cb);
|
ipcRenderer.on('player-error-listener', cb);
|
||||||
};
|
};
|
||||||
@@ -42,6 +46,7 @@ export const utils = {
|
|||||||
isWindows,
|
isWindows,
|
||||||
logger,
|
logger,
|
||||||
mainMessageListener,
|
mainMessageListener,
|
||||||
|
openApplicationDirectory,
|
||||||
openItem,
|
openItem,
|
||||||
playerErrorListener,
|
playerErrorListener,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -94,10 +94,25 @@ export const CacheSettings = () => {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const handleOpenApplicationDirectory = async () => {
|
||||||
|
if (isElectron() && window.api?.utils) {
|
||||||
|
await window.api.utils.openApplicationDirectory();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SettingsSection
|
<>
|
||||||
options={options}
|
<SettingsSection
|
||||||
title={t('page.setting.cache', { postProcess: 'sentenceCase' })}
|
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