mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-13 03:11:46 +00:00
feat: run prettier
This commit is contained in:
@ -32,8 +32,8 @@ export interface DefaultConfig {
|
||||
startingPage: string;
|
||||
overrideUserAgent: boolean;
|
||||
themes: string[];
|
||||
},
|
||||
plugins: Record<string, unknown>,
|
||||
};
|
||||
plugins: Record<string, unknown>;
|
||||
}
|
||||
|
||||
const defaultConfig: DefaultConfig = {
|
||||
|
||||
@ -12,7 +12,10 @@ export function getPlugins() {
|
||||
}
|
||||
|
||||
export function isEnabled(plugin: string) {
|
||||
const pluginConfig = deepmerge(allPlugins[plugin].config ?? { enabled: false }, (store.get('plugins') as Record<string, PluginConfig>)[plugin] ?? {});
|
||||
const pluginConfig = deepmerge(
|
||||
allPlugins[plugin].config ?? { enabled: false },
|
||||
(store.get('plugins') as Record<string, PluginConfig>)[plugin] ?? {},
|
||||
);
|
||||
return pluginConfig !== undefined && pluginConfig.enabled;
|
||||
}
|
||||
|
||||
@ -22,7 +25,11 @@ export function isEnabled(plugin: string) {
|
||||
* @param options Options to set
|
||||
* @param exclude Options to exclude from the options object
|
||||
*/
|
||||
export function setOptions<T>(plugin: string, options: T, exclude: string[] = ['enabled']) {
|
||||
export function setOptions<T>(
|
||||
plugin: string,
|
||||
options: T,
|
||||
exclude: string[] = ['enabled'],
|
||||
) {
|
||||
const plugins = store.get('plugins') as Record<string, T>;
|
||||
// HACK: This is a workaround for preventing changed options from being overwritten
|
||||
exclude.forEach((key) => {
|
||||
@ -39,7 +46,11 @@ export function setOptions<T>(plugin: string, options: T, exclude: string[] = ['
|
||||
});
|
||||
}
|
||||
|
||||
export function setMenuOptions<T>(plugin: string, options: T, exclude: string[] = ['enabled']) {
|
||||
export function setMenuOptions<T>(
|
||||
plugin: string,
|
||||
options: T,
|
||||
exclude: string[] = ['enabled'],
|
||||
) {
|
||||
setOptions(plugin, options, exclude);
|
||||
if (store.get('options.restartOnConfigChanges')) {
|
||||
restart();
|
||||
|
||||
@ -7,10 +7,17 @@ import { DefaultPresetList, type Preset } from '@/plugins/downloader/types';
|
||||
|
||||
const migrations = {
|
||||
'>=3.0.0'(store: Conf<Record<string, unknown>>) {
|
||||
const discordConfig = store.get('plugins.discord') as Record<string, unknown>;
|
||||
const discordConfig = store.get('plugins.discord') as Record<
|
||||
string,
|
||||
unknown
|
||||
>;
|
||||
if (discordConfig) {
|
||||
const oldActivityTimoutEnabled = store.get('plugins.discord.activityTimoutEnabled') as boolean | undefined;
|
||||
const oldActivityTimoutTime = store.get('plugins.discord.activityTimoutTime') as number | undefined;
|
||||
const oldActivityTimoutEnabled = store.get(
|
||||
'plugins.discord.activityTimoutEnabled',
|
||||
) as boolean | undefined;
|
||||
const oldActivityTimoutTime = store.get(
|
||||
'plugins.discord.activityTimoutTime',
|
||||
) as number | undefined;
|
||||
if (oldActivityTimoutEnabled !== undefined) {
|
||||
discordConfig.activityTimeoutEnabled = oldActivityTimoutEnabled;
|
||||
store.set('plugins.discord', discordConfig);
|
||||
@ -93,18 +100,23 @@ const migrations = {
|
||||
}
|
||||
},
|
||||
'>=1.12.0'(store: Conf<Record<string, unknown>>) {
|
||||
const options = store.get('plugins.shortcuts') as Record<
|
||||
string,
|
||||
| {
|
||||
action: string;
|
||||
shortcut: unknown;
|
||||
}[]
|
||||
| Record<string, unknown>
|
||||
> | undefined;
|
||||
const options = store.get('plugins.shortcuts') as
|
||||
| Record<
|
||||
string,
|
||||
| {
|
||||
action: string;
|
||||
shortcut: unknown;
|
||||
}[]
|
||||
| Record<string, unknown>
|
||||
>
|
||||
| undefined;
|
||||
if (options) {
|
||||
let updated = false;
|
||||
for (const optionType of ['global', 'local']) {
|
||||
if (Object.hasOwn(options, optionType) && Array.isArray(options[optionType])) {
|
||||
if (
|
||||
Object.hasOwn(options, optionType) &&
|
||||
Array.isArray(options[optionType])
|
||||
) {
|
||||
const optionsArray = options[optionType] as {
|
||||
action: string;
|
||||
shortcut: unknown;
|
||||
|
||||
Reference in New Issue
Block a user