更新依赖&版本号(2.6.0-beta.5)

This commit is contained in:
lyswhut
2023-12-12 14:00:22 +08:00
parent e9539b5c5c
commit 050b641d79
21 changed files with 335 additions and 334 deletions
+1 -1
View File
@@ -62,7 +62,7 @@ export const getList = async(source: Source): Promise<string[]> => {
return setLists(results)
})
} else {
if (sourceList[source]?.length) return Promise.resolve(sourceList[source] as string[])
if (sourceList[source]?.length) return Promise.resolve(sourceList[source]!)
if (!music[source]?.hotSearch) {
setList(source, [])
return Promise.resolve([])
+1 -1
View File
@@ -193,7 +193,7 @@ export const userListsUpdatePosition = (position: number, ids: string[]) => {
const map = new Map<string, LX.List.UserListInfo>()
for (const item of newUserLists) map.set(item.id, item)
for (const id of ids) {
const listInfo = map.get(id) as LX.List.UserListInfo
const listInfo = map.get(id)!
listInfo.locationUpdateTime = Date.now()
updateLists.push(listInfo)
map.delete(id)
@@ -68,7 +68,7 @@ export const updateUserListPosition = async(data: LX.List.ListActionUpdatePositi
*/
export const getListMusics = async(listId: string | null): Promise<LX.Music.MusicInfo[]> => {
if (!listId) return []
if (allMusicList.has(listId)) return allMusicList.get(listId) as LX.Music.MusicInfo[]
if (allMusicList.has(listId)) return allMusicList.get(listId)!
const list = await rendererInvoke<string, LX.Music.MusicInfo[]>(PLAYER_EVENT_NAME.list_music_get, listId)
return setMusicList(listId, list)
}
+3 -3
View File
@@ -3,7 +3,7 @@ import music from '@renderer/utils/musicSdk'
import { deduplicationList, toNewMusicInfo } from '@renderer/utils'
import { sortInsert, similar } from '@common/utils/common'
import { sources, maxPages, listInfos, type ListInfo } from './state'
import { sources, maxPages, listInfos } from './state'
interface SearchResult {
list: LX.Music.MusicInfo[]
@@ -61,7 +61,7 @@ const setLists = (results: SearchResult[], page: number, text: string): LX.Music
const setList = (datas: SearchResult, page: number, text: string): LX.Music.MusicInfo[] => {
// console.log(datas.source, datas.list)
let listInfo = listInfos[datas.source] as ListInfo
let listInfo = listInfos[datas.source]!
listInfo.list = deduplicationList(datas.list.map(s => markRaw(toNewMusicInfo(s))))
if (page == 1 || (datas.total && datas.list.length)) listInfo.total = datas.total
else listInfo.total = datas.limit * page
@@ -74,7 +74,7 @@ const setList = (datas: SearchResult, page: number, text: string): LX.Music.Musi
}
export const resetListInfo = (sourceId: LX.OnlineSource | 'all'): [] => {
let listInfo = listInfos[sourceId] as ListInfo
let listInfo = listInfos[sourceId]!
listInfo.list = []
listInfo.page = 0
listInfo.maxPage = 0
+5 -5
View File
@@ -2,7 +2,7 @@ import { markRawList } from '@common/utils/vueTools'
import music from '@renderer/utils/musicSdk'
import { sortInsert, similar } from '@common/utils/common'
import type { ListInfoItem, SearchListInfo } from './state'
import type { ListInfoItem } from './state'
import { sources, maxPages, listInfos } from './state'
interface SearchResult {
@@ -60,7 +60,7 @@ const setLists = (results: SearchResult[], page: number, text: string): ListInfo
const setList = (datas: SearchResult, page: number, text: string): ListInfoItem[] => {
// console.log(datas.source, datas.list)
let listInfo = listInfos[datas.source] as SearchListInfo
let listInfo = listInfos[datas.source]!
listInfo.list = markRawList(datas.list)
if (page == 1 || (datas.total && datas.list.length)) listInfo.total = datas.total
else listInfo.total = datas.limit * page
@@ -72,7 +72,7 @@ const setList = (datas: SearchResult, page: number, text: string): ListInfoItem[
}
export const resetListInfo = (sourceId: LX.OnlineSource | 'all'): [] => {
let listInfo = listInfos[sourceId] as SearchListInfo
let listInfo = listInfos[sourceId]!
listInfo.page = 1
listInfo.limit = 20
listInfo.total = 0
@@ -85,7 +85,7 @@ export const resetListInfo = (sourceId: LX.OnlineSource | 'all'): [] => {
}
export const search = async(text: string, page: number, sourceId: LX.OnlineSource | 'all'): Promise<ListInfoItem[]> => {
const listInfo = listInfos[sourceId] as SearchListInfo
const listInfo = listInfos[sourceId]!
if (!text) return resetListInfo(sourceId)
const key = `${page}__${sourceId}__${text}`
if (listInfo.key == key && listInfo.list.length) return listInfo.list
@@ -94,7 +94,7 @@ export const search = async(text: string, page: number, sourceId: LX.OnlineSourc
listInfo.key = key
let task = []
for (const source of sources) {
if (source == 'all' || (page > 1 && page > (maxPages[source] as number))) continue
if (source == 'all' || (page > 1 && page > (maxPages[source]!))) continue
task.push((music[source]?.songList.search(text, page, listInfos.all.limit) ?? Promise.reject(new Error('source not found: ' + source))).catch((error: any) => {
console.log(error)
return {
+1 -1
View File
@@ -75,7 +75,7 @@ export const applyTheme = (id: string, lightId: string, darkId: string, dataPath
let theme = findTheme(themeInfo, themeId)
if (!theme) {
themeId = id == 'auto' && themeShouldUseDarkColors.value ? 'black' : 'green'
theme = themeInfo.themes.find(theme => theme.id == themeId) as LX.Theme
theme = themeInfo.themes.find(theme => theme.id == themeId)!
}
window.setTheme(buildThemeColors(theme, dataPath))
})