123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- <!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>
|