现在如果在设置或者启动参数配置了代理服务,那么应用内的图片、音频加载,歌曲下载也将走代理
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { setMeta } from '@common/utils/musicMeta'
|
||||
import { mergeLyrics } from './lrcTool'
|
||||
|
||||
export const writeMeta = (filePath: string, meta: Omit<LX.Music.MusicFileMeta, 'lyrics'>, lyricData: { lrc: string, tlrc: string | null, rlrc: string | null }) => {
|
||||
setMeta(filePath, { ...meta, lyrics: mergeLyrics(lyricData.lrc, lyricData.tlrc, lyricData.rlrc) || null })
|
||||
export const writeMeta = (filePath: string, meta: Omit<LX.Music.MusicFileMeta, 'lyrics'>, lyricData: { lrc: string, tlrc: string | null, rlrc: string | null }, proxy?: { host: string, port: number }) => {
|
||||
setMeta(filePath, { ...meta, lyrics: mergeLyrics(lyricData.lrc, lyricData.tlrc, lyricData.rlrc) || null }, proxy)
|
||||
}
|
||||
|
||||
export { saveLrc } from './utils'
|
||||
|
||||
@@ -55,7 +55,7 @@ export const createDownloadTasks = (
|
||||
// }
|
||||
}
|
||||
|
||||
const createTask = async(downloadInfo: LX.Download.ListItem, savePath: string, skipExistFile: boolean) => {
|
||||
const createTask = async(downloadInfo: LX.Download.ListItem, savePath: string, skipExistFile: boolean, proxy?: { host: string, port: number }) => {
|
||||
// console.log('createTask', downloadInfo, savePath)
|
||||
// 开始任务
|
||||
/* commit('onStart', downloadInfo)
|
||||
@@ -103,6 +103,7 @@ const createTask = async(downloadInfo: LX.Download.ListItem, savePath: string, s
|
||||
path: savePath,
|
||||
fileName: downloadInfo.metadata.fileName,
|
||||
method: 'get',
|
||||
proxy,
|
||||
onCompleted() {
|
||||
// if (downloadInfo.progress.progress != '100.00') {
|
||||
// delete.get(downloadInfo.id)?
|
||||
@@ -241,7 +242,7 @@ export const updateUrl = (id: string, url: string) => {
|
||||
})
|
||||
}
|
||||
|
||||
export const startTask = async(downloadInfo: LX.Download.ListItem, savePath: string, skipExistFile: boolean, callback: (action: LX.Download.DownloadTaskActions) => void) => {
|
||||
export const startTask = async(downloadInfo: LX.Download.ListItem, savePath: string, skipExistFile: boolean, callback: (action: LX.Download.DownloadTaskActions) => void, proxy?: { host: string, port: number }) => {
|
||||
await pauseTask(downloadInfo.id)
|
||||
|
||||
tasks.set(downloadInfo.id, downloadInfo)
|
||||
@@ -276,7 +277,7 @@ export const startTask = async(downloadInfo: LX.Download.ListItem, savePath: str
|
||||
// await dispatch('startTask')
|
||||
}
|
||||
} else {
|
||||
await createTask(downloadInfo, savePath, skipExistFile)
|
||||
await createTask(downloadInfo, savePath, skipExistFile, proxy)
|
||||
// await dispatch('handleStartTask', downloadInfo)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user