mirror of
https://github.com/imsyy/SPlayer.git
synced 2025-11-25 11:29:26 +08:00
@@ -57,6 +57,8 @@ const useSiteSettingsStore = defineStore("siteSettings", {
|
|||||||
downloadCover: true, // 同时下载封面
|
downloadCover: true, // 同时下载封面
|
||||||
downloadLyrics: true, // 同时下载歌词
|
downloadLyrics: true, // 同时下载歌词
|
||||||
// 网络部分
|
// 网络部分
|
||||||
|
useRealIP: true, // 是否使用真实IP地址
|
||||||
|
realIP: "116.25.146.177", // 真实IP地址
|
||||||
proxyProtocol: "off", // 代理协议
|
proxyProtocol: "off", // 代理协议
|
||||||
proxyServe: "127.0.0.1", // 代理地址
|
proxyServe: "127.0.0.1", // 代理地址
|
||||||
proxyPort: 80, // 代理端口
|
proxyPort: 80, // 代理端口
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { checkPlatform } from "@/utils/helper";
|
import { checkPlatform } from "@/utils/helper";
|
||||||
import { getCookie, isLogin } from "@/utils/auth";
|
import { getCookie, isLogin } from "@/utils/auth";
|
||||||
|
import { siteSettings } from "@/stores";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
|
||||||
// 全局地址
|
// 全局地址
|
||||||
@@ -16,6 +17,7 @@ axios.defaults.withCredentials = true;
|
|||||||
// 请求拦截
|
// 请求拦截
|
||||||
axios.interceptors.request.use(
|
axios.interceptors.request.use(
|
||||||
(request) => {
|
(request) => {
|
||||||
|
const settings = siteSettings();
|
||||||
if (!request.params) request.params = {};
|
if (!request.params) request.params = {};
|
||||||
// 附加 cookie
|
// 附加 cookie
|
||||||
if (!request.noCookie && (isLogin() || getCookie("MUSIC_U") !== null)) {
|
if (!request.noCookie && (isLogin() || getCookie("MUSIC_U") !== null)) {
|
||||||
@@ -26,7 +28,9 @@ axios.interceptors.request.use(
|
|||||||
request.params.noCookie = true;
|
request.params.noCookie = true;
|
||||||
}
|
}
|
||||||
// 附加 realIP
|
// 附加 realIP
|
||||||
if (!checkPlatform.electron()) request.params.realIP = "116.25.146.177";
|
if (settings.useRealIP) {
|
||||||
|
request.params.realIP = settings.realIP || "116.25.146.177";
|
||||||
|
}
|
||||||
// 附加代理
|
// 附加代理
|
||||||
const proxy = JSON.parse(localStorage.getItem("siteSettings")).proxyProtocol;
|
const proxy = JSON.parse(localStorage.getItem("siteSettings")).proxyProtocol;
|
||||||
if (proxy !== "off") {
|
if (proxy !== "off") {
|
||||||
|
|||||||
@@ -1,6 +1,30 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="set-type">
|
<div class="set-type">
|
||||||
<n-h3 prefix="bar"> 其他 </n-h3>
|
<n-h3 prefix="bar"> 其他 </n-h3>
|
||||||
|
<n-card class="set-item">
|
||||||
|
<div class="name">
|
||||||
|
使用真实 IP 地址
|
||||||
|
<n-text class="tip">在海外或部分地区可能会受到限制,可开启此处尝试解决</n-text>
|
||||||
|
</div>
|
||||||
|
<n-switch v-model:value="useRealIP" :round="false" />
|
||||||
|
</n-card>
|
||||||
|
<n-card class="set-item">
|
||||||
|
<div class="name">
|
||||||
|
真实 IP 地址
|
||||||
|
<n-text class="tip">可在此处输入国内 IP</n-text>
|
||||||
|
</div>
|
||||||
|
<n-input
|
||||||
|
v-model:value="realIP"
|
||||||
|
:disabled="!useRealIP"
|
||||||
|
class="set"
|
||||||
|
type="text"
|
||||||
|
placeholder="请填写真实 IP 地址"
|
||||||
|
>
|
||||||
|
<template #prefix>
|
||||||
|
<n-text depth="3">IP</n-text>
|
||||||
|
</template>
|
||||||
|
</n-input>
|
||||||
|
</n-card>
|
||||||
<div v-if="checkPlatform.electron()" class="all-porxy" style="margin-bottom: 12px">
|
<div v-if="checkPlatform.electron()" class="all-porxy" style="margin-bottom: 12px">
|
||||||
<n-card class="set-item">
|
<n-card class="set-item">
|
||||||
<div class="name">
|
<div class="name">
|
||||||
@@ -111,7 +135,7 @@ import { checkPlatform } from "@/utils/helper";
|
|||||||
import debounce from "@/utils/debounce";
|
import debounce from "@/utils/debounce";
|
||||||
|
|
||||||
const settings = siteSettings();
|
const settings = siteSettings();
|
||||||
const { themeAuto, loadSize, showGithub, proxyProtocol, proxyServe, proxyPort } =
|
const { themeAuto, loadSize, showGithub, proxyProtocol, proxyServe, proxyPort, useRealIP, realIP } =
|
||||||
storeToRefs(settings);
|
storeToRefs(settings);
|
||||||
|
|
||||||
// 程序重置
|
// 程序重置
|
||||||
|
|||||||
Reference in New Issue
Block a user