mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 02:31:45 +00:00
@ -1,22 +1,17 @@
|
|||||||
import { blockers } from '../plugins/adblocker/types';
|
|
||||||
|
|
||||||
import { DefaultPresetList } from '../plugins/downloader/types';
|
|
||||||
|
|
||||||
export interface WindowSizeConfig {
|
export interface WindowSizeConfig {
|
||||||
width: number;
|
width: number;
|
||||||
height: number;
|
height: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface WindowPositionConfig {
|
||||||
|
x: number;
|
||||||
|
y: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface DefaultConfig {
|
export interface DefaultConfig {
|
||||||
'window-size': {
|
'window-size': WindowSizeConfig;
|
||||||
width: number;
|
|
||||||
height: number;
|
|
||||||
}
|
|
||||||
'window-maximized': boolean;
|
'window-maximized': boolean;
|
||||||
'window-position': {
|
'window-position': WindowPositionConfig;
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
}
|
|
||||||
url: string;
|
url: string;
|
||||||
options: {
|
options: {
|
||||||
tray: boolean;
|
tray: boolean;
|
||||||
@ -37,10 +32,11 @@ export interface DefaultConfig {
|
|||||||
startingPage: string;
|
startingPage: string;
|
||||||
overrideUserAgent: boolean;
|
overrideUserAgent: boolean;
|
||||||
themes: string[];
|
themes: string[];
|
||||||
}
|
},
|
||||||
|
plugins: Record<string, unknown>,
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultConfig = {
|
const defaultConfig: DefaultConfig = {
|
||||||
'window-size': {
|
'window-size': {
|
||||||
width: 1100,
|
width: 1100,
|
||||||
height: 550,
|
height: 550,
|
||||||
@ -69,229 +65,9 @@ const defaultConfig = {
|
|||||||
proxy: '',
|
proxy: '',
|
||||||
startingPage: '',
|
startingPage: '',
|
||||||
overrideUserAgent: false,
|
overrideUserAgent: false,
|
||||||
themes: [] as string[],
|
themes: [],
|
||||||
},
|
|
||||||
/** please order alphabetically */
|
|
||||||
'plugins': {
|
|
||||||
'adblocker': {
|
|
||||||
enabled: true,
|
|
||||||
cache: true,
|
|
||||||
blocker: blockers.InPlayer as string,
|
|
||||||
additionalBlockLists: [], // Additional list of filters, e.g "https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/filters.txt"
|
|
||||||
disableDefaultLists: false,
|
|
||||||
},
|
|
||||||
'album-color-theme': {},
|
|
||||||
'ambient-mode': {
|
|
||||||
enabled: false,
|
|
||||||
quality: 50,
|
|
||||||
buffer: 30,
|
|
||||||
interpolationTime: 1500,
|
|
||||||
blur: 100,
|
|
||||||
size: 100,
|
|
||||||
opacity: 1,
|
|
||||||
fullscreen: false,
|
|
||||||
},
|
|
||||||
'audio-compressor': {},
|
|
||||||
'blur-nav-bar': {},
|
|
||||||
'bypass-age-restrictions': {},
|
|
||||||
'captions-selector': {
|
|
||||||
enabled: false,
|
|
||||||
disableCaptions: false,
|
|
||||||
autoload: false,
|
|
||||||
lastCaptionsCode: '',
|
|
||||||
},
|
|
||||||
'compact-sidebar': {},
|
|
||||||
'crossfade': {
|
|
||||||
enabled: false,
|
|
||||||
fadeInDuration: 1500, // Ms
|
|
||||||
fadeOutDuration: 5000, // Ms
|
|
||||||
secondsBeforeEnd: 10, // S
|
|
||||||
fadeScaling: 'linear', // 'linear', 'logarithmic' or a positive number in dB
|
|
||||||
},
|
|
||||||
'disable-autoplay': {
|
|
||||||
applyOnce: false,
|
|
||||||
},
|
|
||||||
'discord': {
|
|
||||||
enabled: false,
|
|
||||||
autoReconnect: true, // If enabled, will try to reconnect to discord every 5 seconds after disconnecting or failing to connect
|
|
||||||
activityTimoutEnabled: true, // If enabled, the discord rich presence gets cleared when music paused after the time specified below
|
|
||||||
activityTimoutTime: 10 * 60 * 1000, // 10 minutes
|
|
||||||
playOnYouTubeMusic: true, // Add a "Play on YouTube Music" button to rich presence
|
|
||||||
hideGitHubButton: false, // Disable the "View App On GitHub" button
|
|
||||||
hideDurationLeft: false, // Hides the start and end time of the song to rich presence
|
|
||||||
},
|
|
||||||
'downloader': {
|
|
||||||
enabled: false,
|
|
||||||
downloadFolder: undefined as string | undefined, // Custom download folder (absolute path)
|
|
||||||
selectedPreset: 'mp3 (256kbps)', // Selected preset
|
|
||||||
customPresetSetting: DefaultPresetList['mp3 (256kbps)'], // Presets
|
|
||||||
skipExisting: false,
|
|
||||||
playlistMaxItems: undefined as number | undefined,
|
|
||||||
},
|
|
||||||
'exponential-volume': {},
|
|
||||||
'in-app-menu': {
|
|
||||||
/**
|
|
||||||
* true in Windows, false in Linux and macOS (see youtube-music/config/store.ts)
|
|
||||||
*/
|
|
||||||
enabled: false,
|
|
||||||
hideDOMWindowControls: false,
|
|
||||||
},
|
|
||||||
'last-fm': {
|
|
||||||
enabled: false,
|
|
||||||
token: undefined as string | undefined, // Token used for authentication
|
|
||||||
session_key: undefined as string | undefined, // Session key used for scrobbling
|
|
||||||
api_root: 'http://ws.audioscrobbler.com/2.0/',
|
|
||||||
api_key: '04d76faaac8726e60988e14c105d421a', // Api key registered by @semvis123
|
|
||||||
secret: 'a5d2a36fdf64819290f6982481eaffa2',
|
|
||||||
},
|
|
||||||
'lumiastream': {},
|
|
||||||
'lyrics-genius': {
|
|
||||||
romanizedLyrics: false,
|
|
||||||
},
|
|
||||||
'navigation': {
|
|
||||||
enabled: true,
|
|
||||||
},
|
|
||||||
'no-google-login': {},
|
|
||||||
'notifications': {
|
|
||||||
enabled: false,
|
|
||||||
unpauseNotification: false,
|
|
||||||
urgency: 'normal', // Has effect only on Linux
|
|
||||||
// the following has effect only on Windows
|
|
||||||
interactive: true,
|
|
||||||
toastStyle: 1, // See plugins/notifications/utils for more info
|
|
||||||
refreshOnPlayPause: false,
|
|
||||||
trayControls: true,
|
|
||||||
hideButtonText: false,
|
|
||||||
},
|
|
||||||
'picture-in-picture': {
|
|
||||||
'enabled': false,
|
|
||||||
'alwaysOnTop': true,
|
|
||||||
'savePosition': true,
|
|
||||||
'saveSize': false,
|
|
||||||
'hotkey': 'P',
|
|
||||||
'pip-position': [10, 10],
|
|
||||||
'pip-size': [450, 275],
|
|
||||||
'isInPiP': false,
|
|
||||||
'useNativePiP': true,
|
|
||||||
},
|
|
||||||
'playback-speed': {},
|
|
||||||
'precise-volume': {
|
|
||||||
enabled: false,
|
|
||||||
steps: 1, // Percentage of volume to change
|
|
||||||
arrowsShortcut: true, // Enable ArrowUp + ArrowDown local shortcuts
|
|
||||||
globalShortcuts: {
|
|
||||||
volumeUp: '',
|
|
||||||
volumeDown: '',
|
|
||||||
},
|
|
||||||
savedVolume: undefined as number | undefined, // Plugin save volume between session here
|
|
||||||
},
|
|
||||||
'quality-changer': {},
|
|
||||||
'shortcuts': {
|
|
||||||
enabled: false,
|
|
||||||
overrideMediaKeys: false,
|
|
||||||
global: {
|
|
||||||
previous: '',
|
|
||||||
playPause: '',
|
|
||||||
next: '',
|
|
||||||
} as Record<string, string>,
|
|
||||||
local: {
|
|
||||||
previous: '',
|
|
||||||
playPause: '',
|
|
||||||
next: '',
|
|
||||||
} as Record<string, string>,
|
|
||||||
},
|
|
||||||
'skip-silences': {
|
|
||||||
onlySkipBeginning: false,
|
|
||||||
},
|
|
||||||
'sponsorblock': {
|
|
||||||
enabled: false,
|
|
||||||
apiURL: 'https://sponsor.ajay.app',
|
|
||||||
categories: [
|
|
||||||
'sponsor',
|
|
||||||
'intro',
|
|
||||||
'outro',
|
|
||||||
'interaction',
|
|
||||||
'selfpromo',
|
|
||||||
'music_offtopic',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
'taskbar-mediacontrol': {},
|
|
||||||
'touchbar': {},
|
|
||||||
'tuna-obs': {},
|
|
||||||
'video-toggle': {
|
|
||||||
enabled: false,
|
|
||||||
hideVideo: false,
|
|
||||||
mode: 'custom',
|
|
||||||
forceHide: false,
|
|
||||||
align: '',
|
|
||||||
},
|
|
||||||
'visualizer': {
|
|
||||||
enabled: false,
|
|
||||||
type: 'butterchurn',
|
|
||||||
// Config per visualizer
|
|
||||||
butterchurn: {
|
|
||||||
preset: 'martin [shadow harlequins shape code] - fata morgana',
|
|
||||||
renderingFrequencyInMs: 500,
|
|
||||||
blendTimeInSeconds: 2.7,
|
|
||||||
},
|
|
||||||
vudio: {
|
|
||||||
effect: 'lighting',
|
|
||||||
accuracy: 128,
|
|
||||||
lighting: {
|
|
||||||
maxHeight: 160,
|
|
||||||
maxSize: 12,
|
|
||||||
lineWidth: 1,
|
|
||||||
color: '#49f3f7',
|
|
||||||
shadowBlur: 2,
|
|
||||||
shadowColor: 'rgba(244,244,244,.5)',
|
|
||||||
fadeSide: true,
|
|
||||||
prettify: false,
|
|
||||||
horizontalAlign: 'center',
|
|
||||||
verticalAlign: 'middle',
|
|
||||||
dottify: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
wave: {
|
|
||||||
animations: [
|
|
||||||
{
|
|
||||||
type: 'Cubes',
|
|
||||||
config: {
|
|
||||||
bottom: true,
|
|
||||||
count: 30,
|
|
||||||
cubeHeight: 5,
|
|
||||||
fillColor: { gradient: ['#FAD961', '#F76B1C'] },
|
|
||||||
lineColor: 'rgba(0,0,0,0)',
|
|
||||||
radius: 20,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'Cubes',
|
|
||||||
config: {
|
|
||||||
top: true,
|
|
||||||
count: 12,
|
|
||||||
cubeHeight: 5,
|
|
||||||
fillColor: { gradient: ['#FAD961', '#F76B1C'] },
|
|
||||||
lineColor: 'rgba(0,0,0,0)',
|
|
||||||
radius: 10,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'Circles',
|
|
||||||
config: {
|
|
||||||
lineColor: {
|
|
||||||
gradient: ['#FAD961', '#FAD961', '#F76B1C'],
|
|
||||||
rotate: 90,
|
|
||||||
},
|
|
||||||
lineWidth: 4,
|
|
||||||
diameter: 20,
|
|
||||||
count: 10,
|
|
||||||
frequencyBand: 'base',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
'plugins': {},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default defaultConfig;
|
export default defaultConfig;
|
||||||
|
|||||||
@ -1,21 +1,15 @@
|
|||||||
import Store from 'electron-store';
|
import Store from 'electron-store';
|
||||||
import Conf from 'conf';
|
import Conf from 'conf';
|
||||||
import is from 'electron-is';
|
|
||||||
|
import { pluginBuilders } from 'virtual:PluginBuilders';
|
||||||
|
|
||||||
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 getDefaults = () => {
|
const setDefaultPluginOptions = (store: Conf<Record<string, unknown>>, plugin: keyof typeof pluginBuilders) => {
|
||||||
if (is.windows()) {
|
|
||||||
defaults.plugins['in-app-menu'].enabled = true;
|
|
||||||
}
|
|
||||||
return defaults;
|
|
||||||
};
|
|
||||||
|
|
||||||
const setDefaultPluginOptions = (store: Conf<Record<string, unknown>>, plugin: keyof typeof defaults.plugins) => {
|
|
||||||
if (!store.get(`plugins.${plugin}`)) {
|
if (!store.get(`plugins.${plugin}`)) {
|
||||||
store.set(`plugins.${plugin}`, defaults.plugins[plugin]);
|
store.set(`plugins.${plugin}`, pluginBuilders[plugin].config);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -53,7 +47,7 @@ const migrations = {
|
|||||||
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', {
|
||||||
...defaults.plugins.notifications,
|
...pluginBuilders.notifications.config,
|
||||||
...pluginOptions,
|
...pluginOptions,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -155,7 +149,15 @@ const migrations = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default new Store({
|
export default new Store({
|
||||||
defaults: getDefaults(),
|
defaults: {
|
||||||
|
...defaults,
|
||||||
|
plugins: Object
|
||||||
|
.entries(pluginBuilders)
|
||||||
|
.reduce((prev, [id, builder]) => ({
|
||||||
|
...prev,
|
||||||
|
[id]: (builder as PluginBuilderList[keyof PluginBuilderList]).config,
|
||||||
|
}), {}),
|
||||||
|
},
|
||||||
clearInvalidConfig: false,
|
clearInvalidConfig: false,
|
||||||
migrations,
|
migrations,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,16 +1,17 @@
|
|||||||
import is from 'electron-is';
|
import is from 'electron-is';
|
||||||
|
|
||||||
import defaultConfig from '../../../config/defaults';
|
import { pluginBuilders } from 'virtual:PluginBuilders';
|
||||||
|
|
||||||
export const getAvailablePluginNames = () => {
|
export const getAvailablePluginNames = () => {
|
||||||
return Object.keys(defaultConfig.plugins).filter((name) => {
|
return Object.keys(pluginBuilders)
|
||||||
if (is.windows() && name === 'touchbar') {
|
.filter((id) => {
|
||||||
return false;
|
if (is.windows() && id === 'touchbar') {
|
||||||
} else if (is.macOS() && name === 'taskbar-mediacontrol') {
|
return false;
|
||||||
return false;
|
} else if (is.macOS() && id === 'taskbar-mediacontrol') {
|
||||||
} else if (is.linux() && (name === 'taskbar-mediacontrol' || name === 'touchbar')) {
|
return false;
|
||||||
return false;
|
} else if (is.linux() && (id === 'taskbar-mediacontrol' || id === 'touchbar')) {
|
||||||
}
|
return false;
|
||||||
return true;
|
}
|
||||||
});
|
return true;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user