Merge branch 'dev' into pr/1440

This commit is contained in:
lyswhut 2023-07-11 14:59:25 +08:00
commit 4867fdb72c
10 changed files with 360 additions and 377 deletions

View File

@ -8,6 +8,7 @@ module.exports = {
'vue', 'vue',
'eslint-plugin-n', 'eslint-plugin-n',
'@types/ws', '@types/ws',
'eslint-config-standard-with-typescript',
], ],
// target: 'newest', // target: 'newest',
@ -25,5 +26,6 @@ module.exports = {
// filter: [ // filter: [
// 'eslint-plugin-n', // 'eslint-plugin-n',
// 'electron', // 'electron',
// 'eslint-config-standard-with-typescript',
// ], // ],
} }

567
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.3.0", "version": "2.3.1-beta.1",
"description": "一个免费的音乐查找助手", "description": "一个免费的音乐查找助手",
"main": "./dist/main.js", "main": "./dist/main.js",
"productName": "lx-music-desktop", "productName": "lx-music-desktop",
@ -208,21 +208,21 @@
}, },
"homepage": "https://github.com/lyswhut/lx-music-desktop#readme", "homepage": "https://github.com/lyswhut/lx-music-desktop#readme",
"devDependencies": { "devDependencies": {
"@babel/core": "^7.22.5", "@babel/core": "^7.22.6",
"@babel/eslint-parser": "^7.22.5", "@babel/eslint-parser": "^7.22.6",
"@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.22.5", "@babel/plugin-transform-modules-umd": "^7.22.5",
"@babel/plugin-transform-runtime": "^7.22.5", "@babel/plugin-transform-runtime": "^7.22.6",
"@babel/preset-env": "^7.22.5", "@babel/preset-env": "^7.22.6",
"@babel/preset-typescript": "^7.22.5", "@babel/preset-typescript": "^7.22.5",
"@tsconfig/recommended": "^1.0.2", "@tsconfig/recommended": "^1.0.2",
"@types/better-sqlite3": "^7.6.4", "@types/better-sqlite3": "^7.6.4",
"@types/needle": "^3.2.0", "@types/needle": "^3.2.0",
"@types/tunnel": "^0.0.3", "@types/tunnel": "^0.0.3",
"@types/ws": "8.5.4", "@types/ws": "8.5.4",
"@typescript-eslint/eslint-plugin": "^5.60.1", "@typescript-eslint/eslint-plugin": "^5.61.0",
"@typescript-eslint/parser": "^5.60.1", "@typescript-eslint/parser": "^5.61.0",
"@volar/vue-language-plugin-pug": "^1.6.5", "@volar/vue-language-plugin-pug": "^1.6.5",
"@vue/language-plugin-pug": "^1.8.3", "@vue/language-plugin-pug": "^1.8.3",
"babel-loader": "^9.1.2", "babel-loader": "^9.1.2",
@ -236,12 +236,12 @@
"css-minimizer-webpack-plugin": "^5.0.1", "css-minimizer-webpack-plugin": "^5.0.1",
"del": "^6.1.1", "del": "^6.1.1",
"electron": "^22.3.15", "electron": "^22.3.15",
"electron-builder": "^24.5.1", "electron-builder": "^24.5.2",
"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.445", "electron-to-chromium": "^1.4.449",
"electron-updater": "^6.1.2", "electron-updater": "^6.1.3",
"eslint": "^8.43.0", "eslint": "^8.44.0",
"eslint-config-standard": "^17.1.0", "eslint-config-standard": "^17.1.0",
"eslint-config-standard-with-typescript": "^35.0.0", "eslint-config-standard-with-typescript": "^35.0.0",
"eslint-formatter-friendly": "github:lyswhut/eslint-friendly-formatter#2170d1320e2fad13615a9dcf229669f0bb473a53", "eslint-formatter-friendly": "github:lyswhut/eslint-friendly-formatter#2170d1320e2fad13615a9dcf229669f0bb473a53",

View File

@ -1,28 +1,4 @@
### 新增
- 新增音效设置实验性功能支持10段均衡器设置、内置的一些环境混响音效、音调升降调节、3D立体环绕音效由于升降调需要实时处理音频数据这会导致额外的CPU占用已知问题如果CPU资源不够时将处理导致任务堆积而出现声音异常这时需要暂停播放一段时间等堆积的任务处理完毕再播放
- 播放速率设置面板新增是否音调补偿设置,在调整播放速率后,可以选择是否启用音调补偿,默认启用
### 优化
- Windows、MacOS平台下的字体列表改用原生方式获取现在Windows平台下能显示当前已安装的更多类型字体了MacOS平台未测可用性未知
- 移除桌面歌词窗口透明边距在Linux下的桌面歌词可以完全拖到贴合屏幕边缘了
- 过滤嵌入、下载的翻译、罗马音歌词时间标签,与主歌词时间不匹配的歌词将被丢弃,防止出现原歌词与翻译歌词顺序错乱的问题(#1358
### 修复 ### 修复
- 修复列表名翻译显示 - 修复字体设置某些字体无法应用的问题
- 修复因插入数字类型的ID导致其意外在末尾追加 .0 导致列表数据异常的问题,同时也可能导致同步数据丢失的问题(要完全修复这个问题还需要同时将移动端、同步服务更新到最新版本) - 修复搜索提示功能失效的问题(#1452, @Folltoshe
- 修复下载时出现302错误的问题
- 修复播放某些在线音频会没有声音的问题
- 修复改变播放速率时会导致歌词报错的问题
- 修复tx热门评论昵称被错误切割的问题 (#1397, By: @helloplhm-qwq, @Folltoshe)
- 修复wy源热搜词失效的问题#1401, @Folltoshe
- 修复Deepin 20下启用桌面歌词时可能会导致桌面卡死的问题#1288
- 修复添加单首歌曲弹窗列表创建按钮无法取消的问题
- 修复mg歌单搜索歌单播放数量显示问题
- 修复tx翻译歌词解析丢失的问题更新版本后需手动清理一次歌词缓存
### 其他
- 更新 electron 到 v22.3.15

View File

@ -34,7 +34,7 @@ export default {
return name return name
}) })
const lrcStyles = computed(() => ({ const lrcStyles = computed(() => ({
fontFamily: setting['desktopLyric.style.font'], fontFamily: /\s/.test(setting['desktopLyric.style.font']) ? `"${setting['desktopLyric.style.font']}"` : setting['desktopLyric.style.font'],
fontSize: Math.trunc(setting['desktopLyric.style.fontSize']) + 'px', fontSize: Math.trunc(setting['desktopLyric.style.fontSize']) + 'px',
opacity: setting['desktopLyric.style.opacity'] / 100, opacity: setting['desktopLyric.style.opacity'] / 100,
textAlign: setting['desktopLyric.style.align'], textAlign: setting['desktopLyric.style.align'],

View File

@ -33,7 +33,7 @@ export default {
return name return name
}) })
const lrcStyles = computed(() => ({ const lrcStyles = computed(() => ({
fontFamily: setting['desktopLyric.style.font'], fontFamily: /\s/.test(setting['desktopLyric.style.font']) ? `"${setting['desktopLyric.style.font']}"` : setting['desktopLyric.style.font'],
fontSize: Math.trunc(setting['desktopLyric.style.fontSize']) + 'px', fontSize: Math.trunc(setting['desktopLyric.style.fontSize']) + 'px',
opacity: setting['desktopLyric.style.opacity'] / 100, opacity: setting['desktopLyric.style.opacity'] / 100,
textAlign: setting['desktopLyric.style.align'], textAlign: setting['desktopLyric.style.align'],

View File

@ -27,7 +27,7 @@ export default () => {
}) })
watch(() => appSetting['common.font'], (val) => { watch(() => appSetting['common.font'], (val) => {
document.documentElement.style.fontFamily = val document.documentElement.style.fontFamily = /\s/.test(val) ? `"${val}"` : val
}, { }, {
immediate: true, immediate: true,
}) })

View File

@ -1,7 +1,7 @@
import { httpFetch } from '../../request' import { httpFetch } from '../../request'
import tipSearch from './tipSearch' import tipSearch from './tipSearch'
import musicSearch from './musicSearch' import musicSearch from './musicSearch'
import { formatSinger, getToken } from './util' import { formatSinger } from './util'
import leaderboard from './leaderboard' import leaderboard from './leaderboard'
import lyric from './lyric' import lyric from './lyric'
import pic from './pic' import pic from './pic'
@ -94,9 +94,9 @@ const kw = {
return `http://www.kuwo.cn/play_detail/${songInfo.songmid}` return `http://www.kuwo.cn/play_detail/${songInfo.songmid}`
}, },
init() { // init() {
return getToken() // return getToken()
}, // },
} }
export default kw export default kw

View File

@ -1,5 +1,6 @@
import { decodeName } from '../../index' // import { decodeName } from '../../index'
import { tokenRequest } from './util' // import { tokenRequest } from './util'
import { httpFetch } from '../../request'
export default { export default {
regExps: { regExps: {
@ -7,24 +8,25 @@ export default {
}, },
requestObj: null, requestObj: null,
async tipSearchBySong(str) { async tipSearchBySong(str) {
// 报错403加了referer还是有问题直接换一个
// this.requestObj = await tokenRequest(`http://www.kuwo.cn/api/www/search/searchKey?key=${encodeURIComponent(str)}`)
this.cancelTipSearch() this.cancelTipSearch()
this.requestObj = await tokenRequest(`http://www.kuwo.cn/api/www/search/searchKey?key=${encodeURIComponent(str)}`) this.requestObj = httpFetch(`https://tips.kuwo.cn/t.s?corp=kuwo&newver=3&p2p=1&notrace=0&c=mbox&w=${encodeURIComponent(str)}&encoding=utf8&rformat=json`, {
return this.requestObj.promise.then(({ body }) => { Referer: 'http://www.kuwo.cn/',
// console.log(body) })
if (body.code !== 200) return Promise.reject(new Error('请求失败')) return this.requestObj.promise.then(({ body, statusCode }) => {
return body if (statusCode != 200 || !body.WORDITEMS) return Promise.reject(new Error('请求失败'))
return body.WORDITEMS
}) })
}, },
handleResult(rawData) { handleResult(rawData) {
return rawData.map(info => { return rawData.map(item => item.RELWORD)
let matchResult = info.match(this.regExps.relWord)
return matchResult ? decodeName(matchResult[1]) : ''
})
}, },
cancelTipSearch() { cancelTipSearch() {
if (this.requestObj && this.requestObj.cancelHttp) this.requestObj.cancelHttp() if (this.requestObj && this.requestObj.cancelHttp) this.requestObj.cancelHttp()
}, },
async search(str) { async search(str) {
return this.tipSearchBySong(str).then(result => this.handleResult(result.data)) return this.tipSearchBySong(str).then(result => this.handleResult(result))
}, },
} }

View File

@ -1,11 +1,11 @@
import { httpGet, httpFetch } from '../../request' // import { httpGet, httpFetch } from '../../request'
import { WIN_MAIN_RENDERER_EVENT_NAME } from '@common/ipcNames' import { WIN_MAIN_RENDERER_EVENT_NAME } from '@common/ipcNames'
import { rendererInvoke } from '@common/rendererIpc' import { rendererInvoke } from '@common/rendererIpc'
const kw_token = { // const kw_token = {
token: null, // token: null,
isGetingToken: false, // isGetingToken: false,
} // }
// const translationMap = { // const translationMap = {
// "{'": '{"', // "{'": '{"',
@ -43,46 +43,46 @@ export const matchToken = headers => {
} }
} }
const wait = time => new Promise(resolve => setTimeout(() => resolve(), time)) // const wait = time => new Promise(resolve => setTimeout(() => resolve(), time))
export const getToken = (retryNum = 0) => new Promise((resolve, reject) => { // export const getToken = (retryNum = 0) => new Promise((resolve, reject) => {
if (retryNum > 2) return Promise.reject(new Error('try max num')) // if (retryNum > 2) return Promise.reject(new Error('try max num'))
if (kw_token.isGetingToken) return wait(1000).then(() => getToken(retryNum).then(token => resolve(token))) // if (kw_token.isGetingToken) return wait(1000).then(() => getToken(retryNum).then(token => resolve(token)))
if (kw_token.token) return resolve(kw_token.token) // if (kw_token.token) return resolve(kw_token.token)
kw_token.isGetingToken = true // kw_token.isGetingToken = true
httpGet('http://www.kuwo.cn/', (err, resp) => { // httpGet('http://www.kuwo.cn/', (err, resp) => {
kw_token.isGetingToken = false // kw_token.isGetingToken = false
if (err) return getToken(++retryNum) // if (err) return getToken(++retryNum)
if (resp.statusCode != 200) return reject(new Error('获取失败')) // if (resp.statusCode != 200) return reject(new Error('获取失败'))
const token = kw_token.token = matchToken(resp.headers) // const token = kw_token.token = matchToken(resp.headers)
resolve(token) // resolve(token)
}) // })
}) // })
export const decodeLyric = base64Data => rendererInvoke(WIN_MAIN_RENDERER_EVENT_NAME.handle_kw_decode_lyric, base64Data) export const decodeLyric = base64Data => rendererInvoke(WIN_MAIN_RENDERER_EVENT_NAME.handle_kw_decode_lyric, base64Data)
export const tokenRequest = async(url, options = {}) => { // export const tokenRequest = async(url, options = {}) => {
let token = kw_token.token // let token = kw_token.token
if (!token) token = await getToken() // if (!token) token = await getToken()
if (!options.headers) { // if (!options.headers) {
options.headers = { // options.headers = {
Referer: 'http://www.kuwo.cn/', // Referer: 'http://www.kuwo.cn/',
csrf: token, // csrf: token,
cookie: 'kw_token=' + token, // cookie: 'kw_token=' + token,
} // }
} // }
const requestObj = httpFetch(url, options) // const requestObj = httpFetch(url, options)
requestObj.promise = requestObj.promise.then(resp => { // requestObj.promise = requestObj.promise.then(resp => {
// console.log(resp) // // console.log(resp)
if (resp.statusCode == 200) { // if (resp.statusCode == 200) {
kw_token.token = matchToken(resp.headers) // kw_token.token = matchToken(resp.headers)
} // }
return resp // return resp
}) // })
return requestObj // return requestObj
} // }
export const lrcTools = { export const lrcTools = {
rxps: { rxps: {