setting.html 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. {{template "head" .}}
  4. <style>
  5. @media (min-width: 769px) {
  6. .ant-layout-content {
  7. margin: 24px 16px;
  8. }
  9. }
  10. .ant-col-sm-24 {
  11. margin-top: 10px;
  12. }
  13. .ant-tabs-bar {
  14. margin: 0;
  15. }
  16. .ant-list-item {
  17. display: block;
  18. }
  19. :not(.ant-card-dark)>.ant-tabs-top-bar {
  20. background: white;
  21. }
  22. </style>
  23. <body>
  24. <a-layout id="app" v-cloak>
  25. {{ template "commonSider" . }}
  26. <a-layout id="content-layout" :style="siderDrawer.isDarkTheme ? bgDarkStyle : ''">
  27. <a-layout-content>
  28. <a-spin :spinning="spinning" :delay="500" tip="loading">
  29. <a-space direction="vertical">
  30. <a-space direction="horizontal">
  31. <a-button type="primary" :disabled="saveBtnDisable" @click="updateAllSetting">{{ i18n "pages.setting.save" }}</a-button>
  32. <a-button type="danger" :disabled="!saveBtnDisable" @click="restartPanel">{{ i18n "pages.setting.restartPanel" }}</a-button>
  33. </a-space>
  34. <a-tabs default-active-key="1" :class="siderDrawer.isDarkTheme ? darkClass : ''">
  35. <a-tab-pane key="1" tab='{{ i18n "pages.setting.panelConfig"}}'>
  36. <a-list item-layout="horizontal" :style="siderDrawer.isDarkTheme ? 'color: hsla(0,0%,100%,.65);': 'background: white;'">
  37. <setting-list-item type="text" title='{{ i18n "pages.setting.panelListeningIP"}}' desc='{{ i18n "pages.setting.panelListeningIPDesc"}}' v-model="allSetting.webListen"></setting-list-item>
  38. <setting-list-item type="number" title='{{ i18n "pages.setting.panelPort"}}' desc='{{ i18n "pages.setting.panelPortDesc"}}' v-model.number="allSetting.webPort"></setting-list-item>
  39. <setting-list-item type="text" title='{{ i18n "pages.setting.publicKeyPath"}}' desc='{{ i18n "pages.setting.publicKeyPathDesc"}}' v-model="allSetting.webCertFile"></setting-list-item>
  40. <setting-list-item type="text" title='{{ i18n "pages.setting.privateKeyPath"}}' desc='{{ i18n "pages.setting.privateKeyPathDesc"}}' v-model="allSetting.webKeyFile"></setting-list-item>
  41. <setting-list-item type="text" title='{{ i18n "pages.setting.panelUrlPath"}}' desc='{{ i18n "pages.setting.panelUrlPathDesc"}}' v-model="allSetting.webBasePath"></setting-list-item>
  42. <setting-list-item type="number" title='{{ i18n "pages.setting.expireTimeDiff" }}' desc='{{ i18n "pages.setting.expireTimeDiffDesc" }}' v-model="allSetting.expireDiff" :min="0"></setting-list-item>
  43. <setting-list-item type="number" title='{{ i18n "pages.setting.trafficDiff" }}' desc='{{ i18n "pages.setting.trafficDiffDesc" }}' v-model="allSetting.trafficDiff" :min="0"></setting-list-item>
  44. <a-list-item>
  45. <a-row style="padding: 20px">
  46. <a-col :lg="24" :xl="12">
  47. <a-list-item-meta title="Language" />
  48. </a-col>
  49. <a-col :lg="24" :xl="12">
  50. <template>
  51. <a-select
  52. ref="selectLang"
  53. v-model="lang"
  54. @change="setLang(lang)"
  55. :dropdown-class-name="siderDrawer.isDarkTheme ? 'ant-card-dark' : ''"
  56. style="width: 100%"
  57. >
  58. <a-select-option :value="l.value" :label="l.value" v-for="l in supportLangs">
  59. <span role="img" aria-label="l.name" v-text="l.icon"></span>&nbsp;&nbsp;<span v-text="l.name"></span>
  60. </a-select-option>
  61. </a-select>
  62. </template>
  63. </a-col>
  64. </a-row>
  65. </a-list-item>
  66. </a-list>
  67. </a-tab-pane>
  68. <a-tab-pane key="2" tab='{{ i18n "pages.setting.userSetting"}}'>
  69. <a-form :style="siderDrawer.isDarkTheme ? 'color: hsla(0,0%,100%,.65); padding: 20px;': 'background: white; padding: 20px;'">
  70. <a-form-item label='{{ i18n "pages.setting.oldUsername"}}'>
  71. <a-input v-model="user.oldUsername" style="max-width: 300px"></a-input>
  72. </a-form-item>
  73. <a-form-item label='{{ i18n "pages.setting.currentPassword"}}'>
  74. <a-input type="password" v-model="user.oldPassword" style="max-width: 300px"></a-input>
  75. </a-form-item>
  76. <a-form-item label='{{ i18n "pages.setting.newUsername"}}'>
  77. <a-input v-model="user.newUsername" style="max-width: 300px"></a-input>
  78. </a-form-item>
  79. <a-form-item label='{{ i18n "pages.setting.newPassword"}}'>
  80. <a-input type="password" v-model="user.newPassword" style="max-width: 300px"></a-input>
  81. </a-form-item>
  82. <a-form-item>
  83. <a-button type="primary" @click="updateUser">{{ i18n "confirm" }}</a-button>
  84. </a-form-item>
  85. </a-form>
  86. </a-tab-pane>
  87. <a-tab-pane key="3" tab='{{ i18n "pages.setting.xrayConfiguration"}}'>
  88. <a-list item-layout="horizontal" :style="siderDrawer.isDarkTheme ? 'color: hsla(0,0%,100%,.65);': 'background: white;'">
  89. <a-divider>{{ i18n "pages.setting.actions"}}</a-divider>
  90. <a-space direction="horizontal" style="padding: 0 20px">
  91. <a-button type="primary" @click="resetXrayConfigToDefault">{{ i18n "pages.setting.resetDefaultConfig" }}</a-button>
  92. </a-space>
  93. <a-divider>{{ i18n "pages.setting.basicTemplate"}}</a-divider>
  94. <a-collapse>
  95. <a-collapse-panel header='{{ i18n "pages.setting.generalConfigs"}}'>
  96. <setting-list-item type="switch" title='{{ i18n "pages.setting.xrayConfigTorrent"}}' desc='{{ i18n "pages.setting.xrayConfigTorrentDesc"}}' v-model="torrentSettings"></setting-list-item>
  97. <setting-list-item type="switch" title='{{ i18n "pages.setting.xrayConfigPrivateIp"}}' desc='{{ i18n "pages.setting.xrayConfigPrivateIpDesc"}}' v-model="privateIpSettings"></setting-list-item>
  98. <setting-list-item type="switch" title='{{ i18n "pages.setting.xrayConfigAds"}}' desc='{{ i18n "pages.setting.xrayConfigAdsDesc"}}' v-model="AdsSettings"></setting-list-item>
  99. <setting-list-item type="switch" title='{{ i18n "pages.setting.xrayConfigPorn"}}' desc='{{ i18n "pages.setting.xrayConfigPornDesc"}}' v-model="PornSettings"></setting-list-item>
  100. </a-collapse-panel>
  101. <a-collapse-panel header='{{ i18n "pages.setting.countryConfigs"}}'>
  102. <setting-list-item type="switch" title='{{ i18n "pages.setting.xrayConfigIRIp"}}' desc='{{ i18n "pages.setting.xrayConfigIRIpDesc"}}' v-model="IRIpSettings"></setting-list-item>
  103. <setting-list-item type="switch" title='{{ i18n "pages.setting.xrayConfigIRDomain"}}' desc='{{ i18n "pages.setting.xrayConfigIRDomainDesc"}}' v-model="IRDomainSettings"></setting-list-item>
  104. <setting-list-item type="switch" title='{{ i18n "pages.setting.xrayConfigChinaIp"}}' desc='{{ i18n "pages.setting.xrayConfigChinaIpDesc"}}' v-model="ChinaIpSettings"></setting-list-item>
  105. <setting-list-item type="switch" title='{{ i18n "pages.setting.xrayConfigChinaDomain"}}' desc='{{ i18n "pages.setting.xrayConfigChinaDomainDesc"}}' v-model="ChinaDomainSettings"></setting-list-item>
  106. <setting-list-item type="switch" title='{{ i18n "pages.setting.xrayConfigRussiaIp"}}' desc='{{ i18n "pages.setting.xrayConfigRussiaIpDesc"}}' v-model="RussiaIpSettings"></setting-list-item>
  107. <setting-list-item type="switch" title='{{ i18n "pages.setting.xrayConfigRussiaDomain"}}' desc='{{ i18n "pages.setting.xrayConfigRussiaDomainDesc"}}' v-model="RussiaDomainSettings"></setting-list-item>
  108. </a-collapse-panel>
  109. <a-collapse-panel header='{{ i18n "pages.setting.ipv4Configs"}}'>
  110. <setting-list-item type="switch" title='{{ i18n "pages.setting.xrayConfigGoogleIPv4"}}' desc='{{ i18n "pages.setting.xrayConfigGoogleIPv4Desc"}}' v-model="GoogleIPv4Settings"></setting-list-item>
  111. <setting-list-item type="switch" title='{{ i18n "pages.setting.xrayConfigNetflixIPv4"}}' desc='{{ i18n "pages.setting.xrayConfigNetflixIPv4Desc"}}' v-model="NetflixIPv4Settings"></setting-list-item>
  112. </a-collapse-panel>
  113. <a-collapse-panel header='{{ i18n "pages.setting.warpConfigs"}}'>
  114. <setting-list-item type="switch" title='{{ i18n "pages.setting.xrayConfigGoogleWARP"}}' desc='{{ i18n "pages.setting.xrayConfigGoogleWARPDesc"}}' v-model="GoogleWARPSettings"></setting-list-item>
  115. <setting-list-item type="switch" title='{{ i18n "pages.setting.xrayConfigOpenAIWARP"}}' desc='{{ i18n "pages.setting.xrayConfigOpenAIWARPDesc"}}' v-model="OpenAIWARPSettings"></setting-list-item>
  116. <setting-list-item type="switch" title='{{ i18n "pages.setting.xrayConfigNetflixWARP"}}' desc='{{ i18n "pages.setting.xrayConfigNetflixWARPDesc"}}' v-model="NetflixWARPSettings"></setting-list-item>
  117. <setting-list-item type="switch" title='{{ i18n "pages.setting.xrayConfigSpotifyWARP"}}' desc='{{ i18n "pages.setting.xrayConfigSpotifyWARPDesc"}}' v-model="SpotifyWARPSettings"></setting-list-item>
  118. <setting-list-item type="switch" title='{{ i18n "pages.setting.xrayConfigIRWARP"}}' desc='{{ i18n "pages.setting.xrayConfigIRWARPDesc"}}' v-model="IRWARPSettings"></setting-list-item>
  119. </a-collapse-panel>
  120. </a-collapse>
  121. <a-divider>{{ i18n "pages.setting.advancedTemplate"}}</a-divider>
  122. <a-collapse>
  123. <a-collapse-panel header='{{ i18n "pages.setting.xrayConfigInbounds"}}'>
  124. <setting-list-item type="textarea" title='{{ i18n "pages.setting.xrayConfigInbounds"}}' desc='{{ i18n "pages.setting.xrayConfigInboundsDesc"}}' v-model="inboundSettings"></setting-list-item>
  125. </a-collapse-panel>
  126. <a-collapse-panel header='{{ i18n "pages.setting.xrayConfigOutbounds"}}'>
  127. <setting-list-item type="textarea" title='{{ i18n "pages.setting.xrayConfigOutbounds"}}' desc='{{ i18n "pages.setting.xrayConfigOutboundsDesc"}}' v-model="outboundSettings"></setting-list-item>
  128. </a-collapse-panel>
  129. <a-collapse-panel header='{{ i18n "pages.setting.xrayConfigRoutings"}}'>
  130. <setting-list-item type="textarea" title='{{ i18n "pages.setting.xrayConfigRoutings"}}' desc='{{ i18n "pages.setting.xrayConfigRoutingsDesc"}}' v-model="routingRuleSettings"></setting-list-item>
  131. </a-collapse-panel>
  132. </a-collapse>
  133. <a-divider>{{ i18n "pages.setting.completeTemplate"}}</a-divider>
  134. <setting-list-item type="textarea" title='{{ i18n "pages.setting.xrayConfigTemplate"}}' desc='{{ i18n "pages.setting.xrayConfigTemplateDesc"}}' v-model="allSetting.xrayTemplateConfig"></setting-list-item>
  135. </a-list>
  136. </a-tab-pane>
  137. <a-tab-pane key="4" tab='{{ i18n "pages.setting.TGReminder"}}'>
  138. <a-list item-layout="horizontal" :style="siderDrawer.isDarkTheme ? 'color: hsla(0,0%,100%,.65);': 'background: white;'">
  139. <setting-list-item type="switch" title='{{ i18n "pages.setting.telegramBotEnable" }}' desc='{{ i18n "pages.setting.telegramBotEnableDesc" }}' v-model="allSetting.tgBotEnable"></setting-list-item>
  140. <setting-list-item type="text" title='{{ i18n "pages.setting.telegramToken"}}' desc='{{ i18n "pages.setting.telegramTokenDesc"}}' v-model="allSetting.tgBotToken"></setting-list-item>
  141. <setting-list-item type="text" title='{{ i18n "pages.setting.telegramChatId"}}' desc='{{ i18n "pages.setting.telegramChatIdDesc"}}' v-model="allSetting.tgBotChatId"></setting-list-item>
  142. <setting-list-item type="text" title='{{ i18n "pages.setting.telegramNotifyTime"}}' desc='{{ i18n "pages.setting.telegramNotifyTimeDesc"}}' v-model="allSetting.tgRunTime"></setting-list-item>
  143. <setting-list-item type="switch" title='{{ i18n "pages.setting.tgNotifyBackup" }}' desc='{{ i18n "pages.setting.tgNotifyBackupDesc" }}' v-model="allSetting.tgBotBackup"></setting-list-item>
  144. <setting-list-item type="number" title='{{ i18n "pages.setting.tgNotifyCpu" }}' desc='{{ i18n "pages.setting.tgNotifyCpuDesc" }}' v-model="allSetting.tgCpu" :min="0" :max="100"></setting-list-item>
  145. </a-list>
  146. </a-tab-pane>
  147. <a-tab-pane key="5" tab='{{ i18n "pages.setting.otherSetting"}}'>
  148. <a-list item-layout="horizontal" :style="siderDrawer.isDarkTheme ? 'color: hsla(0,0%,100%,.65);': 'background: white;'">
  149. <setting-list-item type="text" title='{{ i18n "pages.setting.timeZonee"}}' desc='{{ i18n "pages.setting.timeZoneDesc"}}' v-model="allSetting.timeLocation"></setting-list-item>
  150. </a-list>
  151. </a-tab-pane>
  152. </a-tabs>
  153. </a-space>
  154. </a-spin>
  155. </a-layout-content>
  156. </a-layout>
  157. </a-layout>
  158. {{template "js" .}}
  159. {{template "component/setting"}}
  160. <script>
  161. const app = new Vue({
  162. delimiters: ['[[', ']]'],
  163. el: '#app',
  164. data: {
  165. siderDrawer,
  166. spinning: false,
  167. oldAllSetting: new AllSetting(),
  168. allSetting: new AllSetting(),
  169. saveBtnDisable: true,
  170. user: {},
  171. lang: getLang(),
  172. ipv4Settings: {
  173. tag: "IPv4",
  174. protocol: "freedom",
  175. settings: {
  176. domainStrategy: "UseIPv4"
  177. }
  178. },
  179. warpSettings: {
  180. tag: "WARP",
  181. protocol: "socks",
  182. settings: {
  183. servers: [
  184. {
  185. address: "127.0.0.1",
  186. port: 40000
  187. }
  188. ]
  189. }
  190. },
  191. settingsData: {
  192. protocols: {
  193. bittorrent: ["bittorrent"],
  194. },
  195. ips: {
  196. local: ["geoip:private"],
  197. google: ["geoip:google"],
  198. cn: ["geoip:cn"],
  199. ir: ["geoip:ir"],
  200. ru: ["geoip:ru"],
  201. },
  202. domains: {
  203. ads: [
  204. "geosite:category-ads-all",
  205. "geosite:category-ads",
  206. "geosite:google-ads",
  207. "geosite:spotify-ads"
  208. ],
  209. porn: ["geosite:category-porn"],
  210. openai: ["geosite:openai"],
  211. google: ["geosite:google"],
  212. spotify: ["geosite:spotify"],
  213. netflix: ["geosite:netflix"],
  214. cn: ["geosite:cn"],
  215. ru: ["geosite:category-ru-gov"],
  216. ir: [
  217. "regexp:.*\\.ir$",
  218. "ext:iran.dat:ir",
  219. "ext:iran.dat:other",
  220. "ext:iran.dat:ads",
  221. "geosite:category-ir"
  222. ]
  223. },
  224. }
  225. },
  226. methods: {
  227. loading(spinning = true) {
  228. this.spinning = spinning;
  229. },
  230. async getAllSetting() {
  231. this.loading(true);
  232. const msg = await HttpUtil.post("/xui/setting/all");
  233. this.loading(false);
  234. if (msg.success) {
  235. this.oldAllSetting = new AllSetting(msg.obj);
  236. this.allSetting = new AllSetting(msg.obj);
  237. this.saveBtnDisable = true;
  238. }
  239. },
  240. async updateAllSetting() {
  241. this.loading(true);
  242. const msg = await HttpUtil.post("/xui/setting/update", this.allSetting);
  243. this.loading(false);
  244. if (msg.success) {
  245. await this.getAllSetting();
  246. }
  247. },
  248. async updateUser() {
  249. this.loading(true);
  250. const msg = await HttpUtil.post("/xui/setting/updateUser", this.user);
  251. this.loading(false);
  252. if (msg.success) {
  253. this.user = {};
  254. }
  255. },
  256. async restartPanel() {
  257. await new Promise(resolve => {
  258. this.$confirm({
  259. title: '{{ i18n "pages.setting.restartPanel" }}',
  260. content: '{{ i18n "pages.setting.restartPanelDesc" }}',
  261. okText: '{{ i18n "sure" }}',
  262. cancelText: '{{ i18n "cancel" }}',
  263. onOk: () => resolve(),
  264. });
  265. });
  266. this.loading(true);
  267. const msg = await HttpUtil.post("/xui/setting/restartPanel");
  268. this.loading(false);
  269. if (msg.success) {
  270. this.loading(true);
  271. await PromiseUtil.sleep(5000);
  272. location.reload();
  273. }
  274. },
  275. async resetXrayConfigToDefault() {
  276. this.loading(true);
  277. const msg = await HttpUtil.get("/xui/setting/getDefaultJsonConfig");
  278. this.loading(false);
  279. if (msg.success) {
  280. this.templateSettings = JSON.parse(JSON.stringify(msg.obj, null, 2));
  281. this.saveBtnDisable = true;
  282. }
  283. },
  284. checkRequiredOutbounds() {
  285. const newTemplateSettings = this.templateSettings;
  286. const haveIPv4Outbounds = newTemplateSettings.outbounds.some((o) => o?.tag === "IPv4");
  287. const haveIPv4Rules = newTemplateSettings.routing.rules.some((r) => r?.outboundTag === "IPv4");
  288. const haveWARPOutbounds = newTemplateSettings.outbounds.some((o) => o?.tag === "WARP");
  289. const haveWARPRules = newTemplateSettings.routing.rules.some((r) => r?.outboundTag === "WARP");
  290. if (haveWARPRules && !haveWARPOutbounds) {
  291. newTemplateSettings.outbounds.push(this.warpSettings);
  292. }
  293. if (haveIPv4Rules && !haveIPv4Outbounds) {
  294. newTemplateSettings.outbounds.push(this.ipv4Settings);
  295. }
  296. this.templateSettings = newTemplateSettings;
  297. },
  298. templateRuleGetter(routeSettings) {
  299. const { data, property, outboundTag } = routeSettings;
  300. let result = false;
  301. if (this.templateSettings != null) {
  302. this.templateSettings.routing.rules.forEach(
  303. (routingRule) => {
  304. if (
  305. routingRule.hasOwnProperty(property) &&
  306. routingRule.hasOwnProperty("outboundTag") &&
  307. routingRule.outboundTag === outboundTag
  308. ) {
  309. if (data.includes(routingRule[property][0])) {
  310. result = true;
  311. }
  312. }
  313. }
  314. );
  315. }
  316. return result;
  317. },
  318. templateRuleSetter(routeSettings) {
  319. const { newValue, data, property, outboundTag } = routeSettings;
  320. const oldTemplateSettings = this.templateSettings;
  321. const newTemplateSettings = oldTemplateSettings;
  322. if (newValue) {
  323. const propertyRule = {
  324. type: "field",
  325. outboundTag,
  326. [property]: data
  327. };
  328. newTemplateSettings.routing.rules.push(propertyRule);
  329. }
  330. else {
  331. const newRules = [];
  332. newTemplateSettings.routing.rules.forEach(
  333. (routingRule) => {
  334. if (
  335. routingRule.hasOwnProperty(property) &&
  336. routingRule.hasOwnProperty("outboundTag") &&
  337. routingRule.outboundTag === outboundTag
  338. ) {
  339. if (data.includes(routingRule[property][0])) {
  340. return;
  341. }
  342. }
  343. newRules.push(routingRule);
  344. }
  345. );
  346. newTemplateSettings.routing.rules = newRules;
  347. }
  348. this.templateSettings = newTemplateSettings;
  349. this.checkRequiredOutbounds();
  350. }
  351. },
  352. async mounted() {
  353. await this.getAllSetting();
  354. while (true) {
  355. await PromiseUtil.sleep(1000);
  356. this.saveBtnDisable = this.oldAllSetting.equals(this.allSetting);
  357. }
  358. },
  359. computed: {
  360. templateSettings: {
  361. get: function () { return this.allSetting.xrayTemplateConfig ? JSON.parse(this.allSetting.xrayTemplateConfig) : null; },
  362. set: function (newValue) { this.allSetting.xrayTemplateConfig = JSON.stringify(newValue, null, 2) },
  363. },
  364. inboundSettings: {
  365. get: function () { return this.templateSettings ? JSON.stringify(this.templateSettings.inbounds, null, 2) : null; },
  366. set: function (newValue) {
  367. newTemplateSettings = this.templateSettings;
  368. newTemplateSettings.inbounds = JSON.parse(newValue)
  369. this.templateSettings = newTemplateSettings
  370. },
  371. },
  372. outboundSettings: {
  373. get: function () { return this.templateSettings ? JSON.stringify(this.templateSettings.outbounds, null, 2) : null; },
  374. set: function (newValue) {
  375. newTemplateSettings = this.templateSettings;
  376. newTemplateSettings.outbounds = JSON.parse(newValue)
  377. this.templateSettings = newTemplateSettings
  378. },
  379. },
  380. routingRuleSettings: {
  381. get: function () { return this.templateSettings ? JSON.stringify(this.templateSettings.routing.rules, null, 2) : null; },
  382. set: function (newValue) {
  383. newTemplateSettings = this.templateSettings;
  384. newTemplateSettings.routing.rules = JSON.parse(newValue)
  385. this.templateSettings = newTemplateSettings
  386. },
  387. },
  388. torrentSettings: {
  389. get: function () {
  390. return this.templateRuleGetter({
  391. outboundTag: "blocked",
  392. property: "protocol",
  393. data: this.settingsData.protocols.bittorrent
  394. });
  395. },
  396. set: function (newValue) {
  397. this.templateRuleSetter({
  398. newValue,
  399. outboundTag: "blocked",
  400. property: "protocol",
  401. data: this.settingsData.protocols.bittorrent
  402. });
  403. },
  404. },
  405. privateIpSettings: {
  406. get: function () {
  407. return this.templateRuleGetter({
  408. outboundTag: "blocked",
  409. property: "ip",
  410. data: this.settingsData.ips.local
  411. });
  412. },
  413. set: function (newValue) {
  414. this.templateRuleSetter({
  415. newValue,
  416. outboundTag: "blocked",
  417. property: "ip",
  418. data: this.settingsData.ips.local
  419. });
  420. },
  421. },
  422. AdsSettings: {
  423. get: function () {
  424. return this.templateRuleGetter({
  425. outboundTag: "blocked",
  426. property: "domain",
  427. data: this.settingsData.domains.ads
  428. });
  429. },
  430. set: function (newValue) {
  431. this.templateRuleSetter({
  432. newValue,
  433. outboundTag: "blocked",
  434. property: "domain",
  435. data: this.settingsData.domains.ads
  436. });
  437. },
  438. },
  439. PornSettings: {
  440. get: function () {
  441. return this.templateRuleGetter({
  442. outboundTag: "blocked",
  443. property: "domain",
  444. data: this.settingsData.domains.porn
  445. });
  446. },
  447. set: function (newValue) {
  448. this.templateRuleSetter({
  449. newValue,
  450. outboundTag: "blocked",
  451. property: "domain",
  452. data: this.settingsData.domains.porn
  453. });
  454. },
  455. },
  456. GoogleIPv4Settings: {
  457. get: function () {
  458. return this.templateRuleGetter({
  459. outboundTag: "IPv4",
  460. property: "domain",
  461. data: this.settingsData.domains.google
  462. });
  463. },
  464. set: function (newValue) {
  465. this.templateRuleSetter({
  466. newValue,
  467. outboundTag: "IPv4",
  468. property: "domain",
  469. data: this.settingsData.domains.google
  470. });
  471. },
  472. },
  473. NetflixIPv4Settings: {
  474. get: function () {
  475. return this.templateRuleGetter({
  476. outboundTag: "IPv4",
  477. property: "domain",
  478. data: this.settingsData.domains.netflix
  479. });
  480. },
  481. set: function (newValue) {
  482. this.templateRuleSetter({
  483. newValue,
  484. outboundTag: "IPv4",
  485. property: "domain",
  486. data: this.settingsData.domains.netflix
  487. });
  488. },
  489. },
  490. IRIpSettings: {
  491. get: function () {
  492. return this.templateRuleGetter({
  493. outboundTag: "blocked",
  494. property: "ip",
  495. data: this.settingsData.ips.ir
  496. });
  497. },
  498. set: function (newValue) {
  499. this.templateRuleSetter({
  500. newValue,
  501. outboundTag: "blocked",
  502. property: "ip",
  503. data: this.settingsData.ips.ir
  504. });
  505. },
  506. },
  507. IRDomainSettings: {
  508. get: function () {
  509. return this.templateRuleGetter({
  510. outboundTag: "blocked",
  511. property: "domain",
  512. data: this.settingsData.domains.ir
  513. });
  514. },
  515. set: function (newValue) {
  516. this.templateRuleSetter({
  517. newValue,
  518. outboundTag: "blocked",
  519. property: "domain",
  520. data: this.settingsData.domains.ir
  521. });
  522. },
  523. },
  524. ChinaIpSettings: {
  525. get: function () {
  526. return this.templateRuleGetter({
  527. outboundTag: "blocked",
  528. property: "ip",
  529. data: this.settingsData.ips.cn
  530. });
  531. },
  532. set: function (newValue) {
  533. this.templateRuleSetter({
  534. newValue,
  535. outboundTag: "blocked",
  536. property: "ip",
  537. data: this.settingsData.ips.cn
  538. });
  539. },
  540. },
  541. ChinaDomainSettings: {
  542. get: function () {
  543. return this.templateRuleGetter({
  544. outboundTag: "blocked",
  545. property: "domain",
  546. data: this.settingsData.domains.cn
  547. });
  548. },
  549. set: function (newValue) {
  550. this.templateRuleSetter({
  551. newValue,
  552. outboundTag: "blocked",
  553. property: "domain",
  554. data: this.settingsData.domains.cn
  555. });
  556. },
  557. },
  558. RussiaIpSettings: {
  559. get: function () {
  560. return this.templateRuleGetter({
  561. outboundTag: "blocked",
  562. property: "ip",
  563. data: this.settingsData.ips.ru
  564. });
  565. },
  566. set: function (newValue) {
  567. this.templateRuleSetter({
  568. newValue,
  569. outboundTag: "blocked",
  570. property: "ip",
  571. data: this.settingsData.ips.ru
  572. });
  573. },
  574. },
  575. RussiaDomainSettings: {
  576. get: function () {
  577. return this.templateRuleGetter({
  578. outboundTag: "blocked",
  579. property: "domain",
  580. data: this.settingsData.domains.ru
  581. });
  582. },
  583. set: function (newValue) {
  584. this.templateRuleSetter({
  585. newValue,
  586. outboundTag: "blocked",
  587. property: "domain",
  588. data: this.settingsData.domains.ru
  589. });
  590. },
  591. },
  592. GoogleWARPSettings: {
  593. get: function () {
  594. return this.templateRuleGetter({
  595. outboundTag: "WARP",
  596. property: "domain",
  597. data: this.settingsData.domains.google
  598. });
  599. },
  600. set: function (newValue) {
  601. this.templateRuleSetter({
  602. newValue,
  603. outboundTag: "WARP",
  604. property: "domain",
  605. data: this.settingsData.domains.google
  606. });
  607. },
  608. },
  609. OpenAIWARPSettings: {
  610. get: function () {
  611. return this.templateRuleGetter({
  612. outboundTag: "WARP",
  613. property: "domain",
  614. data: this.settingsData.domains.openai
  615. });
  616. },
  617. set: function (newValue) {
  618. this.templateRuleSetter({
  619. newValue,
  620. outboundTag: "WARP",
  621. property: "domain",
  622. data: this.settingsData.domains.openai
  623. });
  624. },
  625. },
  626. NetflixWARPSettings: {
  627. get: function () {
  628. return this.templateRuleGetter({
  629. outboundTag: "WARP",
  630. property: "domain",
  631. data: this.settingsData.domains.netflix
  632. });
  633. },
  634. set: function (newValue) {
  635. this.templateRuleSetter({
  636. newValue,
  637. outboundTag: "WARP",
  638. property: "domain",
  639. data: this.settingsData.domains.netflix
  640. });
  641. },
  642. },
  643. SpotifyWARPSettings: {
  644. get: function () {
  645. return this.templateRuleGetter({
  646. outboundTag: "WARP",
  647. property: "domain",
  648. data: this.settingsData.domains.spotify
  649. });
  650. },
  651. set: function (newValue) {
  652. this.templateRuleSetter({
  653. newValue,
  654. outboundTag: "WARP",
  655. property: "domain",
  656. data: this.settingsData.domains.spotify
  657. });
  658. },
  659. },
  660. IRWARPSettings: {
  661. get: function () {
  662. return this.templateRuleGetter({
  663. outboundTag: "WARP",
  664. property: "domain",
  665. data: this.settingsData.domains.ir
  666. });
  667. },
  668. set: function (newValue) {
  669. this.templateRuleSetter({
  670. newValue,
  671. outboundTag: "WARP",
  672. property: "domain",
  673. data: this.settingsData.domains.ir
  674. });
  675. },
  676. },
  677. }
  678. });
  679. </script>
  680. </body>
  681. </html>