mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-17 13:48:02 +00:00
feat: updates
This commit is contained in:
parent
9a52681687
commit
840a5b8e9b
104 changed files with 1645 additions and 13494 deletions
|
|
@ -5,12 +5,14 @@ interface PersistedUiStates {
|
|||
loginPhoneCountryCode: string
|
||||
loginType: 'phone' | 'email' | 'qrCode'
|
||||
minimizePlayer: boolean
|
||||
librarySelectedTab: 'playlists' | 'albums' | 'artists' | 'videos'
|
||||
}
|
||||
|
||||
const initPersistedUiStates: PersistedUiStates = {
|
||||
loginPhoneCountryCode: '+86',
|
||||
loginType: 'qrCode',
|
||||
minimizePlayer: false,
|
||||
librarySelectedTab: 'albums',
|
||||
}
|
||||
|
||||
const STORAGE_KEY = 'persistedUiStates'
|
||||
|
|
@ -24,9 +26,7 @@ if (statesInStorage) {
|
|||
}
|
||||
}
|
||||
|
||||
const persistedUiStates = proxy<PersistedUiStates>(
|
||||
merge(initPersistedUiStates, sates)
|
||||
)
|
||||
const persistedUiStates = proxy<PersistedUiStates>(merge(initPersistedUiStates, sates))
|
||||
|
||||
subscribe(persistedUiStates, () => {
|
||||
localStorage.setItem(STORAGE_KEY, JSON.stringify(persistedUiStates))
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ interface UIStates {
|
|||
showLyricPanel: boolean
|
||||
showLoginPanel: boolean
|
||||
hideTopbarBackground: boolean
|
||||
librarySelectedTab: 'playlists' | 'albums' | 'artists' | 'videos'
|
||||
mobileShowPlayingNext: boolean
|
||||
blurBackgroundImage: string | null
|
||||
fullscreen: boolean
|
||||
|
|
@ -17,7 +16,6 @@ const initUIStates: UIStates = {
|
|||
showLyricPanel: false,
|
||||
showLoginPanel: false,
|
||||
hideTopbarBackground: false,
|
||||
librarySelectedTab: 'playlists',
|
||||
mobileShowPlayingNext: false,
|
||||
blurBackgroundImage: null,
|
||||
fullscreen: false,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue