diff --git a/publish/changeLog.md b/publish/changeLog.md
index 79a3af23..4dcebf75 100644
--- a/publish/changeLog.md
+++ b/publish/changeLog.md
@@ -1,3 +1,7 @@
+### 新增
+
+- 新增代理功能
+
### 优化
- 优化从《梦里嫦娥》皮肤切换到其他皮肤时侧栏动画的切换效果
diff --git a/src/renderer/App.vue b/src/renderer/App.vue
index fb9ac101..22b7dffe 100644
--- a/src/renderer/App.vue
+++ b/src/renderer/App.vue
@@ -35,7 +35,10 @@ export default {
isProd: process.env.NODE_ENV === 'production',
isLinux,
globalObj: {
- apiSource: 'messoer',
+ apiSource: 'test',
+ proxy: {
+
+ },
},
updateTimeout: null,
}
@@ -129,6 +132,7 @@ export default {
this.initData()
this.globalObj.apiSource = this.setting.apiSource
+ this.globalObj.proxy = this.setting.network.proxy
window.globalObj = this.globalObj
},
enableIgnoreMouseEvents() {
diff --git a/src/renderer/components/material/Input.vue b/src/renderer/components/material/Input.vue
new file mode 100644
index 00000000..f3779718
--- /dev/null
+++ b/src/renderer/components/material/Input.vue
@@ -0,0 +1,86 @@
+
+ input(:class="$style.input" :placeholder="placeholder" v-model.trim="text" :disabled="disabled"
+ @focus="$emit('focus', $event)" @blur="$emit('blur', $event)" @input="$emit('input', text)" @change="$emit('change', text)"
+ @keyup.enter="submit")
+
+
+
+
+
+
diff --git a/src/renderer/utils/index.js b/src/renderer/utils/index.js
index ed17f3dd..5078b343 100644
--- a/src/renderer/utils/index.js
+++ b/src/renderer/utils/index.js
@@ -163,7 +163,7 @@ export const isChildren = (parent, children) => {
* @param {*} setting
*/
export const updateSetting = setting => {
- const defaultVersion = '1.0.7'
+ const defaultVersion = '1.0.8'
const defaultSetting = {
version: defaultVersion,
player: {
@@ -197,6 +197,15 @@ export const updateSetting = setting => {
odc: {
isAutoClearSearchInput: false,
},
+ network: {
+ proxy: {
+ enable: false,
+ host: '',
+ port: '',
+ username: '',
+ password: '',
+ },
+ },
themeId: 0,
sourceId: 'kw',
apiSource: 'test',
diff --git a/src/renderer/utils/request.js b/src/renderer/utils/request.js
index ef976b85..510d43f4 100644
--- a/src/renderer/utils/request.js
+++ b/src/renderer/utils/request.js
@@ -8,6 +8,8 @@ import { bHh } from './music/options'
const headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36',
}
+// var proxyUrl = "http://" + user + ":" + password + "@" + host + ":" + port;
+// var proxiedRequest = request.defaults({'proxy': proxyUrl});
/**
* promise 形式的请求方法
@@ -215,6 +217,12 @@ export const http_jsonp = (url, options, callback) => {
})
}
+const getProxyInfo = () => {
+ return window.globalObj.proxy.enable
+ ? `http://${window.globalObj.proxy.username}:${window.globalObj.proxy.password}@${window.globalObj.proxy.host}:${window.globalObj.proxy.port};`
+ : undefined
+}
+
const fatchData = (url, method, options, callback) => {
// console.log(url, options)
console.log('---start---', url)
@@ -233,6 +241,7 @@ const fatchData = (url, method, options, callback) => {
form: options.form,
formData: options.formData,
timeout: options.timeout || 10000,
+ proxy: getProxyInfo(),
json: options.format === undefined || options.format === 'json',
}, (err, resp, body) => {
if (err) return callback(err, null)
diff --git a/src/renderer/views/Setting.vue b/src/renderer/views/Setting.vue
index 04838050..b7d57644 100644
--- a/src/renderer/views/Setting.vue
+++ b/src/renderer/views/Setting.vue
@@ -62,6 +62,18 @@ div.scroll(:class="$style.setting")
h3 专辑栏
div
material-checkbox(id="setting_list_showalbum" v-model="current_setting.list.isShowAlbumName" label="是否显示专辑栏")
+ dt 网络设置
+ dd
+ h3 代理设置
+ div
+ p
+ material-checkbox(id="setting_network_proxy_enable" v-model="current_setting.network.proxy.enable" @change="handleProxyChange('enabel')" label="是否启用")
+ p
+ material-input(:class="$style.gapLeft" v-model="current_setting.network.proxy.host" @change="handleProxyChange('host')" placeholder="主机")
+ material-input(:class="$style.gapLeft" v-model="current_setting.network.proxy.port" @change="handleProxyChange('port')" placeholder="端口")
+ p
+ material-input(:class="$style.gapLeft" v-model="current_setting.network.proxy.username" @change="handleProxyChange('username')" placeholder="用户名")
+ material-input(:class="$style.gapLeft" v-model="current_setting.network.proxy.password" @change="handleProxyChange('password')" placeholder="密码")
dt 强迫症设置
dd
h3 离开搜索界面时清空搜索框
@@ -169,6 +181,15 @@ export default {
isDownloadLrc: false,
isEmbedPic: true,
},
+ network: {
+ proxy: {
+ enable: false,
+ host: '',
+ port: '',
+ username: '',
+ password: '',
+ },
+ },
odc: {
isAutoClearSearchInput: false,
},
@@ -416,6 +437,9 @@ export default {
clipboardWriteText(text) {
clipboardWriteText(text)
},
+ handleProxyChange(key) {
+ window.globalObj.proxy[key] = this.current_setting.network.proxy[key]
+ },
openRewardModal() {
},