Skip to content

Commit

Permalink
更新依赖&版本号(2.6.0-beta.5)
Browse files Browse the repository at this point in the history
  • Loading branch information
lyswhut committed Dec 12, 2023
1 parent e9539b5 commit 050b641
Show file tree
Hide file tree
Showing 21 changed files with 335 additions and 334 deletions.
1 change: 1 addition & 0 deletions .eslintrc.base.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
578 changes: 289 additions & 289 deletions package-lock.json

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/common/utils/download/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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('&')}`
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/modules/sync/server/server/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/main/modules/sync/server/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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'))
}
})
Expand Down Expand Up @@ -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}`
Expand Down
4 changes: 2 additions & 2 deletions src/main/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ export const initHotKey = async() => {
}

return {
local: localConfig as LX.HotKeyConfig,
global: globalConfig as LX.HotKeyConfig,
local: localConfig!,
global: globalConfig!,
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/worker/dbService/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/worker/dbService/modules/list/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/core/music/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/core/useApp/listAutoUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/core/useApp/usePlayer/useSoundEffect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions src/renderer/plugins/player/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]}`)!)
}
}

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand All @@ -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)

Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/store/hotSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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([])
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/store/list/listManage/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/store/list/listManage/rendererListManage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/store/search/music/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[]
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/renderer/store/search/songlist/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/store/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
})
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/views/List/MyList/useEditList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/worker/main/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 050b641

Please sign in to comment.