diff options
| author | MHSanaei <mc.sanaei@gmail.com> | 2023-02-09 22:18:06 +0300 |
|---|---|---|
| committer | MHSanaei <mc.sanaei@gmail.com> | 2023-02-09 22:18:06 +0300 |
| commit | b73e4173a3c1e69e02ad6b4e3b43e425e57a5be9 (patch) | |
| tree | d95d2f5e903d97082e11eb9f9023c165b1bde388 /web/html/xui/setting.html | |
3x-ui
Diffstat (limited to 'web/html/xui/setting.html')
| -rw-r--r-- | web/html/xui/setting.html | 196 |
1 files changed, 196 insertions, 0 deletions
diff --git a/web/html/xui/setting.html b/web/html/xui/setting.html new file mode 100644 index 00000000..67ceaff9 --- /dev/null +++ b/web/html/xui/setting.html @@ -0,0 +1,196 @@ +<!DOCTYPE html> +<html lang="en"> +{{template "head" .}} +<style> + @media (min-width: 769px) { + .ant-layout-content { + margin: 24px 16px; + } + } + + .ant-col-sm-24 { + margin-top: 10px; + } + + .ant-tabs-bar { + margin: 0; + } + + .ant-list-item { + display: block; + } + + .ant-tabs-top-bar { + background: white; + } +</style> +<body> +<a-layout id="app" v-cloak> + {{ template "commonSider" . }} + <a-layout id="content-layout"> + <a-layout-content> + <a-spin :spinning="spinning" :delay="500" tip="loading"> + <a-space direction="vertical"> + <a-space direction="horizontal"> + <a-button type="primary" :disabled="saveBtnDisable" @click="updateAllSetting">{{ i18n "pages.setting.save" }}</a-button> + <a-button type="danger" :disabled="!saveBtnDisable" @click="restartPanel">{{ i18n "pages.setting.restartPanel" }}</a-button> + </a-space> + <a-tabs default-active-key="1"> + <a-tab-pane key="1" tab='{{ i18n "pages.setting.panelConfig"}}'> + + <a-list item-layout="horizontal" style="background: white"> + <setting-list-item type="text" title='{{ i18n "pages.setting.panelListeningIP"}}' desc='{{ i18n "pages.setting.panelListeningIPDesc"}}' v-model="allSetting.webListen"></setting-list-item> + <setting-list-item type="number" title='{{ i18n "pages.setting.panelPort"}}' desc='{{ i18n "pages.setting.panelPortDesc"}}' v-model.number="allSetting.webPort"></setting-list-item> + <setting-list-item type="text" title='{{ i18n "pages.setting.publicKeyPath"}}' desc='{{ i18n "pages.setting.publicKeyPathDesc"}}' v-model="allSetting.webCertFile"></setting-list-item> + <setting-list-item type="text" title='{{ i18n "pages.setting.privateKeyPath"}}' desc='{{ i18n "pages.setting.privateKeyPathDesc"}}' v-model="allSetting.webKeyFile"></setting-list-item> + <setting-list-item type="text" title='{{ i18n "pages.setting.panelUrlPath"}}' desc='{{ i18n "pages.setting.panelUrlPathDesc"}}' v-model="allSetting.webBasePath"></setting-list-item> + <a-list-item> + <a-row style="padding: 20px"> + <a-col :lg="24" :xl="12"> + <a-list-item-meta title="Language"/> + </a-col> + + <a-col :lg="24" :xl="12"> + <temlate> + <a-select + ref="selectLang" + v-model="lang" + @change="setLang(lang)" + style="width: 100%" + > + <a-select-option :value="l.value" label="China" v-for="l in supportLangs" > + <span role="img" aria-label="l.name" v-text="l.icon"></span> + <span v-text="l.name"></span> + </a-select-option> + </a-select> + </temlate> + </a-col> + </a-row> + + </a-list-item> + </a-list> + </a-tab-pane> + <a-tab-pane key="2" tab='{{ i18n "pages.setting.userSetting"}}'> + <a-form style="background: white; padding: 20px"> + <a-form-item label='{{ i18n "pages.setting.oldUsername"}}'> + <a-input v-model="user.oldUsername" style="max-width: 300px"></a-input> + </a-form-item> + <a-form-item label='{{ i18n "pages.setting.currentPassword"}}'> + <a-input type="password" v-model="user.oldPassword" + style="max-width: 300px"></a-input> + </a-form-item> + <a-form-item label='{{ i18n "pages.setting.newUsername"}}'> + <a-input v-model="user.newUsername" style="max-width: 300px"></a-input> + </a-form-item> + <a-form-item label='{{ i18n "pages.setting.newPassword"}}'> + <a-input type="password" v-model="user.newPassword" + style="max-width: 300px"></a-input> + </a-form-item> + <a-form-item> +<!-- <a-button type="primary" @click="updateUser">update</a-button>--> + <a-button type="primary" @click="updateUser">{{ i18n "confirm" }}</a-button> + </a-form-item> + </a-form> + </a-tab-pane> + <a-tab-pane key="3" tab='{{ i18n "pages.setting.xrayConfiguration"}}'> + <a-list item-layout="horizontal" style="background: white"> + <setting-list-item type="textarea" title='{{ i18n "pages.setting.xrayConfigTemplate"}}' desc='{{ i18n "pages.setting.xrayConfigTemplateDesc"}}' v-model="allSetting.xrayTemplateConfig"></setting-list-item> + </a-list> + </a-tab-pane> + <a-tab-pane key="4" tab='{{ i18n "pages.setting.TGReminder"}}'> + <a-list item-layout="horizontal" style="background: white"> + <setting-list-item type="switch" title='{{ i18n "pages.setting.telegramBotEnable" }}' desc='{{ i18n "pages.setting.telegramBotEnableDesc" }}' v-model="allSetting.tgBotEnable"></setting-list-item> + <setting-list-item type="text" title='{{ i18n "pages.setting.telegramToken"}}' desc='{{ i18n "pages.setting.telegramTokenDesc"}}' v-model="allSetting.tgBotToken"></setting-list-item> + <setting-list-item type="number" title='{{ i18n "pages.setting.telegramChatId"}}' desc='{{ i18n "pages.setting.telegramChatIdDesc"}}' v-model.number="allSetting.tgBotChatId"></setting-list-item> + <setting-list-item type="text" title='{{ i18n "pages.setting.telegramNotifyTime"}}' desc='{{ i18n "pages.setting.telegramNotifyTimeDesc"}}' v-model="allSetting.tgRunTime"></setting-list-item> + </a-list> + </a-tab-pane> + <a-tab-pane key="5" tab='{{ i18n "pages.setting.otherSetting"}}'> + <a-list item-layout="horizontal" style="background: white"> + <setting-list-item type="text" title='{{ i18n "pages.setting.timeZonee"}}' desc='{{ i18n "pages.setting.timeZoneDesc"}}' v-model="allSetting.timeLocation"></setting-list-item> + </a-list> + </a-tab-pane> + </a-tabs> + </a-space> + </a-spin> + </a-layout-content> + </a-layout> +</a-layout> +{{template "js" .}} +{{template "component/setting"}} +<script> + + const app = new Vue({ + delimiters: ['[[', ']]'], + el: '#app', + data: { + siderDrawer, + spinning: false, + oldAllSetting: new AllSetting(), + allSetting: new AllSetting(), + saveBtnDisable: true, + user: {}, + lang : getLang() + }, + methods: { + loading(spinning = true) { + this.spinning = spinning; + }, + async getAllSetting() { + this.loading(true); + const msg = await HttpUtil.post("/xui/setting/all"); + this.loading(false); + if (msg.success) { + this.oldAllSetting = new AllSetting(msg.obj); + this.allSetting = new AllSetting(msg.obj); + this.saveBtnDisable = true; + } + }, + async updateAllSetting() { + this.loading(true); + const msg = await HttpUtil.post("/xui/setting/update", this.allSetting); + this.loading(false); + if (msg.success) { + await this.getAllSetting(); + } + }, + async updateUser() { + this.loading(true); + const msg = await HttpUtil.post("/xui/setting/updateUser", this.user); + this.loading(false); + if (msg.success) { + this.user = {}; + } + }, + async restartPanel() { + await new Promise(resolve => { + this.$confirm({ + title: '{{ i18n "pages.setting.restartPanel" }}', + content: '{{ i18n "pages.setting.restartPanelDesc" }}', + okText: '{{ i18n "sure" }}', + cancelText: '{{ i18n "cancel" }}', + onOk: () => resolve(), + }); + }); + this.loading(true); + const msg = await HttpUtil.post("/xui/setting/restartPanel"); + this.loading(false); + if (msg.success) { + this.loading(true); + await PromiseUtil.sleep(5000); + location.reload(); + } + } + }, + async mounted() { + await this.getAllSetting(); + while (true) { + await PromiseUtil.sleep(1000); + this.saveBtnDisable = this.oldAllSetting.equals(this.allSetting); + } + }, + }); + +</script> +</body> +</html>
\ No newline at end of file |
