mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-14 20:01:47 +00:00
fix: fix Cannot access 'Ba' before initialization on first run
This commit is contained in:
@ -1,21 +1,10 @@
|
|||||||
import Store from 'electron-store';
|
import Store from 'electron-store';
|
||||||
import Conf from 'conf';
|
import Conf from 'conf';
|
||||||
|
|
||||||
import { allPlugins } from 'virtual:plugins';
|
|
||||||
|
|
||||||
import defaults from './defaults';
|
import defaults from './defaults';
|
||||||
|
|
||||||
import { DefaultPresetList, type Preset } from '@/plugins/downloader/types';
|
import { DefaultPresetList, type Preset } from '@/plugins/downloader/types';
|
||||||
|
|
||||||
const setDefaultPluginOptions = (
|
|
||||||
store: Conf<Record<string, unknown>>,
|
|
||||||
plugin: string,
|
|
||||||
) => {
|
|
||||||
if (!store.get(`plugins.${plugin}`)) {
|
|
||||||
store.set(`plugins.${plugin}`, allPlugins[plugin].config);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const migrations = {
|
const migrations = {
|
||||||
'>=2.1.3'(store: Conf<Record<string, unknown>>) {
|
'>=2.1.3'(store: Conf<Record<string, unknown>>) {
|
||||||
const listenAlong = store.get('plugins.discord.listenAlong');
|
const listenAlong = store.get('plugins.discord.listenAlong');
|
||||||
@ -50,12 +39,11 @@ const migrations = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
'>=1.20.0'(store: Conf<Record<string, unknown>>) {
|
'>=1.20.0'(store: Conf<Record<string, unknown>>) {
|
||||||
setDefaultPluginOptions(store, 'visualizer');
|
store.delete('plugins.visualizer'); // default value is now in the plugin
|
||||||
|
|
||||||
if (store.get('plugins.notifications.toastStyle') === undefined) {
|
if (store.get('plugins.notifications.toastStyle') === undefined) {
|
||||||
const pluginOptions = store.get('plugins.notifications') || {};
|
const pluginOptions = store.get('plugins.notifications') || {};
|
||||||
store.set('plugins.notifications', {
|
store.set('plugins.notifications', {
|
||||||
...allPlugins.notifications.config,
|
|
||||||
...pluginOptions,
|
...pluginOptions,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -66,7 +54,7 @@ const migrations = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
'>=1.17.0'(store: Conf<Record<string, unknown>>) {
|
'>=1.17.0'(store: Conf<Record<string, unknown>>) {
|
||||||
setDefaultPluginOptions(store, 'picture-in-picture');
|
store.delete('plugins.picture-in-picture'); // default value is now in the plugin
|
||||||
|
|
||||||
if (store.get('plugins.video-toggle.mode') === undefined) {
|
if (store.get('plugins.video-toggle.mode') === undefined) {
|
||||||
store.set('plugins.video-toggle.mode', 'custom');
|
store.set('plugins.video-toggle.mode', 'custom');
|
||||||
|
|||||||
Reference in New Issue
Block a user