diff options
| author | Alireza Ahmadi <alireza7@gmail.com> | 2023-12-04 21:17:38 +0300 |
|---|---|---|
| committer | Alireza Ahmadi <alireza7@gmail.com> | 2023-12-04 21:18:53 +0300 |
| commit | 729d8549e2b536a10c402a88e0d4cfde9e4baf3f (patch) | |
| tree | d108e2f29516766318ac89e4ee86c719eb14c1a3 /web/html/xui/settings.html | |
| parent | f734c821d6e62eca5a206b6048f3cd7d65f3e665 (diff) | |
new frontend and mobile view #1286
Diffstat (limited to 'web/html/xui/settings.html')
| -rw-r--r-- | web/html/xui/settings.html | 825 |
1 files changed, 39 insertions, 786 deletions
diff --git a/web/html/xui/settings.html b/web/html/xui/settings.html index 1f3b0ebb..7c4fef16 100644 --- a/web/html/xui/settings.html +++ b/web/html/xui/settings.html @@ -8,8 +8,11 @@ } } - .ant-col-sm-24 { - margin-top: 10px; + @media (max-width: 768px) { + .ant-tabs-nav .ant-tabs-tab { + margin: 0; + padding: 12px .5rem; + } } .ant-tabs-bar { @@ -20,10 +23,6 @@ display: block; } - :not(.ant-card-dark)>.ant-tabs-top-bar { - background: white; - } - .alert-msg { color: rgb(194, 117, 18); font-weight: normal; @@ -71,25 +70,31 @@ } </style> <body> -<a-layout id="app" v-cloak> +<a-layout id="app" v-cloak :class="themeSwitcher.currentTheme"> {{ template "commonSider" . }} - <a-layout id="content-layout" :style="themeSwitcher.bgStyle"> + <a-layout id="content-layout"> <a-layout-content> - <a-spin :spinning="spinning" :delay="500" tip="loading"> + <a-spin :spinning="spinning" :delay="500" tip='{{ i18n "loading"}}'> <a-space direction="vertical"> - <a-space direction="horizontal"> - <a-button type="primary" :disabled="saveBtnDisable" @click="updateAllSetting">{{ i18n "pages.settings.save" }}</a-button> - <a-button type="danger" :disabled="!saveBtnDisable" @click="restartPanel">{{ i18n "pages.settings.restartPanel" }}</a-button> - </a-space> - <a-tabs style="margin:1rem 0.5rem;" default-active-key="1" :class="themeSwitcher.darkCardClass"> + <a-card hoverable style="margin-bottom: .5rem;"> + <a-row> + <a-col :xs="24" :sm="8" style="padding: 4px;"> + <a-space direction="horizontal"> + <a-button type="primary" :disabled="saveBtnDisable" @click="updateAllSetting">{{ i18n "pages.settings.save" }}</a-button> + <a-button type="danger" :disabled="!saveBtnDisable" @click="restartPanel">{{ i18n "pages.settings.restartPanel" }}</a-button> + </a-space> + </a-col> + <a-col :xs="24" :sm="16"> + <a-alert type="warning" style="float: right; width: fit-content" + message='{{ i18n "pages.settings.infoDesc" }}' + show-icon + > + </a-col> + </a-row> + </a-card> + <a-tabs default-active-key="1"> <a-tab-pane key="1" tab='{{ i18n "pages.settings.panelSettings"}}'> - <a-row :xs="24" :sm="24" :lg="12"> - <h2 class="alert-msg"> - <a-icon type="warning"></a-icon> - {{ i18n "pages.settings.infoDesc" }} - </h2> - </a-row> - <a-list item-layout="horizontal" :style="themeSwitcher.textStyle"> + <a-list item-layout="horizontal"> <setting-list-item type="text" title='{{ i18n "pages.settings.panelListeningIP"}}' desc='{{ i18n "pages.settings.panelListeningIPDesc"}}' v-model="allSetting.webListen"></setting-list-item> <setting-list-item type="text" title='{{ i18n "pages.settings.panelListeningDomain"}}' desc='{{ i18n "pages.settings.panelListeningDomainDesc"}}' v-model="allSetting.webDomain"></setting-list-item> <setting-list-item type="number" title='{{ i18n "pages.settings.panelPort"}}' desc='{{ i18n "pages.settings.panelPortDesc"}}' v-model="allSetting.webPort" :min="0"></setting-list-item> @@ -112,7 +117,7 @@ ref="selectLang" v-model="lang" @change="setLang(lang)" - :dropdown-class-name="themeSwitcher.darkCardClass" + :dropdown-class-name="themeSwitcher.currentTheme" style="width: 100%" > <a-select-option :value="l.value" :label="l.value" v-for="l in supportLangs"> @@ -127,9 +132,9 @@ </a-list> </a-tab-pane> <a-tab-pane key="2" tab='{{ i18n "pages.settings.securitySettings"}}' style="padding: 20px;"> - <a-tabs class="ant-card-dark-securitybox-nohover" default-active-key="sec-1" :class="themeSwitcher.darkCardClass"> + <a-tabs class="ant-card-dark-securitybox-nohover" default-active-key="sec-1" :class="themeSwitcher.currentTheme"> <a-tab-pane key="sec-1" tab='{{ i18n "pages.settings.security.admin"}}'> - <a-form :style="'padding: 20px;' + themeSwitcher.textStyle"> + <a-form style="padding: 20px;"> <a-form-item label='{{ i18n "pages.settings.oldUsername"}}'> <a-input v-model="user.oldUsername" style="max-width: 300px"></a-input> </a-form-item> @@ -148,7 +153,7 @@ </a-form> </a-tab-pane> <a-tab-pane key="sec-2" tab='{{ i18n "pages.settings.security.secret"}}'> - <a-form :style="'padding: 20px;' + themeSwitcher.textStyle"> + <a-form style="padding: 20px;"> <a-list-item style="padding: 20px"> <a-row> <a-col :lg="24" :xl="12"> @@ -183,188 +188,8 @@ </a-tabs> </a-tab-pane> - <a-tab-pane key="3" tab='{{ i18n "pages.settings.xrayConfiguration"}}'> - <a-list item-layout="horizontal" :style="themeSwitcher.textStyle"> - <a-divider style="padding: 20px;">{{ i18n "pages.settings.actions"}}</a-divider> - <a-space direction="horizontal" style="padding: 0px 20px"> - <a-button type="primary" @click="resetXrayConfigToDefault">{{ i18n "pages.settings.resetDefaultConfig" }}</a-button> - </a-space> - <a-divider style="padding: 20px;">{{ i18n "pages.settings.templates.title"}} </a-divider> - <a-row :xs="24" :sm="24" :lg="12"> - <h2 class="alert-msg"> - <a-icon type="warning"></a-icon> - {{ i18n "pages.settings.infoDesc" }} - </h2> - </a-row> - <a-tabs class="ant-card-dark-box-nohover" default-active-key="tpl-1" :class="themeSwitcher.darkCardClass" style="padding: 20px 20px;"> - <a-tab-pane key="tpl-1" tab='{{ i18n "pages.settings.templates.basicTemplate"}}' style="padding-top: 20px;"> - <a-collapse> - <a-collapse-panel header='{{ i18n "pages.settings.templates.generalConfigs"}}'> - <a-row :xs="24" :sm="24" :lg="12"> - <h2 class="collapse-title"> - <a-icon type="warning"></a-icon> - {{ i18n "pages.settings.templates.generalConfigsDesc" }} - </h2> - </a-row> - <a-list-item> - <a-row style="padding: 20px"> - <a-col :lg="24" :xl="12"> - <a-list-item-meta - title='{{ i18n "pages.settings.templates.xrayConfigFreedomStrategy" }}' - description='{{ i18n "pages.settings.templates.xrayConfigFreedomStrategyDesc" }}'/> - </a-col> - <a-col :lg="24" :xl="12"> - <template> - <a-select - v-model="freedomStrategy" - :dropdown-class-name="themeSwitcher.darkCardClass" - style="width: 100%"> - <a-select-option v-for="s in outboundDomainStrategies" :value="s">[[ s ]]</a-select-option> - </a-select> - </template> - </a-col> - </a-row> - </a-list-item> - <a-row style="padding: 20px"> - <a-col :lg="24" :xl="12"> - <a-list-item-meta - title='{{ i18n "pages.settings.templates.xrayConfigRoutingStrategy" }}' - description='{{ i18n "pages.settings.templates.xrayConfigRoutingStrategyDesc" }}'/> - </a-col> - <a-col :lg="24" :xl="12"> - <template> - <a-select - v-model="routingStrategy" - :dropdown-class-name="themeSwitcher.darkCardClass" - style="width: 100%"> - <a-select-option v-for="s in routingDomainStrategies" :value="s">[[ s ]]</a-select-option> - </a-select> - </template> - </a-col> - </a-row> - </a-list-item> - </a-collapse-panel> - <a-collapse-panel header='{{ i18n "pages.settings.templates.blockConfigs"}}'> - <a-row :xs="24" :sm="24" :lg="12"> - <h2 class="collapse-title"> - <a-icon type="warning"></a-icon> - {{ i18n "pages.settings.templates.blockConfigsDesc" }} - </h2> - </a-row> - <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigTorrent"}}' desc='{{ i18n "pages.settings.templates.xrayConfigTorrentDesc"}}' v-model="torrentSettings"></setting-list-item> - <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigPrivateIp"}}' desc='{{ i18n "pages.settings.templates.xrayConfigPrivateIpDesc"}}' v-model="privateIpSettings"></setting-list-item> - <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigAds"}}' desc='{{ i18n "pages.settings.templates.xrayConfigAdsDesc"}}' v-model="AdsSettings"></setting-list-item> - <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigFamily"}}' desc='{{ i18n "pages.settings.templates.xrayConfigFamilyDesc"}}' v-model="familyProtectSettings"></setting-list-item> - <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigSpeedtest"}}' desc='{{ i18n "pages.settings.templates.xrayConfigSpeedtestDesc"}}' v-model="SpeedTestSettings"></setting-list-item> - </a-collapse-panel> - <a-collapse-panel header='{{ i18n "pages.settings.templates.blockCountryConfigs"}}'> - <a-row :xs="24" :sm="24" :lg="12"> - <h2 class="collapse-title"> - <a-icon type="warning"></a-icon> - {{ i18n "pages.settings.templates.blockCountryConfigsDesc" }} - </h2> - </a-row> - <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigIRIp"}}' desc='{{ i18n "pages.settings.templates.xrayConfigIRIpDesc"}}' v-model="IRIpSettings"></setting-list-item> - <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigIRDomain"}}' desc='{{ i18n "pages.settings.templates.xrayConfigIRDomainDesc"}}' v-model="IRDomainSettings"></setting-list-item> - <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigChinaIp"}}' desc='{{ i18n "pages.settings.templates.xrayConfigChinaIpDesc"}}' v-model="ChinaIpSettings"></setting-list-item> - <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigChinaDomain"}}' desc='{{ i18n "pages.settings.templates.xrayConfigChinaDomainDesc"}}' v-model="ChinaDomainSettings"></setting-list-item> - <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigRussiaIp"}}' desc='{{ i18n "pages.settings.templates.xrayConfigRussiaIpDesc"}}' v-model="RussiaIpSettings"></setting-list-item> - <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigRussiaDomain"}}' desc='{{ i18n "pages.settings.templates.xrayConfigRussiaDomainDesc"}}' v-model="RussiaDomainSettings"></setting-list-item> - </a-collapse-panel> - <a-collapse-panel header='{{ i18n "pages.settings.templates.directCountryConfigs"}}'> - <a-row :xs="24" :sm="24" :lg="12"> - <h2 class="collapse-title"> - <a-icon type="warning"></a-icon> - {{ i18n "pages.settings.templates.directCountryConfigsDesc" }} - </h2> - </a-row> - <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigDirectIRIp"}}' desc='{{ i18n "pages.settings.templates.xrayConfigDirectIRIpDesc"}}' v-model="IRIpDirectSettings"></setting-list-item> - <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigDirectIRDomain"}}' desc='{{ i18n "pages.settings.templates.xrayConfigDirectIRDomainDesc"}}' v-model="IRDomainDirectSettings"></setting-list-item> - <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigDirectChinaIp"}}' desc='{{ i18n "pages.settings.templates.xrayConfigDirectChinaIpDesc"}}' v-model="ChinaIpDirectSettings"></setting-list-item> - <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigDirectChinaDomain"}}' desc='{{ i18n "pages.settings.templates.xrayConfigDirectChinaDomainDesc"}}' v-model="ChinaDomainDirectSettings"></setting-list-item> - <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigDirectRussiaIp"}}' desc='{{ i18n "pages.settings.templates.xrayConfigDirectRussiaIpDesc"}}' v-model="RussiaIpDirectSettings"></setting-list-item> - <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigDirectRussiaDomain"}}' desc='{{ i18n "pages.settings.templates.xrayConfigDirectRussiaDomainDesc"}}' v-model="RussiaDomainDirectSettings"></setting-list-item> - </a-collapse-panel> - <a-collapse-panel header='{{ i18n "pages.settings.templates.ipv4Configs"}}'> - <a-row :xs="24" :sm="24" :lg="12"> - <h2 class="collapse-title"> - <a-icon type="warning"></a-icon> - {{ i18n "pages.settings.templates.ipv4ConfigsDesc" }} - </h2> - </a-row> - <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigGoogleIPv4"}}' desc='{{ i18n "pages.settings.templates.xrayConfigGoogleIPv4Desc"}}' v-model="GoogleIPv4Settings"></setting-list-item> - <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigNetflixIPv4"}}' desc='{{ i18n "pages.settings.templates.xrayConfigNetflixIPv4Desc"}}' v-model="NetflixIPv4Settings"></setting-list-item> - </a-collapse-panel> - <a-collapse-panel header='{{ i18n "pages.settings.templates.warpConfigs"}}'> - <a-row :xs="24" :sm="24" :lg="12"> - <h2 class="collapse-title"> - <a-icon type="warning"></a-icon> - {{ i18n "pages.settings.templates.warpConfigsDesc" }} - </h2> - </a-row> - <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigGoogleWARP"}}' desc='{{ i18n "pages.settings.templates.xrayConfigGoogleWARPDesc"}}' v-model="GoogleWARPSettings"></setting-list-item> - <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigOpenAIWARP"}}' desc='{{ i18n "pages.settings.templates.xrayConfigOpenAIWARPDesc"}}' v-model="OpenAIWARPSettings"></setting-list-item> - <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigNetflixWARP"}}' desc='{{ i18n "pages.settings.templates.xrayConfigNetflixWARPDesc"}}' v-model="NetflixWARPSettings"></setting-list-item> - <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigSpotifyWARP"}}' desc='{{ i18n "pages.settings.templates.xrayConfigSpotifyWARPDesc"}}' v-model="SpotifyWARPSettings"></setting-list-item> - </a-collapse-panel> - </a-collapse> - </a-tab-pane> - <a-tab-pane key="tpl-2" tab='{{ i18n "pages.settings.templates.manualLists"}}' style="padding-top: 20px;"> - <a-row :xs="24" :sm="24" :lg="12"> - <h2 class="collapse-title"> - <a-icon type="warning"></a-icon> - {{ i18n "pages.settings.templates.manualListsDesc" }} - </h2> - </a-row> - <a-collapse> - <a-collapse-panel header='{{ i18n "pages.settings.templates.manualBlockedIPs"}}'> - <setting-list-item type="textarea" v-model="manualBlockedIPs"></setting-list-item> - </a-collapse-panel> - <a-collapse-panel header='{{ i18n "pages.settings.templates.manualBlockedDomains"}}'> - <setting-list-item type="textarea" v-model="manualBlockedDomains"></setting-list-item> - </a-collapse-panel> - <a-collapse-panel header='{{ i18n "pages.settings.templates.manualDirectIPs"}}'> - <setting-list-item type="textarea" v-model="manualDirectIPs"></setting-list-item> - </a-collapse-panel> - <a-collapse-panel header='{{ i18n "pages.settings.templates.manualDirectDomains"}}'> - <setting-list-item type="textarea" v-model="manualDirectDomains"></setting-list-item> - </a-collapse-panel> - <a-collapse-panel header='{{ i18n "pages.settings.templates.manualIPv4Domains"}}'> - <setting-list-item type="textarea" v-model="manualIPv4Domains"></setting-list-item> - </a-collapse-panel> - <a-collapse-panel header='{{ i18n "pages.settings.templates.manualWARPDomains"}}'> - <setting-list-item type="textarea" v-model="manualWARPDomains"></setting-list-item> - </a-collapse-panel> - </a-collapse> - </a-tab-pane> - <a-tab-pane key="tpl-3" tab='{{ i18n "pages.settings.templates.advancedTemplate"}}' style="padding-top: 20px;"> - <a-collapse> - <a-collapse-panel header='{{ i18n "pages.settings.templates.xrayConfigInbounds"}}'> - <setting-list-item type="textarea" title='{{ i18n "pages.settings.templates.xrayConfigInbounds"}}' desc='{{ i18n "pages.settings.templates.xrayConfigInboundsDesc"}}' v-model="inboundSettings"></setting-list-item> - </a-collapse-panel> - <a-collapse-panel header='{{ i18n "pages.settings.templates.xrayConfigOutbounds"}}'> - <setting-list-item type="textarea" title='{{ i18n "pages.settings.templates.xrayConfigOutbounds"}}' desc='{{ i18n "pages.settings.templates.xrayConfigOutboundsDesc"}}' v-model="outboundSettings"></setting-list-item> - </a-collapse-panel> - <a-collapse-panel header='{{ i18n "pages.settings.templates.xrayConfigRoutings"}}'> - <setting-list-item type="textarea" title='{{ i18n "pages.settings.templates.xrayConfigRoutings"}}' desc='{{ i18n "pages.settings.templates.xrayConfigRoutingsDesc"}}' v-model="routingRuleSettings"></setting-list-item> - </a-collapse-panel> - </a-collapse> - </a-tab-pane> - <a-tab-pane key="tpl-4" tab='{{ i18n "pages.settings.templates.completeTemplate"}}' style="padding-top: 20px;"> - <setting-list-item type="textarea" title='{{ i18n "pages.settings.templates.xrayConfigTemplate"}}' desc='{{ i18n "pages.settings.templates.xrayConfigTemplateDesc"}}' v-model="allSetting.xrayTemplateConfig"></setting-list-item> - </a-tab-pane> - </a-tabs> - </a-list> - </a-tab-pane> - - <a-tab-pane key="4" tab='{{ i18n "pages.settings.TGBotSettings"}}'> - <a-row :xs="24" :sm="24" :lg="12"> - <h2 class="alert-msg"> - <a-icon type="warning"></a-icon> - {{ i18n "pages.settings.infoDesc" }} - </h2> - </a-row> - <a-list item-layout="horizontal" :style="themeSwitcher.textStyle"> + <a-tab-pane key="3" tab='{{ i18n "pages.settings.TGBotSettings"}}'> + <a-list item-layout="horizontal"> <setting-list-item type="switch" title='{{ i18n "pages.settings.telegramBotEnable" }}' desc='{{ i18n "pages.settings.telegramBotEnableDesc" }}' v-model="allSetting.tgBotEnable"></setting-list-item> <setting-list-item type="text" title='{{ i18n "pages.settings.telegramToken"}}' desc='{{ i18n "pages.settings.telegramTokenDesc"}}' v-model="allSetting.tgBotToken"></setting-list-item> <setting-list-item type="text" title='{{ i18n "pages.settings.telegramChatId"}}' desc='{{ i18n "pages.settings.telegramChatIdDesc"}}' v-model="allSetting.tgBotChatId"></setting-list-item> @@ -383,7 +208,7 @@ <a-select ref="selectBotLang" v-model="allSetting.tgLang" - :dropdown-class-name="themeSwitcher.darkCardClass" + :dropdown-class-name="themeSwitcher.currentTheme" style="width: 100%" > <a-select-option :value="l.value" :label="l.value" v-for="l in supportLangs"> @@ -397,14 +222,8 @@ </a-list-item> </a-list> </a-tab-pane> - <a-tab-pane key="5" tab='{{ i18n "pages.settings.subSettings" }}'> - <a-row :xs="24" :sm="24" :lg="12"> - <h2 class="alert-msg"> - <a-icon type="warning"></a-icon> - {{ i18n "pages.settings.infoDesc" }} - </h2> - </a-row> - <a-list item-layout="horizontal" :style="themeSwitcher.textStyle"> + <a-tab-pane key="4" tab='{{ i18n "pages.settings.subSettings" }}'> + <a-list item-layout="horizontal"> <setting-list-item type="switch" title='{{ i18n "pages.settings.subEnable"}}' desc='{{ i18n "pages.settings.subEnableDesc"}}' v-model="allSetting.subEnable"></setting-list-item> <setting-list-item type="switch" title='{{ i18n "pages.settings.subEncrypt"}}' desc='{{ i18n "pages.settings.subEncryptDesc"}}' v-model="allSetting.subEncrypt"></setting-list-item> <setting-list-item type="switch" title='{{ i18n "pages.settings.subShowInfo"}}' desc='{{ i18n "pages.settings.subShowInfoDesc"}}' v-model="allSetting.subShowInfo"></setting-list-item> @@ -440,75 +259,6 @@ saveBtnDisable: true, user: new User(), lang: getLang(), - ipv4Settings: { - tag: "IPv4", - protocol: "freedom", - settings: { - domainStrategy: "UseIPv4" - } - }, - warpSettings: { - tag: "WARP", - protocol: "socks", - settings: { - servers: [ - { - address: "127.0.0.1", - port: 40000 - } - ] - } - }, - directSettings: { - tag: "direct", - protocol: "freedom" - }, - outboundDomainStrategies: ["AsIs", "UseIP", "UseIPv4", "UseIPv6"], - routingDomainStrategies: ["AsIs", "IPIfNonMatch", "IPOnDemand"], - settingsData: { - protocols: { - bittorrent: ["bittorrent"], - }, - ips: { - local: ["geoip:private"], - cn: ["geoip:cn"], - ir: ["ext:geoip_IR.dat:ir","ext:geoip_IR.dat:arvancloud","ext:geoip_IR.dat:derakcloud","ext:geoip_IR.dat:iranserver"], - ru: ["geoip:ru"], - }, - domains: { - ads: [ - "geosite:category-ads-all", - "ext:geosite_IR.dat:category-ads-all" - ], - speedtest: ["geosite:speedtest"], - openai: ["geosite:openai"], - google: ["geosite:google"], - spotify: ["geosite:spotify"], - netflix: ["geosite:netflix"], - cn: [ - "geosite:cn", - "regexp:.*\\.cn$" - ], - ru: [ - "geosite:category-gov-ru", - "regexp:.*\\.ru$" - ], - ir: [ - "regexp:.*\\.ir$", - "regexp:.*\\.xn--mgba3a4f16a$", // .ایران - "ext:geosite_IR.dat:ir" // have rules to bypass all .ir domains. - ] - }, - familyProtectDNS: { - "servers": [ - "1.1.1.3", // https://developers.cloudflare.com/1.1.1.1/setup/ - "1.0.0.3", - "94.140.14.15", // https://adguard-dns.io/kb/general/dns-providers/ - "94.140.15.16" - ], - "queryStrategy": "UseIPv4" - }, - } }, methods: { loading(spinning = true) { @@ -547,6 +297,7 @@ this.$confirm({ title: '{{ i18n "pages.settings.restartPanel" }}', content: '{{ i18n "pages.settings.restartPanelDesc" }}', + class: themeSwitcher.currentTheme, okText: '{{ i18n "sure" }}', cancelText: '{{ i18n "cancel" }}', onOk: () => resolve(), @@ -558,7 +309,9 @@ if (msg.success) { this.loading(true); await PromiseUtil.sleep(5000); - const { webCertFile, webKeyFile, webDomain: host, webPort: port, webBasePath: base } = this.allSetting; + var { webCertFile, webKeyFile, webDomain: host, webPort: port, webBasePath: base } = this.allSetting; + if (host == this.oldAllSetting.webDomain) host = null; + if (port == this.oldAllSetting.webPort) port = null; const isTLS = webCertFile !== "" || webKeyFile !== ""; const url = buildURL({ host, port, isTLS, base, path: "panel/settings" }); window.location.replace(url); @@ -605,83 +358,6 @@ this.user.loginSecret = ""; } }, - async resetXrayConfigToDefault() { - this.loading(true); - const msg = await HttpUtil.get("/panel/setting/getDefaultJsonConfig"); - this.loading(false); - if (msg.success) { - this.templateSettings = JSON.parse(JSON.stringify(msg.obj, null, 2)); - this.saveBtnDisable = true; - } - }, - syncRulesWithOutbound(tag, setting) { - const newTemplateSettings = {...this.templateSettings}; - const haveRules = newTemplateSettings.routing.rules.some((r) => r?.outboundTag === tag); - const outboundIndex = newTemplateSettings.outbounds.findIndex((o) => o.tag === tag); - if (!haveRules && outboundIndex >= 0) { - newTemplateSettings.outbounds.splice(outboundIndex, 1); - } - if (haveRules && outboundIndex === -1) { - newTemplateSettings.outbounds.push(setting); - } - this.templateSettings = newTemplateSettings; - }, - templateRuleGetter(routeSettings) { - const { property, outboundTag } = routeSettings; - let result = []; - if (this.templateSettings != null) { - this.templateSettings.routing.rules.forEach( - (routingRule) => { - if ( - routingRule.hasOwnProperty(property) && - routingRule.hasOwnProperty("outboundTag") && - routingRule.outboundTag === outboundTag - ) { - result.push(...routingRule[property]); - } - } - ); - } - return result; - }, - templateRuleSetter(routeSettings) { - const { data, property, outboundTag } = routeSettings; - const oldTemplateSettings = this.templateSettings; - const newTemplateSettings = oldTemplateSettings; - currentProperty = this.templateRuleGetter({ outboundTag, property }) - if (currentProperty.length == 0) { - const propertyRule = { - type: "field", - outboundTag, - [property]: data - }; - newTemplateSettings.routing.rules.push(propertyRule); - } - else { - const newRules = []; - insertedOnce = false; - newTemplateSettings.routing.rules.forEach( - (routingRule) => { - if ( - routingRule.hasOwnProperty(property) && - routingRule.hasOwnProperty("outboundTag") && - routingRule.outboundTag === outboundTag - ) { - if (!insertedOnce && data.length > 0) { - insertedOnce = true; - routingRule[property] = data; - newRules.push(routingRule); - } - } - else { - newRules.push(routingRule); - } - } - ); - newTemplateSettings.routing.rules = newRules; - } - this.templateSettings = newTemplateSettings; - } }, async mounted() { await this.getAllSetting(); @@ -690,429 +366,6 @@ this.saveBtnDisable = this.oldAllSetting.equals(this.allSetting); } }, - computed: { - templateSettings: { - get: function () { return this.allSetting.xrayTemplateConfig ? JSON.parse(this.allSetting.xrayTemplateConfig) : null; }, - set: function (newValue) { this.allSetting.xrayTemplateConfig = JSON.stringify(newValue, null, 2); }, - }, - inboundSettings: { - get: function () { return this.templateSettings ? JSON.stringify(this.templateSettings.inbounds, null, 2) : null; }, - set: function (newValue) { - newTemplateSettings = this.templateSettings; - newTemplateSettings.inbounds = JSON.parse(newValue); - this.templateSettings = newTemplateSettings; - }, - }, - outboundSettings: { - get: function () { return this.templateSettings ? JSON.stringify(this.templateSettings.outbounds, null, 2) : null; }, - set: function (newValue) { - newTemplateSettings = this.templateSettings; - newTemplateSettings.outbounds = JSON.parse(newValue); - this.templateSettings = newTemplateSettings; - }, - }, - routingRuleSettings: { - get: function () { return this.templateSettings ? JSON.stringify(this.templateSettings.routing.rules, null, 2) : null; }, - set: function (newValue) { - newTemplateSettings = this.templateSettings; - newTemplateSettings.routing.rules = JSON.parse(newValue); - this.templateSettings = newTemplateSettings; - }, - }, - freedomStrategy: { - get: function () { - if (!this.templateSettings) return "AsIs"; - freedomOutbound = this.templateSettings.outbounds.find((o) => o.protocol === "freedom" && !o.tag); - if (!freedomOutbound) return "AsIs"; - if (!freedomOutbound.settings || !freedomOutbound.settings.domainStrategy) return "AsIs"; - return freedomOutbound.settings.domainStrategy; - }, - set: function (newValue) { - newTemplateSettings = this.templateSettings; - freedomOutboundIndex = newTemplateSettings.outbounds.findIndex((o) => o.protocol === "freedom" && !o.tag); - if (!newTemplateSettings.outbounds[freedomOutboundIndex].settings) { - newTemplateSettings.outbounds[freedomOutboundIndex].settings = {"domainStrategy": newValue}; - } else { - newTemplateSettings.outbounds[freedomOutboundIndex].settings.domainStrategy = newValue; - } - this.templateSettings = newTemplateSettings; - } - }, - routingStrategy: { - get: function () { - if (!this.templateSettings || !this.templateSettings.routing || !this.templateSettings.routing.domainStrategy) return "AsIs"; - return this.templateSettings.routing.domainStrategy; - }, - set: function (newValue) { - newTemplateSettings = this.templateSettings; - newTemplateSettings.routing.domainStrategy = newValue; - this.templateSettings = newTemplateSettings; - } - }, - blockedIPs: { - get: function () { - return this.templateRuleGetter({ outboundTag: "blocked", property: "ip" }); - }, - set: function (newValue) { - this.templateRuleSetter({ outboundTag: "blocked", property: "ip", data: newValue }); - } - }, - blockedDomains: { - get: function () { - return this.templateRuleGetter({ outboundTag: "blocked", property: "domain" }); - }, - set: function (newValue) { - this.templateRuleSetter({ outboundTag: "blocked", property: "domain", data: newValue }); - } - }, - blockedProtocols: { - get: function () { - return this.templateRuleGetter({ outboundTag: "blocked", property: "protocol" }); - }, - set: function (newValue) { - this.templateRuleSetter({ outboundTag: "blocked", property: "protocol", data: newValue }); - } - }, - directIPs: { - get: function () { - return this.templateRuleGetter({ outboundTag: "direct", property: "ip" }); - }, |
