feat: add domain and external ip configuration items (#18)

This commit is contained in:
Li4n0
2021-05-22 20:40:04 +08:00
committed by GitHub
parent bc6e3962f8
commit 1144f67d37
55 changed files with 228 additions and 143 deletions
+5 -3
View File
@@ -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
-6
View File
@@ -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
}
})
}
+4
View File
@@ -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 // 默认的
}
})
+4 -4
View File
@@ -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
})
+1 -1
View File
@@ -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>
+8 -6
View File
@@ -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
});
})
},
},
+8 -6
View File
@@ -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
});
})
},
},
+8 -6
View File
@@ -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
});
})
},
},
+8 -6
View File
@@ -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
});
})
},
},
+8 -6
View File
@@ -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
});
})
},
},
+1 -6
View File
@@ -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) {
+2 -7
View File
@@ -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) {
+1 -6
View File
@@ -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) {
+1 -6
View File
@@ -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) {
+1 -6
View File
@@ -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) {
+4 -4
View File
@@ -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) {
+12 -8
View File
@@ -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,