feat: 添加音质选择 优化灰色歌曲解析

This commit is contained in:
alger
2025-01-06 20:54:42 +08:00
parent fcc47dc0ff
commit 020aca7384
12 changed files with 78 additions and 54 deletions
+1 -26
View File
@@ -54,34 +54,9 @@ export const formatNumber = (num: string | number) => {
return num.toString();
};
const windowData = window as any;
export const getIsMc = () => {
if (!windowData.electron) {
return false;
}
const setData = window.electron.ipcRenderer.sendSync('get-store-value', 'set');
if (setData.isProxy) {
return true;
}
return false;
};
const ProxyUrl = import.meta.env.VITE_API_PROXY;
export const getMusicProxyUrl = (url: string) => {
if (!getIsMc()) {
return url;
}
const PUrl = url.split('').join('+');
return `${ProxyUrl}/mc?url=${PUrl}`;
};
export const getImgUrl = (url: string | undefined, size: string = '') => {
const bdUrl = 'https://image.baidu.com/search/down?url=';
const imgUrl = `${url}?param=${size}`;
if (!getIsMc()) {
return imgUrl;
}
return `${bdUrl}${encodeURIComponent(imgUrl)}`;
return imgUrl;
};
export const isMobile = computed(() => {
+3 -1
View File
@@ -44,7 +44,9 @@ request.interceptors.request.use(
};
const token = localStorage.getItem('token');
if (token) {
config.params.cookie = token;
config.params.cookie = token + ' os=pc;';
}else{
config.params.cookie = 'os=pc;';
}
}