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

pull/1761/head
lyswhut 2023-12-12 14:00:22 +08:00
parent e9539b5c5c
commit 050b641d79
21 changed files with 335 additions and 334 deletions

View File

@ -42,6 +42,7 @@ const typescriptRule = {
'@typescript-eslint/return-await': 'off', '@typescript-eslint/return-await': 'off',
'@typescript-eslint/ban-ts-comment': 'off', '@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/comma-dangle': 'off', '@typescript-eslint/comma-dangle': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
} }
const vueRule = { const vueRule = {
...typescriptRule, ...typescriptRule,

578
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "lx-music-desktop", "name": "lx-music-desktop",
"version": "2.6.0-beta.4", "version": "2.6.0-beta.5",
"description": "一个免费的音乐查找助手", "description": "一个免费的音乐查找助手",
"main": "./dist/main.js", "main": "./dist/main.js",
"productName": "lx-music-desktop", "productName": "lx-music-desktop",
@ -108,13 +108,13 @@
}, },
"homepage": "https://github.com/lyswhut/lx-music-desktop#readme", "homepage": "https://github.com/lyswhut/lx-music-desktop#readme",
"devDependencies": { "devDependencies": {
"@babel/core": "^7.23.5", "@babel/core": "^7.23.6",
"@babel/eslint-parser": "^7.23.3", "@babel/eslint-parser": "^7.23.3",
"@babel/plugin-proposal-class-properties": "^7.18.6", "@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-transform-modules-umd": "^7.23.3", "@babel/plugin-transform-modules-umd": "^7.23.3",
"@babel/plugin-transform-runtime": "^7.23.4", "@babel/plugin-transform-runtime": "^7.23.6",
"@babel/preset-env": "^7.23.5", "@babel/preset-env": "^7.23.6",
"@babel/preset-typescript": "^7.23.3", "@babel/preset-typescript": "^7.23.3",
"@tsconfig/recommended": "^1.0.3", "@tsconfig/recommended": "^1.0.3",
"@types/better-sqlite3": "^7.6.8", "@types/better-sqlite3": "^7.6.8",
@ -134,14 +134,14 @@
"css-minimizer-webpack-plugin": "^5.0.1", "css-minimizer-webpack-plugin": "^5.0.1",
"del": "^6.1.1", "del": "^6.1.1",
"electron": "^25.9.8", "electron": "^25.9.8",
"electron-builder": "^24.9.3", "electron-builder": "^24.9.4",
"electron-debug": "^3.2.0", "electron-debug": "^3.2.0",
"electron-devtools-installer": "^3.2.0", "electron-devtools-installer": "^3.2.0",
"electron-to-chromium": "^1.4.608", "electron-to-chromium": "^1.4.610",
"electron-updater": "^6.1.7", "electron-updater": "^6.1.7",
"eslint": "^8.55.0", "eslint": "^8.55.0",
"eslint-config-standard": "^17.1.0", "eslint-config-standard": "^17.1.0",
"eslint-config-standard-with-typescript": "^40.0.0", "eslint-config-standard-with-typescript": "^42.0.0",
"eslint-formatter-friendly": "github:lyswhut/eslint-friendly-formatter#2170d1320e2fad13615a9dcf229669f0bb473a53", "eslint-formatter-friendly": "github:lyswhut/eslint-friendly-formatter#2170d1320e2fad13615a9dcf229669f0bb473a53",
"eslint-plugin-html": "^7.1.0", "eslint-plugin-html": "^7.1.0",
"eslint-plugin-vue": "^9.19.2", "eslint-plugin-vue": "^9.19.2",
@ -194,9 +194,9 @@
"sortablejs": "^1.15.1", "sortablejs": "^1.15.1",
"tunnel": "^0.0.6", "tunnel": "^0.0.6",
"utf-8-validate": "^6.0.3", "utf-8-validate": "^6.0.3",
"vue": "^3.3.10", "vue": "^3.3.11",
"vue-router": "^4.2.5", "vue-router": "^4.2.5",
"ws": "^8.14.2" "ws": "^8.15.0"
}, },
"overrides": { "overrides": {
"got": "^11", "got": "^11",

View File

@ -27,7 +27,7 @@ const sendRequest = (url: string, options: Options, callback?: HttpCallback) =>
} }
if (options.params) { if (options.params) {
(httpOptions.path as string) += `${urlParse.search ? '&' : '?'}${Object.entries(options.params) (httpOptions.path!) += `${urlParse.search ? '&' : '?'}${Object.entries(options.params)
.map(([key, value]) => `${key}=${encodeURIComponent(value)}`) .map(([key, value]) => `${key}=${encodeURIComponent(value)}`)
.join('&')}` .join('&')}`
} }

View File

@ -117,7 +117,7 @@ const verifyConnection = (encryptMsg: string, userId: string) => {
export const authConnect = async(req: http.IncomingMessage) => { export const authConnect = async(req: http.IncomingMessage) => {
let ip = getAvailableIP(req) let ip = getAvailableIP(req)
if (ip) { if (ip) {
const query = querystring.parse((req.url as string).split('?')[1]) const query = querystring.parse((req.url!).split('?')[1])
const i = query.i const i = query.i
const t = query.t const t = query.t
if (typeof i == 'string' && typeof t == 'string' && verifyConnection(t, i)) return if (typeof i == 'string' && typeof t == 'string' && verifyConnection(t, i)) return

View File

@ -56,7 +56,7 @@ const checkDuplicateClient = (newSocket: LX.Sync.Server.Socket) => {
} }
const handleConnection = async(socket: LX.Sync.Server.Socket, request: IncomingMessage) => { const handleConnection = async(socket: LX.Sync.Server.Socket, request: IncomingMessage) => {
const queryData = new URL(request.url as string, host).searchParams const queryData = new URL(request.url!, host).searchParams
const clientId = queryData.get('i') const clientId = queryData.get('i')
// // if (typeof socket.handshake.query.i != 'string') return socket.disconnect(true) // // if (typeof socket.handshake.query.i != 'string') return socket.disconnect(true)
@ -232,7 +232,7 @@ const handleStartServer = async(port = 9527, ip = '0.0.0.0') => await new Promis
// events = {} // events = {}
if (!status.devices.length) handleUnconnection() if (!status.devices.length) handleUnconnection()
} else { } else {
const queryData = new URL(request.url as string, host).searchParams const queryData = new URL(request.url!, host).searchParams
log.info('deconnection', queryData.get('i')) log.info('deconnection', queryData.get('i'))
} }
}) })
@ -301,7 +301,7 @@ const handleStartServer = async(port = 9527, ip = '0.0.0.0') => await new Promis
const bind = typeof addr == 'string' ? `pipe ${addr}` : `port ${addr.port}` const bind = typeof addr == 'string' ? `pipe ${addr}` : `port ${addr.port}`
log.info(`Listening on ${ip} ${bind}`) log.info(`Listening on ${ip} ${bind}`)
resolve(null) resolve(null)
void registerLocalSyncEvent(wss as LX.Sync.Server.SocketServer) void registerLocalSyncEvent(wss!)
}) })
host = `http://${ip}:${port}` host = `http://${ip}:${port}`

View File

@ -178,8 +178,8 @@ export const initHotKey = async() => {
} }
return { return {
local: localConfig as LX.HotKeyConfig, local: localConfig!,
global: globalConfig as LX.HotKeyConfig, global: globalConfig!,
} }
} }

View File

@ -30,7 +30,7 @@ const migrateV1 = (db: Database.Database) => {
// 修复 v2.4.0 的默认数据库版本号不对的问题 // 修复 v2.4.0 的默认数据库版本号不对的问题
const existsTable = db.prepare('SELECT name FROM "main".sqlite_master WHERE type=\'table\' AND name=\'dislike_list\';').get() const existsTable = db.prepare('SELECT name FROM "main".sqlite_master WHERE type=\'table\' AND name=\'dislike_list\';').get()
if (!existsTable) { if (!existsTable) {
const sql = tables.get('dislike_list') as string const sql = tables.get('dislike_list')!
db.exec(sql) db.exec(sql)
} }
} }

