更新依赖
parent
6d949d7e4d
commit
bdd5b46708
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
34
package.json
34
package.json
|
@ -205,37 +205,37 @@
|
|||
},
|
||||
"homepage": "https://github.com/lyswhut/lx-music-desktop#readme",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.21.3",
|
||||
"@babel/core": "^7.21.4",
|
||||
"@babel/eslint-parser": "^7.21.3",
|
||||
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
||||
"@babel/plugin-transform-modules-umd": "^7.18.6",
|
||||
"@babel/plugin-transform-runtime": "^7.21.0",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@babel/preset-typescript": "^7.21.0",
|
||||
"@types/better-sqlite3": "^7.6.3",
|
||||
"@babel/plugin-transform-runtime": "^7.21.4",
|
||||
"@babel/preset-env": "^7.21.4",
|
||||
"@babel/preset-typescript": "^7.21.4",
|
||||
"@types/better-sqlite3": "^7.6.4",
|
||||
"@types/needle": "^3.2.0",
|
||||
"@types/tunnel": "^0.0.3",
|
||||
"@typescript-eslint/eslint-plugin": "^5.57.0",
|
||||
"@typescript-eslint/parser": "^5.57.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.57.1",
|
||||
"@typescript-eslint/parser": "^5.57.1",
|
||||
"@volar/vue-language-plugin-pug": "^1.2.0",
|
||||
"babel-loader": "^9.1.2",
|
||||
"browserslist": "^4.21.5",
|
||||
"chalk": "^4.1.2",
|
||||
"changelog-parser": "^3.0.1",
|
||||
"copy-webpack-plugin": "^11.0.0",
|
||||
"core-js": "^3.29.1",
|
||||
"core-js": "^3.30.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"css-loader": "^6.7.3",
|
||||
"css-minimizer-webpack-plugin": "^5.0.0",
|
||||
"del": "^6.1.1",
|
||||
"electron": "^22.3.5",
|
||||
"electron-builder": "^24.1.2",
|
||||
"electron-builder": "^24.2.0",
|
||||
"electron-debug": "^3.2.0",
|
||||
"electron-devtools-installer": "^3.2.0",
|
||||
"electron-to-chromium": "^1.4.345",
|
||||
"electron-updater": "^6.0.2",
|
||||
"eslint": "^8.37.0",
|
||||
"electron-to-chromium": "^1.4.356",
|
||||
"electron-updater": "^6.0.3",
|
||||
"eslint": "^8.38.0",
|
||||
"eslint-config-standard": "^17.0.0",
|
||||
"eslint-config-standard-with-typescript": "^34.0.1",
|
||||
"eslint-formatter-friendly": "github:lyswhut/eslint-friendly-formatter#2170d1320e2fad13615a9dcf229669f0bb473a53",
|
||||
|
@ -251,7 +251,7 @@
|
|||
"mini-css-extract-plugin": "^2.7.5",
|
||||
"node-loader": "^2.0.0",
|
||||
"postcss": "^8.4.21",
|
||||
"postcss-loader": "^7.1.0",
|
||||
"postcss-loader": "^7.2.4",
|
||||
"postcss-pxtorem": "^6.0.0",
|
||||
"pug": "^3.0.2",
|
||||
"pug-plain-loader": "^1.1.0",
|
||||
|
@ -263,19 +263,19 @@
|
|||
"terser": "^5.16.8",
|
||||
"terser-webpack-plugin": "^5.3.7",
|
||||
"ts-loader": "^9.4.2",
|
||||
"typescript": "^5.0.2",
|
||||
"typescript": "^5.0.4",
|
||||
"vue-eslint-parser": "^9.1.1",
|
||||
"vue-loader": "^17.0.1",
|
||||
"vue-template-compiler": "^2.7.14",
|
||||
"webpack": "^5.77.0",
|
||||
"webpack": "^5.78.0",
|
||||
"webpack-cli": "^5.0.1",
|
||||
"webpack-dev-server": "^4.13.1",
|
||||
"webpack-dev-server": "^4.13.2",
|
||||
"webpack-hot-middleware": "github:lyswhut/webpack-hot-middleware#329c4375134b89d39da23a56a94db651247c74a1",
|
||||
"webpack-merge": "^5.8.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@simonwep/pickr": "^1.8.2",
|
||||
"better-sqlite3": "^8.2.0",
|
||||
"better-sqlite3": "^8.3.0",
|
||||
"bufferutil": "^4.0.7",
|
||||
"comlink": "~4.3.1",
|
||||
"crypto-js": "^4.1.1",
|
||||
|
|
|
@ -29,7 +29,7 @@ export default (db: Database.Database) => {
|
|||
// PRAGMA user_version = x
|
||||
// console.log(db.prepare('PRAGMA user_version').get().user_version)
|
||||
// https://github.com/WiseLibs/better-sqlite3/issues/668#issuecomment-1145285728
|
||||
const version = db.prepare('SELECT "field_value" FROM "main"."db_info" WHERE "field_name" = ?').get('version').field_value
|
||||
const version = (db.prepare<[string]>('SELECT "field_value" FROM "main"."db_info" WHERE "field_name" = ?').get('version') as { field_value: string }).field_value
|
||||
switch (version) {
|
||||
case '1':
|
||||
migrateV1(db)
|
||||
|
|
|
@ -11,9 +11,9 @@ import {
|
|||
/**
|
||||
* 查询下载歌曲列表
|
||||
*/
|
||||
export const queryDownloadList = (): LX.DBService.DownloadMusicInfo[] => {
|
||||
export const queryDownloadList = () => {
|
||||
const queryStatement = createQueryStatement()
|
||||
return queryStatement.all()
|
||||
return queryStatement.all() as LX.DBService.DownloadMusicInfo[]
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,7 +6,7 @@ import { getDB } from '../../db'
|
|||
*/
|
||||
export const createQueryStatement = () => {
|
||||
const db = getDB()
|
||||
return db.prepare(`
|
||||
return db.prepare<[]>(`
|
||||
SELECT "id", "isComplate", "status", "statusText", "progress_downloaded", "progress_total", "url", "quality", "ext", "fileName", "filePath", "musicInfo", "position"
|
||||
FROM download_list
|
||||
ORDER BY "position" ASC
|
||||
|
@ -30,7 +30,7 @@ export const createInsertStatement = () => {
|
|||
*/
|
||||
export const createClearStatement = () => {
|
||||
const db = getDB()
|
||||
return db.prepare(`
|
||||
return db.prepare<[]>(`
|
||||
DELETE FROM "main"."download_list"
|
||||
`)
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@ import {
|
|||
* 获取用户列表
|
||||
* @returns
|
||||
*/
|
||||
export const queryAllUserList = (): LX.DBService.UserListInfo[] => {
|
||||
return createListQueryStatement().all()
|
||||
export const queryAllUserList = () => {
|
||||
return createListQueryStatement().all() as LX.DBService.UserListInfo[]
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -154,9 +154,9 @@ export const updateMusicInfos = (list: LX.DBService.MusicInfo[]) => {
|
|||
* @param listId 列表Id
|
||||
* @returns 列表歌曲
|
||||
*/
|
||||
export const queryMusicInfoByListId = (listId: string): LX.DBService.MusicInfo[] => {
|
||||
export const queryMusicInfoByListId = (listId: string) => {
|
||||
const musicInfoQueryStatement = createMusicInfoQueryStatement()
|
||||
return musicInfoQueryStatement.all({ listId })
|
||||
return musicInfoQueryStatement.all({ listId }) as LX.DBService.MusicInfo[]
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -268,9 +268,9 @@ export const removeMusicInfoByListId = (ids: string[]) => {
|
|||
* @param musicInfoId 音乐id
|
||||
* @returns
|
||||
*/
|
||||
export const queryMusicInfoByListIdAndMusicInfoId = (listId: string, musicInfoId: string): LX.DBService.MusicInfo | null => {
|
||||
export const queryMusicInfoByListIdAndMusicInfoId = (listId: string, musicInfoId: string) => {
|
||||
const musicInfoByListAndMusicInfoIdQueryStatement = createMusicInfoByListAndMusicInfoIdQueryStatement()
|
||||
return musicInfoByListAndMusicInfoIdQueryStatement.get({ listId, musicInfoId })
|
||||
return musicInfoByListAndMusicInfoIdQueryStatement.get({ listId, musicInfoId }) as LX.DBService.MusicInfo | null
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -278,9 +278,9 @@ export const queryMusicInfoByListIdAndMusicInfoId = (listId: string, musicInfoId
|
|||
* @param id 音乐id
|
||||
* @returns
|
||||
*/
|
||||
export const queryMusicInfoByMusicInfoId = (id: string): LX.DBService.MusicInfo[] => {
|
||||
export const queryMusicInfoByMusicInfoId = (id: string) => {
|
||||
const musicInfoByMusicInfoIdQueryStatement = createMusicInfoByMusicInfoIdQueryStatement()
|
||||
return musicInfoByMusicInfoIdQueryStatement.all(id)
|
||||
return musicInfoByMusicInfoIdQueryStatement.all(id) as LX.DBService.MusicInfo[]
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,7 +7,7 @@ import { getDB } from '../../db'
|
|||
*/
|
||||
export const createListQueryStatement = () => {
|
||||
const db = getDB()
|
||||
return db.prepare(`
|
||||
return db.prepare<[]>(`
|
||||
SELECT "id", "name", "source", "sourceListId", "position", "locationUpdateTime"
|
||||
FROM "main"."my_list"
|
||||
`)
|
||||
|
@ -30,7 +30,7 @@ export const createListInsertStatement = () => {
|
|||
*/
|
||||
export const createListClearStatement = () => {
|
||||
const db = getDB()
|
||||
return db.prepare('DELETE FROM "main"."my_list"')
|
||||
return db.prepare<[]>('DELETE FROM "main"."my_list"')
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -100,7 +100,7 @@ export const createMusicInfoUpdateStatement = () => {
|
|||
*/
|
||||
export const createMusicInfoClearStatement = () => {
|
||||
const db = getDB()
|
||||
return db.prepare('DELETE FROM "main"."my_list_music_info"')
|
||||
return db.prepare<[]>('DELETE FROM "main"."my_list_music_info"')
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -162,7 +162,7 @@ export const createMusicInfoOrderInsertStatement = () => {
|
|||
*/
|
||||
export const createMusicInfoOrderClearStatement = () => {
|
||||
const db = getDB()
|
||||
return db.prepare('DELETE FROM "main"."my_list_music_info_order"')
|
||||
return db.prepare<[]>('DELETE FROM "main"."my_list_music_info_order"')
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,9 +20,9 @@ import {
|
|||
* @param id 歌曲id
|
||||
* @returns 歌词信息
|
||||
*/
|
||||
export const queryLyric = (id: string): LX.DBService.Lyricnfo[] => {
|
||||
export const queryLyric = (id: string) => {
|
||||
const lyricQueryStatement = createLyricQueryStatement()
|
||||
return lyricQueryStatement.all(id)
|
||||
return lyricQueryStatement.all(id) as LX.DBService.Lyricnfo[]
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,9 +30,9 @@ export const queryLyric = (id: string): LX.DBService.Lyricnfo[] => {
|
|||
* @param id 歌曲id
|
||||
* @returns 歌词信息
|
||||
*/
|
||||
export const queryRawLyric = (id: string): LX.DBService.Lyricnfo[] => {
|
||||
export const queryRawLyric = (id: string) => {
|
||||
const rawLyricQueryStatement = createRawLyricQueryStatement()
|
||||
return rawLyricQueryStatement.all(id)
|
||||
return rawLyricQueryStatement.all(id) as LX.DBService.Lyricnfo[]
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,7 +84,7 @@ export const clearRawLyric = () => {
|
|||
*/
|
||||
export const countRawLyric = () => {
|
||||
const countStatement = createRawLyricCountStatement()
|
||||
return countStatement.get().count
|
||||
return (countStatement.get() as { count: number }).count
|
||||
}
|
||||
|
||||
|
||||
|
@ -93,9 +93,9 @@ export const countRawLyric = () => {
|
|||
* @param id 歌曲id
|
||||
* @returns 歌词信息
|
||||
*/
|
||||
export const queryEditedLyric = (id: string): LX.DBService.Lyricnfo[] => {
|
||||
export const queryEditedLyric = (id: string) => {
|
||||
const rawLyricQueryStatement = createEditedLyricQueryStatement()
|
||||
return rawLyricQueryStatement.all(id)
|
||||
return rawLyricQueryStatement.all(id) as LX.DBService.Lyricnfo[]
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -148,5 +148,5 @@ export const clearEditedLyric = () => {
|
|||
*/
|
||||
export const countEditedLyric = () => {
|
||||
const countStatement = createEditedLyricCountStatement()
|
||||
return countStatement.get().count
|
||||
return (countStatement.get() as { count: number }).count
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ export const createRawLyricInsertStatement = () => {
|
|||
*/
|
||||
export const createRawLyricClearStatement = () => {
|
||||
const db = getDB()
|
||||
return db.prepare(`
|
||||
return db.prepare<[]>(`
|
||||
DELETE FROM "main"."lyric"
|
||||
WHERE "source"='${RAW_LYRIC}'
|
||||
`)
|
||||
|
@ -83,7 +83,7 @@ export const createRawLyricUpdateStatement = () => {
|
|||
*/
|
||||
export const createRawLyricCountStatement = () => {
|
||||
const db = getDB()
|
||||
return db.prepare(`SELECT COUNT(*) as count FROM "main"."lyric" WHERE "source"='${RAW_LYRIC}'`)
|
||||
return db.prepare<[]>(`SELECT COUNT(*) as count FROM "main"."lyric" WHERE "source"='${RAW_LYRIC}'`)
|
||||
}
|
||||
|
||||
|
||||
|
@ -117,7 +117,7 @@ export const createEditedLyricInsertStatement = () => {
|
|||
*/
|
||||
export const createEditedLyricClearStatement = () => {
|
||||
const db = getDB()
|
||||
return db.prepare(`
|
||||
return db.prepare<[]>(`
|
||||
DELETE FROM "main"."lyric"
|
||||
WHERE "source"='${EDITED_LYRIC}'
|
||||
`)
|
||||
|
@ -153,5 +153,5 @@ export const createEditedLyricUpdateStatement = () => {
|
|||
*/
|
||||
export const createEditedLyricCountStatement = () => {
|
||||
const db = getDB()
|
||||
return db.prepare(`SELECT COUNT(*) as count FROM "main"."lyric" WHERE "source"='${EDITED_LYRIC}'`)
|
||||
return db.prepare<[]>(`SELECT COUNT(*) as count FROM "main"."lyric" WHERE "source"='${EDITED_LYRIC}'`)
|
||||
}
|
||||
|
|
|
@ -13,9 +13,9 @@ import {
|
|||
* @param id 歌曲id
|
||||
* @returns 歌曲信息
|
||||
*/
|
||||
export const queryMusicInfo = (id: string): LX.DBService.MusicInfoOtherSource[] => {
|
||||
export const queryMusicInfo = (id: string) => {
|
||||
const musicInfoQueryStatement = createMusicInfoQueryStatement()
|
||||
return musicInfoQueryStatement.all(id)
|
||||
return musicInfoQueryStatement.all(id) as LX.DBService.MusicInfoOtherSource[]
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -55,5 +55,5 @@ export const clearMusicInfo = () => {
|
|||
*/
|
||||
export const countMusicInfo = () => {
|
||||
const countStatement = createCountStatement()
|
||||
return countStatement.get().count
|
||||
return (countStatement.get() as { count: number }).count
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ export const createMusicInfoInsertStatement = () => {
|
|||
*/
|
||||
export const createMusicInfoClearStatement = () => {
|
||||
const db = getDB()
|
||||
return db.prepare(`
|
||||
return db.prepare<[]>(`
|
||||
DELETE FROM "main"."music_info_other_source"
|
||||
`)
|
||||
}
|
||||
|
@ -56,5 +56,5 @@ export const createMusicInfoDeleteStatement = () => {
|
|||
*/
|
||||
export const createCountStatement = () => {
|
||||
const db = getDB()
|
||||
return db.prepare('SELECT COUNT(*) as count FROM "main"."music_info_other_source"')
|
||||
return db.prepare<[]>('SELECT COUNT(*) as count FROM "main"."music_info_other_source"')
|
||||
}
|
||||
|
|
|
@ -13,9 +13,9 @@ import {
|
|||
* @param id 歌曲id
|
||||
* @returns url
|
||||
*/
|
||||
export const queryMusicUrl = (id: string): string | null => {
|
||||
export const queryMusicUrl = (id: string) => {
|
||||
const queryStatement = createQueryStatement()
|
||||
return queryStatement.get(id)?.url
|
||||
return (queryStatement.get(id) as { url: string } | null)?.url ?? null
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -71,5 +71,5 @@ export const clearMusicUrl = () => {
|
|||
*/
|
||||
export const countMusicUrl = () => {
|
||||
const countStatement = createCountStatement()
|
||||
return countStatement.get().count
|
||||
return (countStatement.get() as { count: number }).count
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ export const createInsertStatement = () => {
|
|||
*/
|
||||
export const createClearStatement = () => {
|
||||
const db = getDB()
|
||||
return db.prepare(`
|
||||
return db.prepare<[]>(`
|
||||
DELETE FROM "main"."music_url"
|
||||
`)
|
||||
}
|
||||
|
@ -65,5 +65,5 @@ export const createUpdateStatement = () => {
|
|||
*/
|
||||
export const createCountStatement = () => {
|
||||
const db = getDB()
|
||||
return db.prepare('SELECT COUNT(*) as count FROM "main"."music_url"')
|
||||
return db.prepare<[]>('SELECT COUNT(*) as count FROM "main"."music_url"')
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ import tables from './tables'
|
|||
|
||||
const rxp = /\n|\s|;|--.+/g
|
||||
export default (db: Database.Database) => {
|
||||
const result = db.prepare('SELECT type,name,tbl_name,sql FROM "main".sqlite_master WHERE sql NOT NULL;').all()
|
||||
const result = db.prepare<[]>('SELECT type,name,tbl_name,sql FROM "main".sqlite_master WHERE sql NOT NULL;').all() as Array<{ type: string, name: string, tbl_name: string, sql: string }>
|
||||
const dbTableMap = new Map<string, string>()
|
||||
for (const info of result) dbTableMap.set(info.name, info.sql.replace(rxp, ''))
|
||||
return Array.from(tables.entries()).every(([name, sql]) => {
|
||||
|
|
Loading…
Reference in New Issue