mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-15 20:58:01 +00:00
feat: add RealIP setting
This commit is contained in:
parent
481ba6bce3
commit
adafffd86b
3 changed files with 58 additions and 0 deletions
|
|
@ -36,6 +36,8 @@ let localStorage = {
|
|||
server: '',
|
||||
port: null,
|
||||
},
|
||||
enableRealIP: false,
|
||||
realIP: null,
|
||||
shortcuts: shortcuts,
|
||||
},
|
||||
data: {
|
||||
|
|
|
|||
|
|
@ -38,8 +38,15 @@ service.interceptors.request.use(function (config) {
|
|||
config.params.realIP = '211.161.244.70';
|
||||
}
|
||||
|
||||
// Force real_ip
|
||||
const enableRealIP = JSON.parse(
|
||||
localStorage.getItem('settings')
|
||||
).enableRealIP;
|
||||
const realIP = JSON.parse(localStorage.getItem('settings')).realIP;
|
||||
if (process.env.VUE_APP_REAL_IP) {
|
||||
config.params.realIP = process.env.VUE_APP_REAL_IP;
|
||||
} else if (enableRealIP) {
|
||||
config.params.realIP = realIP;
|
||||
}
|
||||
|
||||
const proxy = JSON.parse(localStorage.getItem('settings')).proxyConfig;
|
||||
|
|
|
|||
|
|
@ -641,6 +641,33 @@
|
|||
<button @click="sendProxyConfig">更新代理</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="isElectron">
|
||||
<h3>Real IP</h3>
|
||||
<div class="item">
|
||||
<div class="left">
|
||||
<div class="title"> Real IP </div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<div class="toggle">
|
||||
<input
|
||||
id="enable-real-ip"
|
||||
v-model="enableRealIP"
|
||||
type="checkbox"
|
||||
name="enable-real-ip"
|
||||
/>
|
||||
<label for="enable-real-ip"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="real-ip" :class="{ disabled: !enableRealIP }">
|
||||
<input
|
||||
v-model="realIP"
|
||||
class="text-input"
|
||||
placeholder="IP地址"
|
||||
:disabled="!enableRealIP"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="isElectron">
|
||||
<h3>快捷键</h3>
|
||||
|
|
@ -1124,6 +1151,28 @@ export default {
|
|||
});
|
||||
},
|
||||
},
|
||||
enableRealIP: {
|
||||
get() {
|
||||
return this.settings.enableRealIP || false;
|
||||
},
|
||||
set(value) {
|
||||
this.$store.commit('updateSettings', {
|
||||
key: 'enableRealIP',
|
||||
value: value,
|
||||
});
|
||||
},
|
||||
},
|
||||
realIP: {
|
||||
get() {
|
||||
return this.settings.realIP || '';
|
||||
},
|
||||
set(value) {
|
||||
this.$store.commit('updateSettings', {
|
||||
key: 'realIP',
|
||||
value: value,
|
||||
});
|
||||
},
|
||||
},
|
||||
proxyPort: {
|
||||
get() {
|
||||
return this.settings.proxyConfig?.port || '';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue