mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-17 21:58:03 +00:00
feat: updates
This commit is contained in:
parent
9a52681687
commit
840a5b8e9b
104 changed files with 1645 additions and 13494 deletions
|
|
@ -1,41 +1,33 @@
|
|||
import { IpcChannels } from '@/shared/IpcChannels'
|
||||
import { merge } from 'lodash-es'
|
||||
import { proxy, subscribe } from 'valtio'
|
||||
import i18n, { getLanguage, supportedLanguages } from '../i18n/i18n'
|
||||
import i18n, { getInitLanguage, SupportedLanguage, supportedLanguages } from '../i18n/i18n'
|
||||
|
||||
interface Settings {
|
||||
accentColor: string
|
||||
language: typeof supportedLanguages[number]
|
||||
unm: {
|
||||
enabled: boolean
|
||||
sources: Array<
|
||||
'migu' | 'kuwo' | 'kugou' | 'ytdl' | 'qq' | 'bilibili' | 'joox'
|
||||
>
|
||||
searchMode: 'order-first' | 'fast-first'
|
||||
proxy: null | {
|
||||
protocol: 'http' | 'https' | 'socks5'
|
||||
host: string
|
||||
port: number
|
||||
username?: string
|
||||
password?: string
|
||||
}
|
||||
cookies: {
|
||||
qq?: string
|
||||
joox?: string
|
||||
language: SupportedLanguage
|
||||
enableFindTrackOnYouTube: boolean
|
||||
httpProxyForYouTube?: {
|
||||
host: string
|
||||
port: number
|
||||
protocol: 'http' | 'https'
|
||||
auth?: {
|
||||
username: string
|
||||
password: string
|
||||
}
|
||||
}
|
||||
playAnimatedArtworkFromApple: boolean
|
||||
priorityDisplayOfAlbumArtistDescriptionFromAppleMusic: boolean
|
||||
displayPlaylistsFromNeteaseMusic: boolean
|
||||
}
|
||||
|
||||
const initSettings: Settings = {
|
||||
accentColor: 'blue',
|
||||
language: getLanguage(),
|
||||
unm: {
|
||||
enabled: true,
|
||||
sources: ['migu'],
|
||||
searchMode: 'order-first',
|
||||
proxy: null,
|
||||
cookies: {},
|
||||
},
|
||||
accentColor: 'green',
|
||||
language: getInitLanguage(),
|
||||
enableFindTrackOnYouTube: false,
|
||||
playAnimatedArtworkFromApple: true,
|
||||
priorityDisplayOfAlbumArtistDescriptionFromAppleMusic: true,
|
||||
displayPlaylistsFromNeteaseMusic: true,
|
||||
}
|
||||
|
||||
const STORAGE_KEY = 'settings'
|
||||
|
|
@ -50,15 +42,11 @@ try {
|
|||
const settings = proxy<Settings>(merge(initSettings, statesInStorage))
|
||||
|
||||
subscribe(settings, () => {
|
||||
if (
|
||||
settings.language !== i18n.language &&
|
||||
supportedLanguages.includes(settings.language)
|
||||
) {
|
||||
if (settings.language !== i18n.language && supportedLanguages.includes(settings.language)) {
|
||||
i18n.changeLanguage(settings.language)
|
||||
}
|
||||
|
||||
window.ipcRenderer?.send(IpcChannels.SyncSettings, settings)
|
||||
localStorage.setItem(STORAGE_KEY, JSON.stringify(settings))
|
||||
window.ipcRenderer?.send(IpcChannels.SyncSettings, JSON.parse(JSON.stringify(settings)))
|
||||
})
|
||||
|
||||
export default settings
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue