更新依赖&版本号(2.6.0-beta.5)
parent
e9539b5c5c
commit
050b641d79
|
@ -42,6 +42,7 @@ const typescriptRule = {
|
|||
'@typescript-eslint/return-await': 'off',
|
||||
'@typescript-eslint/ban-ts-comment': 'off',
|
||||
'@typescript-eslint/comma-dangle': 'off',
|
||||
'@typescript-eslint/no-unsafe-argument': 'off',
|
||||
}
|
||||
const vueRule = {
|
||||
...typescriptRule,
|
||||
|
|
File diff suppressed because it is too large
Load Diff
18
package.json
18
package.json
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "lx-music-desktop",
|
||||
"version": "2.6.0-beta.4",
|
||||
"version": "2.6.0-beta.5",
|
||||
"description": "一个免费的音乐查找助手",
|
||||
"main": "./dist/main.js",
|
||||
"productName": "lx-music-desktop",
|
||||
|
@ -108,13 +108,13 @@
|
|||
},
|
||||
"homepage": "https://github.com/lyswhut/lx-music-desktop#readme",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.23.5",
|
||||
"@babel/core": "^7.23.6",
|
||||
"@babel/eslint-parser": "^7.23.3",
|
||||
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
||||
"@babel/plugin-transform-modules-umd": "^7.23.3",
|
||||
"@babel/plugin-transform-runtime": "^7.23.4",
|
||||
"@babel/preset-env": "^7.23.5",
|
||||
"@babel/plugin-transform-runtime": "^7.23.6",
|
||||
"@babel/preset-env": "^7.23.6",
|
||||
"@babel/preset-typescript": "^7.23.3",
|
||||
"@tsconfig/recommended": "^1.0.3",
|
||||
"@types/better-sqlite3": "^7.6.8",
|
||||
|
@ -134,14 +134,14 @@
|
|||
"css-minimizer-webpack-plugin": "^5.0.1",
|
||||
"del": "^6.1.1",
|
||||
"electron": "^25.9.8",
|
||||
"electron-builder": "^24.9.3",
|
||||
"electron-builder": "^24.9.4",
|
||||
"electron-debug": "^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",
|
||||
"eslint": "^8.55.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-plugin-html": "^7.1.0",
|
||||
"eslint-plugin-vue": "^9.19.2",
|
||||
|
@ -194,9 +194,9 @@
|
|||
"sortablejs": "^1.15.1",
|
||||
"tunnel": "^0.0.6",
|
||||
"utf-8-validate": "^6.0.3",
|
||||
"vue": "^3.3.10",
|
||||
"vue": "^3.3.11",
|
||||
"vue-router": "^4.2.5",
|
||||
"ws": "^8.14.2"
|
||||
"ws": "^8.15.0"
|
||||
},
|
||||
"overrides": {
|
||||
"got": "^11",
|
||||
|
|
|
@ -27,7 +27,7 @@ const sendRequest = (url: string, options: Options, callback?: HttpCallback) =>
|
|||
}
|
||||
|
||||
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)}`)
|
||||
.join('&')}`
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ const verifyConnection = (encryptMsg: string, userId: string) => {
|
|||
export const authConnect = async(req: http.IncomingMessage) => {
|
||||
let ip = getAvailableIP(req)
|
||||
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 t = query.t
|
||||
if (typeof i == 'string' && typeof t == 'string' && verifyConnection(t, i)) return
|
||||
|
|
|
@ -56,7 +56,7 @@ const checkDuplicateClient = (newSocket: LX.Sync.Server.Socket) => {
|
|||
}
|
||||
|
||||
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')
|
||||
|
||||
// // 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 = {}
|
||||
if (!status.devices.length) handleUnconnection()
|
||||
} 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'))
|
||||
}
|
||||
})
|
||||
|
@ -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}`
|
||||
log.info(`Listening on ${ip} ${bind}`)
|
||||
resolve(null)
|
||||
void registerLocalSyncEvent(wss as LX.Sync.Server.SocketServer)
|
||||
void registerLocalSyncEvent(wss!)
|
||||
})
|
||||
|
||||
host = `http://${ip}:${port}`
|
||||
|
|
|
@ -178,8 +178,8 @@ export const initHotKey = async() => {
|
|||
}
|
||||
|
||||
return {
|
||||
local: localConfig as LX.HotKeyConfig,
|
||||
global: globalConfig as LX.HotKeyConfig,
|
||||
local: localConfig!,
|
||||
global: globalConfig!,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ const migrateV1 = (db: Database.Database) => {
|
|||
// 修复 v2.4.0 的默认数据库版本号不对的问题
|
||||
const existsTable = db.prepare('SELECT name FROM "main".sqlite_master WHERE type=\'table\' AND name=\'dislike_list\';').get()
|
||||
if (!existsTable) {
|
||||
const sql = tables.get('dislike_list') as string
|
||||
const sql = tables.get('dislike_list')!
|
||||
db.exec(sql)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -322,7 +322,7 @@ export const musicsPositionUpdate = (listId: string, position: number, ids: stri
|
|||
const map = new Map<string, LX.Music.MusicInfo>()
|
||||
for (const item of newTargetList) map.set(item.id, item)
|
||||
for (const id of ids) {
|
||||
infos.push(map.get(id) as LX.Music.MusicInfo)
|
||||
infos.push(map.get(id)!)
|
||||
map.delete(id)
|
||||
}
|
||||
newTargetList = newTargetList.filter(mInfo => map.has(mInfo.id))
|
||||
|
|
|
@ -169,7 +169,7 @@ export const getOnlineOtherSourceMusicUrl = async({ musicInfos, quality, onToggl
|
|||
let musicInfo: LX.Music.MusicInfoOnline | null = null
|
||||
let itemQuality: LX.Quality | null = null
|
||||
// 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
|
||||
retryedSource.push(musicInfo.source)
|
||||
if (!assertApiSupport(musicInfo.source)) continue
|
||||
|
@ -263,7 +263,7 @@ export const getOnlineOtherSourcePicUrl = async({ musicInfos, onToggleSource, is
|
|||
}> => {
|
||||
let musicInfo: LX.Music.MusicInfoOnline | null = null
|
||||
// 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
|
||||
retryedSource.push(musicInfo.source)
|
||||
// if (!assertApiSupport(musicInfo.source)) continue
|
||||
|
@ -346,7 +346,7 @@ export const getOnlineOtherSourceLyricInfo = async({ musicInfos, onToggleSource,
|
|||
}> => {
|
||||
let musicInfo: LX.Music.MusicInfoOnline | null = null
|
||||
// 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
|
||||
retryedSource.push(musicInfo.source)
|
||||
// if (!assertApiSupport(musicInfo.source)) continue
|
||||
|
|
|
@ -4,7 +4,7 @@ import syncSourceList from '@renderer/store/list/syncSourceList'
|
|||
|
||||
const handleSyncSourceList = async(waitUpdateLists: LX.List.UserListInfo[]) => {
|
||||
if (!waitUpdateLists.length) return
|
||||
const targetListInfo = waitUpdateLists.shift() as LX.List.UserListInfo
|
||||
const targetListInfo = waitUpdateLists.shift()!
|
||||
// console.log(targetListInfo)
|
||||
try {
|
||||
await syncSourceList(targetListInfo)
|
||||
|
|
|
@ -20,7 +20,7 @@ const loadBuffer = async(name: string) => new Promise<AudioBuffer>((resolve, rej
|
|||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const path = require('@renderer/assets/medias/filters/' + name) as string
|
||||
if (cache.has(path)) {
|
||||
resolve(cache.get(path) as AudioBuffer)
|
||||
resolve(cache.get(path)!)
|
||||
return
|
||||
}
|
||||
// Load buffer asynchronously
|
||||
|
|
|
@ -82,7 +82,7 @@ const initBiquadFilter = () => {
|
|||
}
|
||||
|
||||
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
|
||||
mediaSource = audioContext.createMediaElementSource(audio)
|
||||
mediaSource.connect(analyser)
|
||||
analyser.connect(biquads.get(`hz${freqs[0]}`) as BiquadFilterNode)
|
||||
const lastBiquadFilter = (biquads.get(`hz${freqs.at(-1) as Freqs}`) as BiquadFilterNode)
|
||||
analyser.connect(biquads.get(`hz${freqs[0]}`)!)
|
||||
const lastBiquadFilter = (biquads.get(`hz${freqs.at(-1)!}`)!)
|
||||
lastBiquadFilter.connect(convolverSourceGainNode)
|
||||
lastBiquadFilter.connect(convolver)
|
||||
convolverDynamicsCompressor.connect(panner)
|
||||
|
@ -223,7 +223,7 @@ let isConnected = true
|
|||
const connectNode = () => {
|
||||
if (isConnected) return
|
||||
console.log('connect Node')
|
||||
analyser?.connect(biquads.get(`hz${freqs[0]}`) as BiquadFilterNode)
|
||||
analyser?.connect(biquads.get(`hz${freqs[0]}`)!)
|
||||
isConnected = true
|
||||
if (pitchShifterNodeTempValue == 1 && pitchShifterNodeLoadStatus == 'connected') {
|
||||
disconnectPitchShifterNode()
|
||||
|
@ -246,7 +246,7 @@ const connectPitchShifterNode = () => {
|
|||
audio!.addEventListener('emptied', 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.connect(pitchShifterNode)
|
||||
|
||||
|
@ -260,7 +260,7 @@ const connectPitchShifterNode = () => {
|
|||
}
|
||||
const disconnectPitchShifterNode = () => {
|
||||
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.connect(convolver)
|
||||
lastBiquadFilter.connect(convolverSourceGainNode)
|
||||
|
|
|
@ -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([])
|
||||
|
|
|
@ -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,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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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))
|
||||
})
|
||||
|
|
|
@ -23,7 +23,7 @@ export default ({ dom_lists_list }: {
|
|||
const handleSaveListName = async() => {
|
||||
let dom_target = dom_lists_list.value?.querySelector('.' + styles.editing) as HTMLElement
|
||||
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
|
||||
let name = dom_input.value.trim()
|
||||
if (dom_target.dataset.index == null) return
|
||||
|
|
|
@ -112,7 +112,7 @@ const getIntv = (musicInfo: LX.Music.MusicInfo) => {
|
|||
let intv = 0
|
||||
let unit = 1
|
||||
while (intvArr.length) {
|
||||
intv += parseInt(intvArr.pop() as string) * unit
|
||||
intv += parseInt(intvArr.pop()!) * unit
|
||||
unit *= 60
|
||||
}
|
||||
return intv
|
||||
|
@ -237,7 +237,7 @@ export const filterDuplicateMusic = async(list: LX.Music.MusicInfo[], isFilterVa
|
|||
// console.log(duplicateList)
|
||||
const duplicateNames = Array.from(duplicateList)
|
||||
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) => {
|
||||
|
@ -271,7 +271,7 @@ export const createSortedList = (list: LX.Music.MusicInfo[], position: number, i
|
|||
const map = new Map<string, LX.Music.MusicInfo>()
|
||||
for (const item of list) map.set(item.id, item)
|
||||
for (const id of ids) {
|
||||
infos.push(map.get(id) as LX.Music.MusicInfo)
|
||||
infos.push(map.get(id)!)
|
||||
map.delete(id)
|
||||
}
|
||||
list = list.filter(mInfo => map.has(mInfo.id))
|
||||
|
|
Loading…
Reference in New Issue