mirror of
https://github.com/Li4n0/revsuit.git
synced 2026-09-25 08:01:54 +08:00
feat: add domain and external ip configuration items (#18)
This commit is contained in:
@@ -179,7 +179,6 @@ export default {
|
||||
} else {
|
||||
this.timing()
|
||||
}
|
||||
localStorage.setItem('autoRefresh', val)
|
||||
},
|
||||
refreshInterval(val) {
|
||||
clearInterval(this.timer)
|
||||
@@ -193,8 +192,11 @@ export default {
|
||||
store.pageSize = val
|
||||
localStorage.setItem('pageSize', val)
|
||||
},
|
||||
'store.authed'() {
|
||||
this.$refs.content.fetch()
|
||||
'store.authed'(val) {
|
||||
if (val) {
|
||||
this.$refs.content.fetch()
|
||||
this.GetVersion()
|
||||
}
|
||||
},
|
||||
'store.pageSize'() {
|
||||
this.$refs.content.pagination.pageSize = store.pageSize
|
||||
|
||||
@@ -5,9 +5,6 @@ export function auth(token) {
|
||||
url: '/auth',
|
||||
method: 'get',
|
||||
headers: {"Token": token},
|
||||
validateStatus: function (status) {
|
||||
return status >= 200 && status < 300
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -15,8 +12,5 @@ export function getVersion() {
|
||||
return request({
|
||||
url: '/version',
|
||||
method: 'get',
|
||||
validateStatus: function (status) {
|
||||
return status >= 200 && status < 300
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -1,9 +1,13 @@
|
||||
import axios from 'axios'
|
||||
import {store} from "@/main";
|
||||
|
||||
const service = axios.create({
|
||||
baseURL: '/revsuit/api/', // api的base_url
|
||||
timeout: 5000, // request timeout
|
||||
validateStatus: function (status) {
|
||||
if (status === 403) {
|
||||
store.authed = false
|
||||
}
|
||||
return status >= 200 && status < 300 // 默认的
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import request from './index'
|
||||
|
||||
export function getHttpConfig() {
|
||||
export function getPlatformConfig() {
|
||||
return request({
|
||||
url: '/setting/getHttpConfig',
|
||||
url: '/setting/getPlatformConfig',
|
||||
})
|
||||
}
|
||||
|
||||
export function updateHttpConfig(data) {
|
||||
export function updatePlatformConfig(data) {
|
||||
return request({
|
||||
url: '/setting/updateHttpConfig',
|
||||
url: '/setting/updatePlatformConfig',
|
||||
method: "post",
|
||||
data: data
|
||||
})
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<a-input
|
||||
v-model="form.flag_format"
|
||||
style="width: 100%"
|
||||
placeholder="please enter flag format"
|
||||
placeholder="Please enter flag format"
|
||||
:readOnly="readOnly"
|
||||
/>
|
||||
</a-form-model-item>
|
||||
|
||||
@@ -139,12 +139,14 @@ export default {
|
||||
this.pagination = pagination;
|
||||
this.loading = false
|
||||
}).catch(e => {
|
||||
if (e.response.status === 403) {
|
||||
store.authed = false
|
||||
return []
|
||||
} else {
|
||||
console.error(e)
|
||||
}
|
||||
this.$notification.error({
|
||||
message: 'Unknown error: ' + e.response.status,
|
||||
style: {
|
||||
width: '100px',
|
||||
marginLeft: `${335 - 600}px`,
|
||||
},
|
||||
duration: 4
|
||||
});
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
@@ -228,12 +228,14 @@ export default {
|
||||
this.pagination = pagination;
|
||||
this.loading = false
|
||||
}).catch(e => {
|
||||
if (e.response.status === 403) {
|
||||
store.authed = false
|
||||
return []
|
||||
} else {
|
||||
console.error(e)
|
||||
}
|
||||
this.$notification.error({
|
||||
message: 'Unknown error: ' + e.response.status,
|
||||
style: {
|
||||
width: '100px',
|
||||
marginLeft: `${335 - 600}px`,
|
||||
},
|
||||
duration: 4
|
||||
});
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
@@ -173,12 +173,14 @@ export default {
|
||||
this.pagination = pagination;
|
||||
this.loading = false
|
||||
}).catch(e => {
|
||||
if (e.response.status === 403) {
|
||||
store.authed = false
|
||||
return []
|
||||
} else {
|
||||
console.error(e)
|
||||
}
|
||||
this.$notification.error({
|
||||
message: 'Unknown error: ' + e.response.status,
|
||||
style: {
|
||||
width: '100px',
|
||||
marginLeft: `${335 - 600}px`,
|
||||
},
|
||||
duration: 4
|
||||
});
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
@@ -216,12 +216,14 @@ export default {
|
||||
this.pagination = pagination;
|
||||
this.loading = false
|
||||
}).catch(e => {
|
||||
if (e.response.status === 403) {
|
||||
store.authed = false
|
||||
return []
|
||||
} else {
|
||||
console.error(e)
|
||||
}
|
||||
this.$notification.error({
|
||||
message: 'Unknown error: ' + e.response.status,
|
||||
style: {
|
||||
width: '100px',
|
||||
marginLeft: `${335 - 600}px`,
|
||||
},
|
||||
duration: 4
|
||||
});
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
@@ -140,12 +140,14 @@ export default {
|
||||
this.pagination = pagination;
|
||||
this.loading = false
|
||||
}).catch(e => {
|
||||
if (e.response.status === 403) {
|
||||
store.authed = false
|
||||
return []
|
||||
} else {
|
||||
console.error(e)
|
||||
}
|
||||
this.$notification.error({
|
||||
message: 'Unknown error: ' + e.response.status,
|
||||
style: {
|
||||
width: '100px',
|
||||
marginLeft: `${335 - 600}px`,
|
||||
},
|
||||
duration: 4
|
||||
});
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
@@ -332,11 +332,7 @@ export default {
|
||||
this.pagination = pagination;
|
||||
this.loading = false
|
||||
}).catch(e => {
|
||||
if (e.response.status === 403) {
|
||||
store.authed = false
|
||||
return []
|
||||
} else {
|
||||
this.$notification.error({
|
||||
this.$notification.error({
|
||||
message: 'Unknown error: ' + e.response.status,
|
||||
style: {
|
||||
width: '100px',
|
||||
@@ -344,7 +340,6 @@ export default {
|
||||
},
|
||||
duration: 4
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
clickSwitch(record, prop) {
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<a-input
|
||||
v-model="form.pasv_address"
|
||||
style="width: 100%"
|
||||
placeholder="use default value in the config"
|
||||
placeholder="Use external IP by default"
|
||||
:readOnly="formReadOnly"
|
||||
/>
|
||||
</a-form-model-item>
|
||||
@@ -267,11 +267,7 @@ export default {
|
||||
this.pagination = pagination;
|
||||
this.loading = false
|
||||
}).catch(e => {
|
||||
if (e.response.status === 403) {
|
||||
store.authed = false
|
||||
return []
|
||||
} else {
|
||||
this.$notification.error({
|
||||
this.$notification.error({
|
||||
message: 'Unknown error: ' + e.response.status,
|
||||
style: {
|
||||
width: '100px',
|
||||
@@ -279,7 +275,6 @@ export default {
|
||||
},
|
||||
duration: 4
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
clickSwitch(record, prop) {
|
||||
|
||||
@@ -374,11 +374,7 @@ export default {
|
||||
this.pagination = pagination;
|
||||
this.loading = false
|
||||
}).catch(e => {
|
||||
if (e.response.status === 403) {
|
||||
store.authed = false
|
||||
return []
|
||||
} else {
|
||||
this.$notification.error({
|
||||
this.$notification.error({
|
||||
message: 'Unknown error: ' + e.response.status,
|
||||
style: {
|
||||
width: '100px',
|
||||
@@ -386,7 +382,6 @@ export default {
|
||||
},
|
||||
duration: 4
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
clickSwitch(record, prop) {
|
||||
|
||||
@@ -297,11 +297,7 @@ export default {
|
||||
this.pagination = pagination;
|
||||
this.loading = false
|
||||
}).catch(e => {
|
||||
if (e.response.status === 403) {
|
||||
store.authed = false
|
||||
return []
|
||||
} else {
|
||||
this.$notification.error({
|
||||
this.$notification.error({
|
||||
message: 'Unknown error: ' + e.response.status,
|
||||
style: {
|
||||
width: '100px',
|
||||
@@ -309,7 +305,6 @@ export default {
|
||||
},
|
||||
duration: 4
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
clickSwitch(record, prop) {
|
||||
|
||||
@@ -225,11 +225,7 @@ export default {
|
||||
this.pagination = pagination;
|
||||
this.loading = false
|
||||
}).catch(e => {
|
||||
if (e.response.status === 403) {
|
||||
store.authed = false
|
||||
return []
|
||||
} else {
|
||||
this.$notification.error({
|
||||
this.$notification.error({
|
||||
message: 'Unknown error: ' + e.response.status,
|
||||
style: {
|
||||
width: '100px',
|
||||
@@ -237,7 +233,6 @@ export default {
|
||||
},
|
||||
duration: 4
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
clickSwitch(record, prop) {
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getHttpConfig, updateHttpConfig} from "@/api/settings"
|
||||
import {getPlatformConfig, updatePlatformConfig} from "@/api/settings"
|
||||
import SettingForm from "@/components/SettingForm";
|
||||
|
||||
export default {
|
||||
@@ -37,7 +37,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
getConfig() {
|
||||
getHttpConfig().then(res => {
|
||||
getPlatformConfig().then(res => {
|
||||
this.form = res.data
|
||||
}).catch(e => {
|
||||
this.$notification.error({
|
||||
@@ -55,10 +55,10 @@ export default {
|
||||
updateConfig() {
|
||||
this.spinning = true
|
||||
let targetConfig = JSON.stringify(this.form)
|
||||
updateHttpConfig(this.form).then(
|
||||
updatePlatformConfig(this.form).then(
|
||||
() => {
|
||||
setTimeout(() => {
|
||||
getHttpConfig().then((res) => {
|
||||
getPlatformConfig().then((res) => {
|
||||
this.spinning = false
|
||||
let nowConfig = JSON.stringify(res.data)
|
||||
if (nowConfig !== targetConfig) {
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
:active-tab-key="tabKey"
|
||||
@tabChange="key => this.tabKey = key"
|
||||
style="width: 100%;">
|
||||
<http v-if="tabKey==='HTTP'"></http>
|
||||
<dns v-else-if="tabKey==='DNS'"></dns>
|
||||
<rmi v-else-if="tabKey==='RMI'"></rmi>
|
||||
<mysql v-else-if="tabKey==='MYSQL'"></mysql>
|
||||
<ftp v-else-if="tabKey==='FTP'"></ftp>
|
||||
<notice v-else-if="tabKey==='NOTICE'"></notice>
|
||||
<rules v-else-if="tabKey==='RULES'"></rules>
|
||||
<http ref="settings" v-if="tabKey==='HTTP'"></http>
|
||||
<dns ref="settings" v-else-if="tabKey==='DNS'"></dns>
|
||||
<rmi ref="settings" v-else-if="tabKey==='RMI'"></rmi>
|
||||
<mysql ref="settings" v-else-if="tabKey==='MYSQL'"></mysql>
|
||||
<ftp ref="settings" v-else-if="tabKey==='FTP'"></ftp>
|
||||
<notice ref="settings" v-else-if="tabKey==='NOTICE'"></notice>
|
||||
<rules ref="settings" v-else-if="tabKey==='RULES'"></rules>
|
||||
</a-card>
|
||||
</div>
|
||||
</template>
|
||||
@@ -42,7 +42,11 @@ export default {
|
||||
}
|
||||
}
|
||||
,
|
||||
methods: {},
|
||||
methods: {
|
||||
fetch() {
|
||||
this.$refs.settings.getConfig();
|
||||
}
|
||||
},
|
||||
components: {
|
||||
Http,
|
||||
Dns,
|
||||
|
||||
Reference in New Issue
Block a user