View File

@ -322,7 +322,7 @@ export const musicsPositionUpdate = (listId: string, position: number, ids: stri
const map = new Map<string, LX.Music.MusicInfo>() const map = new Map<string, LX.Music.MusicInfo>()
for (const item of newTargetList) map.set(item.id, item) for (const item of newTargetList) map.set(item.id, item)
for (const id of ids) { for (const id of ids) {
infos.push(map.get(id) as LX.Music.MusicInfo) infos.push(map.get(id)!)
map.delete(id) map.delete(id)
} }
newTargetList = newTargetList.filter(mInfo => map.has(mInfo.id)) newTargetList = newTargetList.filter(mInfo => map.has(mInfo.id))

View File

@ -169,7 +169,7 @@ export const getOnlineOtherSourceMusicUrl = async({ musicInfos, quality, onToggl
let musicInfo: LX.Music.MusicInfoOnline | null = null let musicInfo: LX.Music.MusicInfoOnline | null = null
let itemQuality: LX.Quality | null = null let itemQuality: LX.Quality | null = null
// eslint-disable-next-line no-cond-assign // eslint-disable-next-line no-cond-assign
while (musicInfo = (musicInfos.shift() as LX.Music.MusicInfoOnline)) { while (musicInfo = (musicInfos.shift()!)) {
if (retryedSource.includes(musicInfo.source)) continue if (retryedSource.includes(musicInfo.source)) continue
retryedSource.push(musicInfo.source) retryedSource.push(musicInfo.source)
if (!assertApiSupport(musicInfo.source)) continue if (!assertApiSupport(musicInfo.source)) continue
@ -263,7 +263,7 @@ export const getOnlineOtherSourcePicUrl = async({ musicInfos, onToggleSource, is
}> => { }> => {
let musicInfo: LX.Music.MusicInfoOnline | null = null let musicInfo: LX.Music.MusicInfoOnline | null = null
// eslint-disable-next-line no-cond-assign // eslint-disable-next-line no-cond-assign
while (musicInfo = (musicInfos.shift() as LX.Music.MusicInfoOnline)) { while (musicInfo = (musicInfos.shift()!)) {
if (retryedSource.includes(musicInfo.source)) continue if (retryedSource.includes(musicInfo.source)) continue
retryedSource.push(musicInfo.source) retryedSource.push(musicInfo.source)
// if (!assertApiSupport(musicInfo.source)) continue // if (!assertApiSupport(musicInfo.source)) continue
@ -346,7 +346,7 @@ export const getOnlineOtherSourceLyricInfo = async({ musicInfos, onToggleSource,
}> => { }> => {
let musicInfo: LX.Music.MusicInfoOnline | null = null let musicInfo: LX.Music.MusicInfoOnline | null = null
// eslint-disable-next-line no-cond-assign // eslint-disable-next-line no-cond-assign
while (musicInfo = (musicInfos.shift() as LX.Music.MusicInfoOnline)) { while (musicInfo = (musicInfos.shift()!)) {
if (retryedSource.includes(musicInfo.source)) continue if (retryedSource.includes(musicInfo.source)) continue
retryedSource.push(musicInfo.source) retryedSource.push(musicInfo.source)
// if (!assertApiSupport(musicInfo.source)) continue // if (!assertApiSupport(musicInfo.source)) continue

View File

@ -4,7 +4,7 @@ import syncSourceList from '@renderer/store/list/syncSourceList'
const handleSyncSourceList = async(waitUpdateLists: LX.List.UserListInfo[]) => { const handleSyncSourceList = async(waitUpdateLists: LX.List.UserListInfo[]) => {
if (!waitUpdateLists.length) return if (!waitUpdateLists.length) return
const targetListInfo = waitUpdateLists.shift() as LX.List.UserListInfo const targetListInfo = waitUpdateLists.shift()!
// console.log(targetListInfo) // console.log(targetListInfo)
try { try {
await syncSourceList(targetListInfo) await syncSourceList(targetListInfo)

View File

@ -20,7 +20,7 @@ const loadBuffer = async(name: string) => new Promise<AudioBuffer>((resolve, rej
// eslint-disable-next-line @typescript-eslint/no-var-requires // eslint-disable-next-line @typescript-eslint/no-var-requires
const path = require('@renderer/assets/medias/filters/' + name) as string const path = require('@renderer/assets/medias/filters/' + name) as string
if (cache.has(path)) { if (cache.has(path)) {
resolve(cache.get(path) as AudioBuffer) resolve(cache.get(path)!)
return return
} }
// Load buffer asynchronously // Load buffer asynchronously

View File

@ -82,7 +82,7 @@ const initBiquadFilter = () => {
} }
for (i = 1; i < freqs.length; i++) { for (i = 1; i < freqs.length; i++) {
(biquads.get(`hz${freqs[i - 1]}`) as BiquadFilterNode).connect(biquads.get(`hz${freqs[i]}`) as BiquadFilterNode) (biquads.get(`hz${freqs[i - 1]}`)!).connect(biquads.get(`hz${freqs[i]}`)!)
} }
} }
@ -117,8 +117,8 @@ const initAdvancedAudioFeatures = () => {
// source -> analyser -> biquadFilter -> [(convolver & convolverSource)->convolverDynamicsCompressor] -> panner -> gain // source -> analyser -> biquadFilter -> [(convolver & convolverSource)->convolverDynamicsCompressor] -> panner -> gain
mediaSource = audioContext.createMediaElementSource(audio) mediaSource = audioContext.createMediaElementSource(audio)
mediaSource.connect(analyser) mediaSource.connect(analyser)
analyser.connect(biquads.get(`hz${freqs[0]}`) as BiquadFilterNode) analyser.connect(biquads.get(`hz${freqs[0]}`)!)
const lastBiquadFilter = (biquads.get(`hz${freqs.at(-1) as Freqs}`) as BiquadFilterNode) const lastBiquadFilter = (biquads.get(`hz${freqs.at(-1)!}`)!)
lastBiquadFilter.connect(convolverSourceGainNode) lastBiquadFilter.connect(convolverSourceGainNode)
lastBiquadFilter.connect(convolver) lastBiquadFilter.connect(convolver)
convolverDynamicsCompressor.connect(panner) convolverDynamicsCompressor.connect(panner)
@ -223,7 +223,7 @@ let isConnected = true
const connectNode = () => { const connectNode = () => {
if (isConnected) return if (isConnected) return
console.log('connect Node') console.log('connect Node')
analyser?.connect(biquads.get(`hz${freqs[0]}`) as BiquadFilterNode) analyser?.connect(biquads.get(`hz${freqs[0]}`)!)
isConnected = true isConnected = true
if (pitchShifterNodeTempValue == 1 && pitchShifterNodeLoadStatus == 'connected') { if (pitchShifterNodeTempValue == 1 && pitchShifterNodeLoadStatus == 'connected') {
disconnectPitchShifterNode() disconnectPitchShifterNode()
@ -246,7 +246,7 @@ const connectPitchShifterNode = () => {
audio!.addEventListener('emptied', disconnectNode) audio!.addEventListener('emptied', disconnectNode)
if (audio!.paused) disconnectNode() if (audio!.paused) disconnectNode()
const lastBiquadFilter = (biquads.get(`hz${freqs.at(-1) as Freqs}`) as BiquadFilterNode) const lastBiquadFilter = (biquads.get(`hz${freqs.at(-1)!}`)!)
lastBiquadFilter.disconnect() lastBiquadFilter.disconnect()
lastBiquadFilter.connect(pitchShifterNode) lastBiquadFilter.connect(pitchShifterNode)
@ -260,7 +260,7 @@ const connectPitchShifterNode = () => {
} }
const disconnectPitchShifterNode = () => { const disconnectPitchShifterNode = () => {
console.log('disconnect Pitch Shifter Node') console.log('disconnect Pitch Shifter Node')
const lastBiquadFilter = (biquads.get(`hz${freqs.at(-1) as Freqs}`) as BiquadFilterNode) const lastBiquadFilter = (biquads.get(`hz${freqs.at(-1)!}`)!)
lastBiquadFilter.disconnect() lastBiquadFilter.disconnect()
lastBiquadFilter.connect(convolver) lastBiquadFilter.connect(convolver)
lastBiquadFilter.connect(convolverSourceGainNode) lastBiquadFilter.connect(convolverSourceGainNode)

View File

@ -62,7 +62,7 @@ export const getList = async(source: Source): Promise<string[]> => {
return setLists(results) return setLists(results)
}) })
} else { } 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) { if (!music[source]?.hotSearch) {
setList(source, []) setList(source, [])
return Promise.resolve([]) return Promise.resolve([])

View File

@ -193,7 +193,7 @@ export const userListsUpdatePosition = (position: number, ids: string[]) => {
const map = new Map<string, LX.List.UserListInfo>() const map = new Map<string, LX.List.UserListInfo>()
for (const item of newUserLists) map.set(item.id, item) for (const item of newUserLists) map.set(item.id, item)
for (const id of ids) { for (const id of ids) {
const listInfo = map.get(id) as LX.List.UserListInfo const listInfo = map.get(id)!
listInfo.locationUpdateTime = Date.now() listInfo.locationUpdateTime = Date.now()
updateLists.push(listInfo) updateLists.push(listInfo)
map.delete(id) map.delete(id)

View File

@ -68,7 +68,7 @@ export const updateUserListPosition = async(data: LX.List.ListActionUpdatePositi
*/ */
export const getListMusics = async(listId: string | null): Promise<LX.Music.MusicInfo[]> => { export const getListMusics = async(listId: string | null): Promise<LX.Music.MusicInfo[]> => {
if (!listId) return [] 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) const list = await rendererInvoke<string, LX.Music.MusicInfo[]>(PLAYER_EVENT_NAME.list_music_get, listId)
return setMusicList(listId, list) return setMusicList(listId, list)
} }

View File

@ -3,7 +3,7 @@ import music from '@renderer/utils/musicSdk'
import { deduplicationList, toNewMusicInfo } from '@renderer/utils' import { deduplicationList, toNewMusicInfo } from '@renderer/utils'
import { sortInsert, similar } from '@common/utils/common' import { sortInsert, similar } from '@common/utils/common'
import { sources, maxPages, listInfos, type ListInfo } from './state' import { sources, maxPages, listInfos } from './state'
interface SearchResult { interface SearchResult {
list: LX.Music.MusicInfo[] 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[] => { const setList = (datas: SearchResult, page: number, text: string): LX.Music.MusicInfo[] => {
// console.log(datas.source, datas.list) // 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)))) listInfo.list = deduplicationList(datas.list.map(s => markRaw(toNewMusicInfo(s))))
if (page == 1 || (datas.total && datas.list.length)) listInfo.total = datas.total if (page == 1 || (datas.total && datas.list.length)) listInfo.total = datas.total
else listInfo.total = datas.limit * page 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'): [] => { export const resetListInfo = (sourceId: LX.OnlineSource | 'all'): [] => {
let listInfo = listInfos[sourceId] as ListInfo let listInfo = listInfos[sourceId]!
listInfo.list = [] listInfo.list = []
listInfo.page = 0 listInfo.page = 0
listInfo.maxPage = 0 listInfo.maxPage = 0

View File

@ -2,7 +2,7 @@ import { markRawList } from '@common/utils/vueTools'
import music from '@renderer/utils/musicSdk' import music from '@renderer/utils/musicSdk'
import { sortInsert, similar } from '@common/utils/common' import { sortInsert, similar } from '@common/utils/common'
import type { ListInfoItem, SearchListInfo } from './state' import type { ListInfoItem } from './state'
import { sources, maxPages, listInfos } from './state' import { sources, maxPages, listInfos } from './state'
interface SearchResult { interface SearchResult {
@ -60,7 +60,7 @@ const setLists = (results: SearchResult[], page: number, text: string): ListInfo
const setList = (datas: SearchResult, page: number, text: string): ListInfoItem[] => { const setList = (datas: SearchResult, page: number, text: string): ListInfoItem[] => {
// console.log(datas.source, datas.list) // console.log(datas.source, datas.list)
let listInfo = listInfos[datas.source] as SearchListInfo let listInfo = listInfos[datas.source]!
listInfo.list = markRawList(datas.list) listInfo.list = markRawList(datas.list)
if (page == 1 || (datas.total && datas.list.length)) listInfo.total = datas.total if (page == 1 || (datas.total && datas.list.length)) listInfo.total = datas.total
else listInfo.total = datas.limit * page 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'): [] => { export const resetListInfo = (sourceId: LX.OnlineSource | 'all'): [] => {
let listInfo = listInfos[sourceId] as SearchListInfo let listInfo = listInfos[sourceId]!
listInfo.page = 1 listInfo.page = 1
listInfo.limit = 20 listInfo.limit = 20
listInfo.total = 0 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[]> => { 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) if (!text) return resetListInfo(sourceId)
const key = `${page}__${sourceId}__${text}` const key = `${page}__${sourceId}__${text}`
if (listInfo.key == key && listInfo.list.length) return listInfo.list 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 listInfo.key = key
let task = [] let task = []
for (const source of sources) { 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) => { 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) console.log(error)
return { return {

View File

@ -75,7 +75,7 @@ export const applyTheme = (id: string, lightId: string, darkId: string, dataPath
let theme = findTheme(themeInfo, themeId) let theme = findTheme(themeInfo, themeId)
if (!theme) { if (!theme) {
themeId = id == 'auto' && themeShouldUseDarkColors.value ? 'black' : 'green' 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)) window.setTheme(buildThemeColors(theme, dataPath))
}) })

View File

@ -23,7 +23,7 @@ export default ({ dom_lists_list }: {
const handleSaveListName = async() => { const handleSaveListName = async() => {
let dom_target = dom_lists_list.value?.querySelector('.' + styles.editing) as HTMLElement let dom_target = dom_lists_list.value?.querySelector('.' + styles.editing) as HTMLElement
if (!dom_target) return if (!dom_target) return
const dom_input = dom_target.querySelector('.' + styles.listsInput) as HTMLInputElement const dom_input = dom_target.querySelector('.' + styles.listsInput)!
if (!dom_input) return if (!dom_input) return
let name = dom_input.value.trim() let name = dom_input.value.trim()
if (dom_target.dataset.index == null) return if (dom_target.dataset.index == null) return

View File

@ -112,7 +112,7 @@ const getIntv = (musicInfo: LX.Music.MusicInfo) => {
let intv = 0 let intv = 0
let unit = 1 let unit = 1
while (intvArr.length) { while (intvArr.length) {
intv += parseInt(intvArr.pop() as string) * unit intv += parseInt(intvArr.pop()!) * unit
unit *= 60 unit *= 60
} }
return intv return intv
@ -237,7 +237,7 @@ export const filterDuplicateMusic = async(list: LX.Music.MusicInfo[], isFilterVa
// console.log(duplicateList) // console.log(duplicateList)
const duplicateNames = Array.from(duplicateList) const duplicateNames = Array.from(duplicateList)
duplicateNames.sort((a, b) => a.localeCompare(b)) duplicateNames.sort((a, b) => a.localeCompare(b))
return duplicateNames.map(name => listMap.get(name) as ListMapValue).flat() return duplicateNames.map(name => listMap.get(name)!).flat()
} }
export const searchListMusic = (list: LX.Music.MusicInfo[], text: string) => { export const searchListMusic = (list: LX.Music.MusicInfo[], text: string) => {
@ -271,7 +271,7 @@ export const createSortedList = (list: LX.Music.MusicInfo[], position: number, i
const map = new Map<string, LX.Music.MusicInfo>() const map = new Map<string, LX.Music.MusicInfo>()
for (const item of list) map.set(item.id, item) for (const item of list) map.set(item.id, item)
for (const id of ids) { for (const id of ids) {
infos.push(map.get(id) as LX.Music.MusicInfo) infos.push(map.get(id)!)
map.delete(id) map.delete(id)
} }
list = list.filter(mInfo => map.has(mInfo.id)) list = list.filter(mInfo => map.has(mInfo.id))