settings.html 63 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054
  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. .alert-msg {
  23. color: rgb(194, 117, 18);
  24. font-weight: bold;
  25. font-size: 20px;
  26. margin-top: 5px;
  27. padding: 16px 6px;
  28. text-align: center;
  29. border-bottom: 1px solid;
  30. }
  31. .alert-msg > i {
  32. color: inherit;
  33. font-size: 24px;
  34. }
  35. .collapse-title {
  36. color: inherit;
  37. font-weight: bold;
  38. font-size: 18px;
  39. padding: 10px 20px;
  40. border-bottom: 2px solid;
  41. }
  42. .collapse-title > i {
  43. color: inherit;
  44. font-size: 24px;
  45. }
  46. </style>
  47. <body>
  48. <a-layout id="app" v-cloak>
  49. {{ template "commonSider" . }}
  50. <a-layout id="content-layout" :style="themeSwitcher.bgStyle">
  51. <a-layout-content>
  52. <a-spin :spinning="spinning" :delay="500" tip="loading">
  53. <a-space direction="vertical">
  54. <a-space direction="horizontal">
  55. <a-button type="primary" :disabled="saveBtnDisable" @click="updateAllSetting">{{ i18n "pages.settings.save" }}</a-button>
  56. <a-button type="danger" :disabled="!saveBtnDisable" @click="restartPanel">{{ i18n "pages.settings.restartPanel" }}</a-button>
  57. </a-space>
  58. <a-tabs style="margin:1rem 0.5rem;" default-active-key="1" :class="themeSwitcher.darkCardClass">
  59. <a-tab-pane key="1" tab='{{ i18n "pages.settings.panelSettings"}}'>
  60. <a-row :xs="24" :sm="24" :lg="12">
  61. <h2 class="alert-msg">
  62. <a-icon type="warning"></a-icon>
  63. {{ i18n "pages.settings.infoDesc" }}
  64. </h2>
  65. </a-row>
  66. <a-list item-layout="horizontal" :style="themeSwitcher.textStyle">
  67. <setting-list-item type="text" title='{{ i18n "pages.settings.panelListeningIP"}}' desc='{{ i18n "pages.settings.panelListeningIPDesc"}}' v-model="allSetting.webListen"></setting-list-item>
  68. <setting-list-item type="number" title='{{ i18n "pages.settings.panelPort"}}' desc='{{ i18n "pages.settings.panelPortDesc"}}' v-model="allSetting.webPort" :min="0"></setting-list-item>
  69. <setting-list-item type="text" title='{{ i18n "pages.settings.publicKeyPath"}}' desc='{{ i18n "pages.settings.publicKeyPathDesc"}}' v-model="allSetting.webCertFile"></setting-list-item>
  70. <setting-list-item type="text" title='{{ i18n "pages.settings.privateKeyPath"}}' desc='{{ i18n "pages.settings.privateKeyPathDesc"}}' v-model="allSetting.webKeyFile"></setting-list-item>
  71. <setting-list-item type="text" title='{{ i18n "pages.settings.panelUrlPath"}}' desc='{{ i18n "pages.settings.panelUrlPathDesc"}}' v-model="allSetting.webBasePath"></setting-list-item>
  72. <setting-list-item type="number" title='{{ i18n "pages.settings.sessionMaxAge" }}' desc='{{ i18n "pages.settings.sessionMaxAgeDesc" }}' v-model="allSetting.sessionMaxAge" :min="0"></setting-list-item>
  73. <setting-list-item type="number" title='{{ i18n "pages.settings.expireTimeDiff" }}' desc='{{ i18n "pages.settings.expireTimeDiffDesc" }}' v-model="allSetting.expireDiff" :min="0"></setting-list-item>
  74. <setting-list-item type="number" title='{{ i18n "pages.settings.trafficDiff" }}' desc='{{ i18n "pages.settings.trafficDiffDesc" }}' v-model="allSetting.trafficDiff" :min="0"></setting-list-item>
  75. <setting-list-item type="text" title='{{ i18n "pages.settings.timeZone"}}' desc='{{ i18n "pages.settings.timeZoneDesc"}}' v-model="allSetting.timeLocation"></setting-list-item>
  76. <a-list-item>
  77. <a-row style="padding: 20px">
  78. <a-col :lg="24" :xl="12">
  79. <a-list-item-meta title="Language" />
  80. </a-col>
  81. <a-col :lg="24" :xl="12">
  82. <template>
  83. <a-select
  84. ref="selectLang"
  85. v-model="lang"
  86. @change="setLang(lang)"
  87. :dropdown-class-name="themeSwitcher.darkCardClass"
  88. style="width: 100%"
  89. >
  90. <a-select-option :value="l.value" :label="l.value" v-for="l in supportLangs">
  91. <span role="img" aria-label="l.name" v-text="l.icon"></span>
  92. &nbsp;&nbsp;<span v-text="l.name"></span>
  93. </a-select-option>
  94. </a-select>
  95. </template>
  96. </a-col>
  97. </a-row>
  98. </a-list-item>
  99. </a-list>
  100. </a-tab-pane>
  101. <a-tab-pane key="2" tab='{{ i18n "pages.settings.securitySettings"}}' style="padding: 20px;">
  102. <a-tabs class="ant-card-dark-securitybox-nohover" default-active-key="sec-1" :class="themeSwitcher.darkCardClass">
  103. <a-tab-pane key="sec-1" tab='{{ i18n "pages.settings.security.admin"}}'>
  104. <a-form :style="'padding: 20px;' + themeSwitcher.textStyle">
  105. <a-form-item label='{{ i18n "pages.settings.oldUsername"}}'>
  106. <a-input v-model="user.oldUsername" style="max-width: 300px"></a-input>
  107. </a-form-item>
  108. <a-form-item label='{{ i18n "pages.settings.currentPassword"}}'>
  109. <password-input v-model="user.oldPassword" style="max-width: 300px"></password-input>
  110. </a-form-item>
  111. <a-form-item label='{{ i18n "pages.settings.newUsername"}}'>
  112. <a-input v-model="user.newUsername" style="max-width: 300px"></a-input>
  113. </a-form-item>
  114. <a-form-item label='{{ i18n "pages.settings.newPassword"}}'>
  115. <password-input v-model="user.newPassword" style="max-width: 300px"></password-input>
  116. </a-form-item>
  117. <a-form-item>
  118. <a-button type="primary" @click="updateUser">{{ i18n "confirm" }}</a-button>
  119. </a-form-item>
  120. </a-form>
  121. </a-tab-pane>
  122. <a-tab-pane key="sec-2" tab='{{ i18n "pages.settings.security.secret"}}'>
  123. <a-form :style="'padding: 20px;' + themeSwitcher.textStyle">
  124. <a-list-item style="padding: 20px">
  125. <a-row>
  126. <a-col :lg="24" :xl="12">
  127. <a-list-item-meta title='{{ i18n "pages.settings.security.loginSecurity" }}' description='{{ i18n "pages.settings.security.loginSecurityDesc" }}' />
  128. </a-col>
  129. <a-col :lg="24" :xl="12">
  130. <template>
  131. <a-switch @change="toggleToken(allSetting.secretEnable)" v-model="allSetting.secretEnable"></a-switch>
  132. </template>
  133. </a-col>
  134. </a-row>
  135. </a-list-item>
  136. <a-list-item style="padding: 20px">
  137. <a-row>
  138. <a-col :lg="24" :xl="12">
  139. <a-list-item-meta title='{{ i18n "pages.settings.security.secretToken" }}' description='{{ i18n "pages.settings.security.secretTokenDesc" }}' />
  140. </a-col>
  141. <a-col :lg="24" :xl="12">
  142. <svg
  143. @click="getNewSecret"
  144. xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="anticon anticon-question-circle" viewBox="0 0 16 16"><path d="M11.534 7h3.932a.25.25 0 0 1 .192.41l-1.966 2.36a.25.25 0 0 1-.384 0l-1.966-2.36a.25.25 0 0 1 .192-.41zm-11 2h3.932a.25.25 0 0 0 .192-.41L2.692 6.23a.25.25 0 0 0-.384 0L.342 8.59A.25.25 0 0 0 .534 9z"/><path fill-rule="evenodd" d="M8 3c-1.552 0-2.94.707-3.857 1.818a.5.5 0 1 1-.771-.636A6.002 6.002 0 0 1 13.917 7H12.9A5.002 5.002 0 0 0 8 3zM3.1 9a5.002 5.002 0 0 0 8.757 2.182.5.5 0 1 1 .771.636A6.002 6.002 0 0 1 2.083 9H3.1z"/>
  145. </svg>
  146. <template>
  147. <a-textarea type="text" id='token' :disabled="!allSetting.secretEnable" v-model="user.loginSecret"></a-textarea>
  148. </template>
  149. </a-col>
  150. </a-row>
  151. </a-list-item>
  152. <a-button type="primary" @click="updateSecret">{{ i18n "confirm" }}</a-button>
  153. </a-form>
  154. </a-tab-pane>
  155. </a-tabs>
  156. </a-tab-pane>
  157. <a-tab-pane key="3" tab='{{ i18n "pages.settings.xrayConfiguration"}}'>
  158. <a-list item-layout="horizontal" :style="themeSwitcher.textStyle">
  159. <a-divider style="padding: 20px;">{{ i18n "pages.settings.actions"}}</a-divider>
  160. <a-space direction="horizontal" style="padding: 0px 20px">
  161. <a-button type="primary" @click="resetXrayConfigToDefault">{{ i18n "pages.settings.resetDefaultConfig" }}</a-button>
  162. </a-space>
  163. <a-divider style="padding: 20px;">{{ i18n "pages.settings.templates.title"}} </a-divider>
  164. <a-row :xs="24" :sm="24" :lg="12">
  165. <h2 class="alert-msg">
  166. <a-icon type="warning"></a-icon>
  167. {{ i18n "pages.settings.infoDesc" }}
  168. </h2>
  169. </a-row>
  170. <a-tabs class="ant-card-dark-box-nohover" default-active-key="tpl-1" :class="themeSwitcher.darkCardClass" style="padding: 20px 20px;">
  171. <a-tab-pane key="tpl-1" tab='{{ i18n "pages.settings.templates.basicTemplate"}}' style="padding-top: 20px;">
  172. <a-collapse>
  173. <a-collapse-panel header='{{ i18n "pages.settings.templates.generalConfigs"}}'>
  174. <a-row :xs="24" :sm="24" :lg="12">
  175. <h2 class="collapse-title">
  176. <a-icon type="warning"></a-icon>
  177. {{ i18n "pages.settings.templates.generalConfigsDesc" }}
  178. </h2>
  179. </a-row>
  180. <a-list-item>
  181. <a-row style="padding: 20px">
  182. <a-col :lg="24" :xl="12">
  183. <a-list-item-meta
  184. title='{{ i18n "pages.settings.templates.xrayConfigFreedomStrategy" }}'
  185. description='{{ i18n "pages.settings.templates.xrayConfigFreedomStrategyDesc" }}'/>
  186. </a-col>
  187. <a-col :lg="24" :xl="12">
  188. <template>
  189. <a-select
  190. v-model="freedomStrategy"
  191. :dropdown-class-name="themeSwitcher.darkCardClass"
  192. style="width: 100%">
  193. <a-select-option v-for="s in outboundDomainStrategies" :value="s">[[ s ]]</a-select-option>
  194. </a-select>
  195. </template>
  196. </a-col>
  197. </a-row>
  198. </a-list-item>
  199. <a-row style="padding: 20px">
  200. <a-col :lg="24" :xl="12">
  201. <a-list-item-meta
  202. title='{{ i18n "pages.settings.templates.xrayConfigRoutingStrategy" }}'
  203. description='{{ i18n "pages.settings.templates.xrayConfigRoutingStrategyDesc" }}'/>
  204. </a-col>
  205. <a-col :lg="24" :xl="12">
  206. <template>
  207. <a-select
  208. v-model="routingStrategy"
  209. :dropdown-class-name="themeSwitcher.darkCardClass"
  210. style="width: 100%">
  211. <a-select-option v-for="s in routingDomainStrategies" :value="s">[[ s ]]</a-select-option>
  212. </a-select>
  213. </template>
  214. </a-col>
  215. </a-row>
  216. </a-list-item>
  217. </a-collapse-panel>
  218. <a-collapse-panel header='{{ i18n "pages.settings.templates.blockConfigs"}}'>
  219. <a-row :xs="24" :sm="24" :lg="12">
  220. <h2 class="collapse-title">
  221. <a-icon type="warning"></a-icon>
  222. {{ i18n "pages.settings.templates.blockConfigsDesc" }}
  223. </h2>
  224. </a-row>
  225. <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigTorrent"}}' desc='{{ i18n "pages.settings.templates.xrayConfigTorrentDesc"}}' v-model="torrentSettings"></setting-list-item>
  226. <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigPrivateIp"}}' desc='{{ i18n "pages.settings.templates.xrayConfigPrivateIpDesc"}}' v-model="privateIpSettings"></setting-list-item>
  227. <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigAds"}}' desc='{{ i18n "pages.settings.templates.xrayConfigAdsDesc"}}' v-model="AdsSettings"></setting-list-item>
  228. <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigFamily"}}' desc='{{ i18n "pages.settings.templates.xrayConfigFamilyDesc"}}' v-model="familyProtectSettings"></setting-list-item>
  229. <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigSpeedtest"}}' desc='{{ i18n "pages.settings.templates.xrayConfigSpeedtestDesc"}}' v-model="SpeedTestSettings"></setting-list-item>
  230. </a-collapse-panel>
  231. <a-collapse-panel header='{{ i18n "pages.settings.templates.blockCountryConfigs"}}'>
  232. <a-row :xs="24" :sm="24" :lg="12">
  233. <h2 class="collapse-title">
  234. <a-icon type="warning"></a-icon>
  235. {{ i18n "pages.settings.templates.blockCountryConfigsDesc" }}
  236. </h2>
  237. </a-row>
  238. <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigIRIp"}}' desc='{{ i18n "pages.settings.templates.xrayConfigIRIpDesc"}}' v-model="IRIpSettings"></setting-list-item>
  239. <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigIRDomain"}}' desc='{{ i18n "pages.settings.templates.xrayConfigIRDomainDesc"}}' v-model="IRDomainSettings"></setting-list-item>
  240. <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigChinaIp"}}' desc='{{ i18n "pages.settings.templates.xrayConfigChinaIpDesc"}}' v-model="ChinaIpSettings"></setting-list-item>
  241. <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigChinaDomain"}}' desc='{{ i18n "pages.settings.templates.xrayConfigChinaDomainDesc"}}' v-model="ChinaDomainSettings"></setting-list-item>
  242. <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigRussiaIp"}}' desc='{{ i18n "pages.settings.templates.xrayConfigRussiaIpDesc"}}' v-model="RussiaIpSettings"></setting-list-item>
  243. <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigRussiaDomain"}}' desc='{{ i18n "pages.settings.templates.xrayConfigRussiaDomainDesc"}}' v-model="RussiaDomainSettings"></setting-list-item>
  244. </a-collapse-panel>
  245. <a-collapse-panel header='{{ i18n "pages.settings.templates.directCountryConfigs"}}'>
  246. <a-row :xs="24" :sm="24" :lg="12">
  247. <h2 class="collapse-title">
  248. <a-icon type="warning"></a-icon>
  249. {{ i18n "pages.settings.templates.directCountryConfigsDesc" }}
  250. </h2>
  251. </a-row>
  252. <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigDirectIRIp"}}' desc='{{ i18n "pages.settings.templates.xrayConfigDirectIRIpDesc"}}' v-model="IRIpDirectSettings"></setting-list-item>
  253. <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigDirectIRDomain"}}' desc='{{ i18n "pages.settings.templates.xrayConfigDirectIRDomainDesc"}}' v-model="IRDomainDirectSettings"></setting-list-item>
  254. <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigDirectChinaIp"}}' desc='{{ i18n "pages.settings.templates.xrayConfigDirectChinaIpDesc"}}' v-model="ChinaIpDirectSettings"></setting-list-item>
  255. <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigDirectChinaDomain"}}' desc='{{ i18n "pages.settings.templates.xrayConfigDirectChinaDomainDesc"}}' v-model="ChinaDomainDirectSettings"></setting-list-item>
  256. <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigDirectRussiaIp"}}' desc='{{ i18n "pages.settings.templates.xrayConfigDirectRussiaIpDesc"}}' v-model="RussiaIpDirectSettings"></setting-list-item>
  257. <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigDirectRussiaDomain"}}' desc='{{ i18n "pages.settings.templates.xrayConfigDirectRussiaDomainDesc"}}' v-model="RussiaDomainDirectSettings"></setting-list-item>
  258. </a-collapse-panel>
  259. <a-collapse-panel header='{{ i18n "pages.settings.templates.ipv4Configs"}}'>
  260. <a-row :xs="24" :sm="24" :lg="12">
  261. <h2 class="collapse-title">
  262. <a-icon type="warning"></a-icon>
  263. {{ i18n "pages.settings.templates.ipv4ConfigsDesc" }}
  264. </h2>
  265. </a-row>
  266. <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigGoogleIPv4"}}' desc='{{ i18n "pages.settings.templates.xrayConfigGoogleIPv4Desc"}}' v-model="GoogleIPv4Settings"></setting-list-item>
  267. <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigNetflixIPv4"}}' desc='{{ i18n "pages.settings.templates.xrayConfigNetflixIPv4Desc"}}' v-model="NetflixIPv4Settings"></setting-list-item>
  268. </a-collapse-panel>
  269. <a-collapse-panel header='{{ i18n "pages.settings.templates.warpConfigs"}}'>
  270. <a-row :xs="24" :sm="24" :lg="12">
  271. <h2 class="collapse-title">
  272. <a-icon type="warning"></a-icon>
  273. {{ i18n "pages.settings.templates.warpConfigsDesc" }}
  274. </h2>
  275. </a-row>
  276. <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigGoogleWARP"}}' desc='{{ i18n "pages.settings.templates.xrayConfigGoogleWARPDesc"}}' v-model="GoogleWARPSettings"></setting-list-item>
  277. <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigOpenAIWARP"}}' desc='{{ i18n "pages.settings.templates.xrayConfigOpenAIWARPDesc"}}' v-model="OpenAIWARPSettings"></setting-list-item>
  278. <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigNetflixWARP"}}' desc='{{ i18n "pages.settings.templates.xrayConfigNetflixWARPDesc"}}' v-model="NetflixWARPSettings"></setting-list-item>
  279. <setting-list-item type="switch" title='{{ i18n "pages.settings.templates.xrayConfigSpotifyWARP"}}' desc='{{ i18n "pages.settings.templates.xrayConfigSpotifyWARPDesc"}}' v-model="SpotifyWARPSettings"></setting-list-item>
  280. </a-collapse-panel>
  281. <a-collapse-panel header='{{ i18n "pages.settings.templates.manualLists"}}'>
  282. <a-row :xs="24" :sm="24" :lg="12">
  283. <h2 class="collapse-title">
  284. <a-icon type="warning"></a-icon>
  285. {{ i18n "pages.settings.templates.manualListsDesc" }}
  286. </h2>
  287. </a-row>
  288. <setting-list-item type="textarea" title='{{ i18n "pages.settings.templates.manualBlockedIPs"}}' v-model="manualBlockedIPs"></setting-list-item>
  289. <setting-list-item type="textarea" title='{{ i18n "pages.settings.templates.manualBlockedDomains"}}' v-model="manualBlockedDomains"></setting-list-item>
  290. <setting-list-item type="textarea" title='{{ i18n "pages.settings.templates.manualDirectIPs"}}' v-model="manualDirectIPs"></setting-list-item>
  291. <setting-list-item type="textarea" title='{{ i18n "pages.settings.templates.manualDirectDomains"}}' v-model="manualDirectDomains"></setting-list-item>
  292. </a-collapse-panel>
  293. </a-collapse>
  294. </a-tab-pane>
  295. <a-tab-pane key="tpl-2" tab='{{ i18n "pages.settings.templates.advancedTemplate"}}' style="padding-top: 20px;">
  296. <a-collapse>
  297. <a-collapse-panel header='{{ i18n "pages.settings.templates.xrayConfigInbounds"}}'>
  298. <setting-list-item type="textarea" title='{{ i18n "pages.settings.templates.xrayConfigInbounds"}}' desc='{{ i18n "pages.settings.templates.xrayConfigInboundsDesc"}}' v-model="inboundSettings"></setting-list-item>
  299. </a-collapse-panel>
  300. <a-collapse-panel header='{{ i18n "pages.settings.templates.xrayConfigOutbounds"}}'>
  301. <setting-list-item type="textarea" title='{{ i18n "pages.settings.templates.xrayConfigOutbounds"}}' desc='{{ i18n "pages.settings.templates.xrayConfigOutboundsDesc"}}' v-model="outboundSettings"></setting-list-item>
  302. </a-collapse-panel>
  303. <a-collapse-panel header='{{ i18n "pages.settings.templates.xrayConfigRoutings"}}'>
  304. <setting-list-item type="textarea" title='{{ i18n "pages.settings.templates.xrayConfigRoutings"}}' desc='{{ i18n "pages.settings.templates.xrayConfigRoutingsDesc"}}' v-model="routingRuleSettings"></setting-list-item>
  305. </a-collapse-panel>
  306. </a-collapse>
  307. </a-tab-pane>
  308. <a-tab-pane key="tpl-3" tab='{{ i18n "pages.settings.templates.completeTemplate"}}' style="padding-top: 20px;">
  309. <setting-list-item type="textarea" title='{{ i18n "pages.settings.templates.xrayConfigTemplate"}}' desc='{{ i18n "pages.settings.templates.xrayConfigTemplateDesc"}}' v-model="allSetting.xrayTemplateConfig"></setting-list-item>
  310. </a-tab-pane>
  311. </a-tabs>
  312. </a-list>
  313. </a-tab-pane>
  314. <a-tab-pane key="4" tab='{{ i18n "pages.settings.TGBotSettings"}}'>
  315. <a-row :xs="24" :sm="24" :lg="12">
  316. <h2 class="alert-msg">
  317. <a-icon type="warning"></a-icon>
  318. {{ i18n "pages.settings.infoDesc" }}
  319. </h2>
  320. </a-row>
  321. <a-list item-layout="horizontal" :style="themeSwitcher.textStyle">
  322. <setting-list-item type="switch" title='{{ i18n "pages.settings.telegramBotEnable" }}' desc='{{ i18n "pages.settings.telegramBotEnableDesc" }}' v-model="allSetting.tgBotEnable"></setting-list-item>
  323. <setting-list-item type="text" title='{{ i18n "pages.settings.telegramToken"}}' desc='{{ i18n "pages.settings.telegramTokenDesc"}}' v-model="allSetting.tgBotToken"></setting-list-item>
  324. <setting-list-item type="text" title='{{ i18n "pages.settings.telegramChatId"}}' desc='{{ i18n "pages.settings.telegramChatIdDesc"}}' v-model="allSetting.tgBotChatId"></setting-list-item>
  325. <setting-list-item type="text" title='{{ i18n "pages.settings.telegramNotifyTime"}}' desc='{{ i18n "pages.settings.telegramNotifyTimeDesc"}}' v-model="allSetting.tgRunTime"></setting-list-item>
  326. <setting-list-item type="switch" title='{{ i18n "pages.settings.tgNotifyBackup" }}' desc='{{ i18n "pages.settings.tgNotifyBackupDesc" }}' v-model="allSetting.tgBotBackup"></setting-list-item>
  327. <setting-list-item type="number" title='{{ i18n "pages.settings.tgNotifyCpu" }}' desc='{{ i18n "pages.settings.tgNotifyCpuDesc" }}' v-model="allSetting.tgCpu" :min="0" :max="100"></setting-list-item>
  328. </a-list>
  329. </a-tab-pane>
  330. </a-tabs>
  331. </a-space>
  332. </a-spin>
  333. </a-layout-content>
  334. </a-layout>
  335. </a-layout>
  336. {{template "js" .}}
  337. {{template "component/themeSwitcher" .}}
  338. {{template "component/password" .}}
  339. {{template "component/setting"}}
  340. <script>
  341. const app = new Vue({
  342. delimiters: ['[[', ']]'],
  343. el: '#app',
  344. data: {
  345. siderDrawer,
  346. themeSwitcher,
  347. spinning: false,
  348. oldAllSetting: new AllSetting(),
  349. allSetting: new AllSetting(),
  350. saveBtnDisable: true,
  351. user: new User(),
  352. lang: getLang(),
  353. ipv4Settings: {
  354. tag: "IPv4",
  355. protocol: "freedom",
  356. settings: {
  357. domainStrategy: "UseIPv4"
  358. }
  359. },
  360. warpSettings: {
  361. tag: "WARP",
  362. protocol: "socks",
  363. settings: {
  364. servers: [
  365. {
  366. address: "127.0.0.1",
  367. port: 40000
  368. }
  369. ]
  370. }
  371. },
  372. directSettings: {
  373. tag: "direct",
  374. protocol: "freedom"
  375. },
  376. outboundDomainStrategies: ["AsIs", "UseIP", "UseIPv4", "UseIPv6"],
  377. routingDomainStrategies: ["AsIs", "IPIfNonMatch", "IPOnDemand"],
  378. settingsData: {
  379. protocols: {
  380. bittorrent: ["bittorrent"],
  381. },
  382. ips: {
  383. local: ["geoip:private"],
  384. cn: ["geoip:cn"],
  385. ir: ["geoip:ir"],
  386. ru: ["geoip:ru"],
  387. },
  388. domains: {
  389. ads: [
  390. "geosite:category-ads-all",
  391. "ext:iran.dat:ads"
  392. ],
  393. speedtest: ["geosite:speedtest"],
  394. openai: ["geosite:openai"],
  395. google: ["geosite:google"],
  396. spotify: ["geosite:spotify"],
  397. netflix: ["geosite:netflix"],
  398. cn: [
  399. "geosite:cn",
  400. "regexp:.*\\.cn$"
  401. ],
  402. ru: [
  403. "geosite:category-gov-ru",
  404. "regexp:.*\\.ru$"
  405. ],
  406. ir: [
  407. "regexp:.*\\.ir$",
  408. "ext:iran.dat:ir",
  409. "ext:iran.dat:other",
  410. "geosite:category-ir"
  411. ]
  412. },
  413. familyProtectDNS: {
  414. "servers": [
  415. "1.1.1.3", // https://developers.cloudflare.com/1.1.1.1/setup/
  416. "1.0.0.3",
  417. "94.140.14.15", // https://adguard-dns.io/kb/general/dns-providers/
  418. "94.140.15.16"
  419. ],
  420. "queryStrategy": "UseIPv4"
  421. },
  422. }
  423. },
  424. methods: {
  425. loading(spinning = true) {
  426. this.spinning = spinning;
  427. },
  428. async getAllSetting() {
  429. this.loading(true);
  430. const msg = await HttpUtil.post("/panel/setting/all");
  431. this.loading(false);
  432. if (msg.success) {
  433. this.oldAllSetting = new AllSetting(msg.obj);
  434. this.allSetting = new AllSetting(msg.obj);
  435. this.saveBtnDisable = true;
  436. }
  437. await this.fetchUserSecret();
  438. },
  439. async updateAllSetting() {
  440. this.loading(true);
  441. const msg = await HttpUtil.post("/panel/setting/update", this.allSetting);
  442. this.loading(false);
  443. if (msg.success) {
  444. await this.getAllSetting();
  445. }
  446. },
  447. async updateUser() {
  448. this.loading(true);
  449. const msg = await HttpUtil.post("/panel/setting/updateUser", this.user);
  450. this.loading(false);
  451. if (msg.success) {
  452. this.user = {};
  453. window.location.replace(basePath + "logout")
  454. }
  455. },
  456. async restartPanel() {
  457. await new Promise(resolve => {
  458. this.$confirm({
  459. title: '{{ i18n "pages.settings.restartPanel" }}',
  460. content: '{{ i18n "pages.settings.restartPanelDesc" }}',
  461. okText: '{{ i18n "sure" }}',
  462. cancelText: '{{ i18n "cancel" }}',
  463. onOk: () => resolve(),
  464. });
  465. });
  466. this.loading(true);
  467. const msg = await HttpUtil.post("/panel/setting/restartPanel");
  468. this.loading(false);
  469. if (msg.success) {
  470. this.loading(true);
  471. await PromiseUtil.sleep(5000);
  472. window.location.replace(this.allSetting.webBasePath + "panel/settings");
  473. }
  474. },
  475. async fetchUserSecret() {
  476. this.loading(true);
  477. const userMessage = await HttpUtil.post("/panel/setting/getUserSecret", this.user);
  478. if (userMessage.success) {
  479. this.user = userMessage.obj;
  480. }
  481. this.loading(false);
  482. },
  483. async updateSecret() {
  484. this.loading(true);
  485. const msg = await HttpUtil.post("/panel/setting/updateUserSecret", this.user);
  486. if (msg.success) {
  487. this.user = msg.obj;
  488. window.location.replace(basePath + "logout");
  489. }
  490. this.loading(false);
  491. await this.updateAllSetting();
  492. },
  493. generateRandomString(length) {
  494. var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
  495. let randomString = "";
  496. for (let i = 0; i < length; i++) {
  497. randomString += chars[Math.floor(Math.random() * chars.length)];
  498. }
  499. return randomString;
  500. },
  501. async getNewSecret() {
  502. this.loading(true);
  503. await PromiseUtil.sleep(600);
  504. const newSecret = this.generateRandomString(64);
  505. this.user.loginSecret = newSecret;
  506. document.getElementById("token").textContent = newSecret;
  507. this.loading(false);
  508. },
  509. async toggleToken(value) {
  510. if (value) {
  511. await this.getNewSecret();
  512. } else {
  513. this.user.loginSecret = "";
  514. }
  515. },
  516. async resetXrayConfigToDefault() {
  517. this.loading(true);
  518. const msg = await HttpUtil.get("/panel/setting/getDefaultJsonConfig");
  519. this.loading(false);
  520. if (msg.success) {
  521. this.templateSettings = JSON.parse(JSON.stringify(msg.obj, null, 2));
  522. this.saveBtnDisable = true;
  523. }
  524. },
  525. syncRulesWithOutbound(tag, setting) {
  526. const newTemplateSettings = {...this.templateSettings};
  527. const haveRules = newTemplateSettings.routing.rules.some((r) => r?.outboundTag === tag);
  528. const outboundIndex = newTemplateSettings.outbounds.findIndex((o) => o.tag === tag);
  529. if (!haveRules && outboundIndex >= 0) {
  530. newTemplateSettings.outbounds.splice(outboundIndex, 1);
  531. }
  532. if (haveRules && outboundIndex === -1) {
  533. newTemplateSettings.outbounds.push(setting);
  534. }
  535. this.templateSettings = newTemplateSettings;
  536. },
  537. templateRuleGetter(routeSettings) {
  538. const { property, outboundTag } = routeSettings;
  539. let result = [];
  540. if (this.templateSettings != null) {
  541. this.templateSettings.routing.rules.forEach(
  542. (routingRule) => {
  543. if (
  544. routingRule.hasOwnProperty(property) &&
  545. routingRule.hasOwnProperty("outboundTag") &&
  546. routingRule.outboundTag === outboundTag
  547. ) {
  548. result.push(...routingRule[property]);
  549. }
  550. }
  551. );
  552. }
  553. return result;
  554. },
  555. templateRuleSetter(routeSettings) {
  556. const { data, property, outboundTag } = routeSettings;
  557. const oldTemplateSettings = this.templateSettings;
  558. const newTemplateSettings = oldTemplateSettings;
  559. currentProperty = this.templateRuleGetter({ outboundTag, property })
  560. if (currentProperty.length == 0) {
  561. const propertyRule = {
  562. type: "field",
  563. outboundTag,
  564. [property]: data
  565. };
  566. newTemplateSettings.routing.rules.push(propertyRule);
  567. }
  568. else {
  569. const newRules = [];
  570. insertedOnce = false;
  571. newTemplateSettings.routing.rules.forEach(
  572. (routingRule) => {
  573. if (
  574. routingRule.hasOwnProperty(property) &&
  575. routingRule.hasOwnProperty("outboundTag") &&
  576. routingRule.outboundTag === outboundTag
  577. ) {
  578. if (!insertedOnce && data.length > 0) {
  579. insertedOnce = true;
  580. routingRule[property] = data;
  581. newRules.push(routingRule);
  582. }
  583. }
  584. else {
  585. newRules.push(routingRule);
  586. }
  587. }
  588. );
  589. newTemplateSettings.routing.rules = newRules;
  590. }
  591. this.templateSettings = newTemplateSettings;
  592. }
  593. },
  594. async mounted() {
  595. await this.getAllSetting();
  596. while (true) {
  597. await PromiseUtil.sleep(600);
  598. this.saveBtnDisable = this.oldAllSetting.equals(this.allSetting);
  599. }
  600. },
  601. computed: {
  602. templateSettings: {
  603. get: function () { return this.allSetting.xrayTemplateConfig ? JSON.parse(this.allSetting.xrayTemplateConfig) : null; },
  604. set: function (newValue) { this.allSetting.xrayTemplateConfig = JSON.stringify(newValue, null, 2) },
  605. },
  606. inboundSettings: {
  607. get: function () { return this.templateSettings ? JSON.stringify(this.templateSettings.inbounds, null, 2) : null; },
  608. set: function (newValue) {
  609. newTemplateSettings = this.templateSettings;
  610. newTemplateSettings.inbounds = JSON.parse(newValue)
  611. this.templateSettings = newTemplateSettings
  612. },
  613. },
  614. outboundSettings: {
  615. get: function () { return this.templateSettings ? JSON.stringify(this.templateSettings.outbounds, null, 2) : null; },
  616. set: function (newValue) {
  617. newTemplateSettings = this.templateSettings;
  618. newTemplateSettings.outbounds = JSON.parse(newValue)
  619. this.templateSettings = newTemplateSettings
  620. },
  621. },
  622. routingRuleSettings: {
  623. get: function () { return this.templateSettings ? JSON.stringify(this.templateSettings.routing.rules, null, 2) : null; },
  624. set: function (newValue) {
  625. newTemplateSettings = this.templateSettings;
  626. newTemplateSettings.routing.rules = JSON.parse(newValue)
  627. this.templateSettings = newTemplateSettings
  628. },
  629. },
  630. freedomStrategy: {
  631. get: function () {
  632. if (!this.templateSettings) return "AsIs";
  633. freedomOutbound = this.templateSettings.outbounds.find((o) => o.protocol === "freedom" && !o.tag);
  634. if (!freedomOutbound) return "AsIs";
  635. if (!freedomOutbound.settings || !freedomOutbound.settings.domainStrategy) return "AsIs";
  636. return freedomOutbound.settings.domainStrategy;
  637. },
  638. set: function (newValue) {
  639. newTemplateSettings = this.templateSettings;
  640. freedomOutboundIndex = newTemplateSettings.outbounds.findIndex((o) => o.protocol === "freedom" && !o.tag);
  641. if (!newTemplateSettings.outbounds[freedomOutboundIndex].settings) {
  642. newTemplateSettings.outbounds[freedomOutboundIndex].settings = {"domainStrategy": newValue};
  643. } else {
  644. newTemplateSettings.outbounds[freedomOutboundIndex].settings.domainStrategy = newValue;
  645. }
  646. this.templateSettings = newTemplateSettings;
  647. }
  648. },
  649. routingStrategy: {
  650. get: function () {
  651. if (!this.templateSettings || !this.templateSettings.routing || !this.templateSettings.routing.domainStrategy) return "AsIs";
  652. return this.templateSettings.routing.domainStrategy;
  653. },
  654. set: function (newValue) {
  655. newTemplateSettings = this.templateSettings;
  656. newTemplateSettings.routing.domainStrategy = newValue;
  657. this.templateSettings = newTemplateSettings;
  658. }
  659. },
  660. blockedIPs: {
  661. get: function () {
  662. return this.templateRuleGetter({ outboundTag: "blocked", property: "ip" });
  663. },
  664. set: function (newValue) {
  665. this.templateRuleSetter({ outboundTag: "blocked", property: "ip", data: newValue });
  666. }
  667. },
  668. blockedDomains: {
  669. get: function () {
  670. return this.templateRuleGetter({ outboundTag: "blocked", property: "domain" });
  671. },
  672. set: function (newValue) {
  673. this.templateRuleSetter({ outboundTag: "blocked", property: "domain", data: newValue });
  674. }
  675. },
  676. blockedProtocols: {
  677. get: function () {
  678. return this.templateRuleGetter({ outboundTag: "blocked", property: "protocol" });
  679. },
  680. set: function (newValue) {
  681. this.templateRuleSetter({ outboundTag: "blocked", property: "protocol", data: newValue });
  682. }
  683. },
  684. directIPs: {
  685. get: function () {
  686. return this.templateRuleGetter({ outboundTag: "direct", property: "ip" });
  687. },
  688. set: function (newValue) {
  689. this.templateRuleSetter({ outboundTag: "direct", property: "ip", data: newValue });
  690. this.syncRulesWithOutbound("direct", this.directSettings);
  691. }
  692. },
  693. directDomains: {
  694. get: function () {
  695. return this.templateRuleGetter({ outboundTag: "direct", property: "domain" });
  696. },
  697. set: function (newValue) {
  698. this.templateRuleSetter({ outboundTag: "direct", property: "domain", data: newValue });
  699. this.syncRulesWithOutbound("direct", this.directSettings);
  700. }
  701. },
  702. manualBlockedIPs: {
  703. get: function () { return JSON.stringify(this.blockedIPs, null, 2); },
  704. set: debounce(function (value) { this.blockedIPs = JSON.parse(value); }, 1000)
  705. },
  706. manualBlockedDomains: {
  707. get: function () { return JSON.stringify(this.blockedDomains, null, 2); },
  708. set: debounce(function (value) { this.blockedDomains = JSON.parse(value); }, 1000)
  709. },
  710. manualDirectIPs: {
  711. get: function () { return JSON.stringify(this.directIPs, null, 2); },
  712. set: debounce(function (value) { this.directIPs = JSON.parse(value); }, 1000)
  713. },
  714. manualDirectDomains: {
  715. get: function () { return JSON.stringify(this.directDomains, null, 2); },
  716. set: debounce(function (value) { this.directDomains = JSON.parse(value); }, 1000)
  717. },
  718. torrentSettings: {
  719. get: function () {
  720. return doAllItemsExist(this.settingsData.protocols.bittorrent, this.blockedProtocols);
  721. },
  722. set: function (newValue) {
  723. if (newValue) {
  724. this.blockedProtocols = [...this.blockedProtocols, ...this.settingsData.protocols.bittorrent];
  725. } else {
  726. this.blockedProtocols = this.blockedProtocols.filter(data => !this.settingsData.protocols.bittorrent.includes(data));
  727. }
  728. },
  729. },
  730. privateIpSettings: {
  731. get: function () {
  732. return doAllItemsExist(this.settingsData.ips.local, this.blockedIPs);
  733. },
  734. set: function (newValue) {
  735. if (newValue) {
  736. this.blockedIPs = [...this.blockedIPs, ...this.settingsData.ips.local];
  737. } else {
  738. this.blockedIPs = this.blockedIPs.filter(data => !this.settingsData.ips.local.includes(data));
  739. }
  740. },
  741. },
  742. AdsSettings: {
  743. get: function () {
  744. return doAllItemsExist(this.settingsData.domains.ads, this.blockedDomains);
  745. },
  746. set: function (newValue) {
  747. if (newValue) {
  748. this.blockedDomains = [...this.blockedDomains, ...this.settingsData.domains.ads];
  749. } else {
  750. this.blockedDomains = this.blockedDomains.filter(data => !this.settingsData.domains.ads.includes(data));
  751. }
  752. },
  753. },
  754. SpeedTestSettings: {
  755. get: function () {
  756. return doAllItemsExist(this.settingsData.domains.speedtest, this.blockedDomains);
  757. },
  758. set: function (newValue) {
  759. if (newValue) {
  760. this.blockedDomains = [...this.blockedDomains, ...this.settingsData.domains.speedtest];
  761. } else {
  762. this.blockedDomains = this.blockedDomains.filter(data => !this.settingsData.domains.speedtest.includes(data));
  763. }
  764. },
  765. },
  766. familyProtectSettings: {
  767. get: function () {
  768. if (!this.templateSettings || !this.templateSettings.dns || !this.templateSettings.dns.servers) return false;
  769. return doAllItemsExist(this.templateSettings.dns.servers, this.settingsData.familyProtectDNS.servers);
  770. },
  771. set: function (newValue) {
  772. newTemplateSettings = this.templateSettings;
  773. if (newValue) {
  774. newTemplateSettings.dns = this.settingsData.familyProtectDNS;
  775. } else {
  776. delete newTemplateSettings.dns;
  777. }
  778. this.templateSettings = newTemplateSettings;
  779. },
  780. },
  781. GoogleIPv4Settings: {
  782. get: function () {
  783. return doAllItemsExist(this.settingsData.domains.google, this.templateRuleGetter({ outboundTag: "IPv4", property: "domain" }));
  784. },
  785. set: function (newValue) {
  786. oldData = this.templateRuleGetter({ outboundTag: "IPv4", property: "domain" });
  787. if (newValue) {
  788. oldData = [...oldData, ...this.settingsData.domains.google];
  789. } else {
  790. oldData = oldData.filter(data => !this.settingsData.domains.google.includes(data))
  791. }
  792. this.templateRuleSetter({
  793. outboundTag: "IPv4",
  794. property: "domain",
  795. data: oldData
  796. });
  797. this.syncRulesWithOutbound("IPv4", this.ipv4Settings);
  798. },
  799. },
  800. NetflixIPv4Settings: {
  801. get: function () {
  802. return doAllItemsExist(this.settingsData.domains.netflix, this.templateRuleGetter({ outboundTag: "IPv4", property: "domain" }));
  803. },
  804. set: function (newValue) {
  805. oldData = this.templateRuleGetter({ outboundTag: "IPv4", property: "domain" });
  806. if (newValue) {
  807. oldData = [...oldData, ...this.settingsData.domains.netflix];
  808. } else {
  809. oldData = oldData.filter(data => !this.settingsData.domains.netflix.includes(data))
  810. }
  811. this.templateRuleSetter({
  812. outboundTag: "IPv4",
  813. property: "domain",
  814. data: oldData
  815. });
  816. this.syncRulesWithOutbound("IPv4", this.ipv4Settings);
  817. },
  818. },
  819. IRIpSettings: {
  820. get: function () {
  821. return doAllItemsExist(this.settingsData.ips.ir, this.blockedIPs);
  822. },
  823. set: function (newValue) {
  824. if (newValue) {
  825. this.blockedIPs = [...this.blockedIPs, ...this.settingsData.ips.ir];
  826. } else {
  827. this.blockedIPs = this.blockedIPs.filter(data => !this.settingsData.ips.ir.includes(data));
  828. }
  829. }
  830. },
  831. IRDomainSettings: {
  832. get: function () {
  833. return doAllItemsExist(this.settingsData.domains.ir, this.blockedDomains);
  834. },
  835. set: function (newValue) {
  836. if (newValue) {
  837. this.blockedDomains = [...this.blockedDomains, ...this.settingsData.domains.ir];
  838. } else {
  839. this.blockedDomains = this.blockedDomains.filter(data => !this.settingsData.domains.ir.includes(data));
  840. }
  841. }
  842. },
  843. ChinaIpSettings: {
  844. get: function () {
  845. return doAllItemsExist(this.settingsData.ips.cn, this.blockedIPs);
  846. },
  847. set: function (newValue) {
  848. if (newValue) {
  849. this.blockedIPs = [...this.blockedIPs, ...this.settingsData.ips.cn];
  850. } else {
  851. this.blockedIPs = this.blockedIPs.filter(data => !this.settingsData.ips.cn.includes(data));
  852. }
  853. }
  854. },
  855. ChinaDomainSettings: {
  856. get: function () {
  857. return doAllItemsExist(this.settingsData.domains.cn, this.blockedDomains);
  858. },
  859. set: function (newValue) {
  860. if (newValue) {
  861. this.blockedDomains = [...this.blockedDomains, ...this.settingsData.domains.cn];
  862. } else {
  863. this.blockedDomains = this.blockedDomains.filter(data => !this.settingsData.domains.cn.includes(data));
  864. }
  865. }
  866. },
  867. RussiaIpSettings: {
  868. get: function () {
  869. return doAllItemsExist(this.settingsData.ips.ru, this.blockedIPs);
  870. },
  871. set: function (newValue) {
  872. if (newValue) {
  873. this.blockedIPs = [...this.blockedIPs, ...this.settingsData.ips.ru];
  874. } else {
  875. this.blockedIPs = this.blockedIPs.filter(data => !this.settingsData.ips.ru.includes(data));
  876. }
  877. }
  878. },
  879. RussiaDomainSettings: {
  880. get: function () {
  881. return doAllItemsExist(this.settingsData.domains.ru, this.blockedDomains);
  882. },
  883. set: function (newValue) {
  884. if (newValue) {
  885. this.blockedDomains = [...this.blockedDomains, ...this.settingsData.domains.ru];
  886. } else {
  887. this.blockedDomains = this.blockedDomains.filter(data => !this.settingsData.domains.ru.includes(data));
  888. }
  889. }
  890. },
  891. IRIpDirectSettings: {
  892. get: function () {
  893. return doAllItemsExist(this.settingsData.ips.ir, this.directIPs);
  894. },
  895. set: function (newValue) {
  896. if (newValue) {
  897. this.directIPs = [...this.directIPs, ...this.settingsData.ips.ir];
  898. } else {
  899. this.directIPs = this.directIPs.filter(data => !this.settingsData.ips.ir.includes(data));
  900. }
  901. }
  902. },
  903. IRDomainDirectSettings: {
  904. get: function () {
  905. return doAllItemsExist(this.settingsData.domains.ir, this.directDomains);
  906. },
  907. set: function (newValue) {
  908. if (newValue) {
  909. this.directDomains = [...this.directDomains, ...this.settingsData.domains.ir];
  910. } else {
  911. this.directDomains = this.directDomains.filter(data => !this.settingsData.domains.ir.includes(data));
  912. }
  913. }
  914. },
  915. ChinaIpDirectSettings: {
  916. get: function () {
  917. return doAllItemsExist(this.settingsData.ips.cn, this.directIPs);
  918. },
  919. set: function (newValue) {
  920. if (newValue) {
  921. this.directIPs = [...this.directIPs, ...this.settingsData.ips.cn];
  922. } else {
  923. this.directIPs = this.directIPs.filter(data => !this.settingsData.ips.cn.includes(data));
  924. }
  925. }
  926. },
  927. ChinaDomainDirectSettings: {
  928. get: function () {
  929. return doAllItemsExist(this.settingsData.domains.cn, this.directDomains);
  930. },
  931. set: function (newValue) {
  932. if (newValue) {
  933. this.directDomains = [...this.directDomains, ...this.settingsData.domains.cn];
  934. } else {
  935. this.directDomains = this.directDomains.filter(data => !this.settingsData.domains.cn.includes(data));
  936. }
  937. }
  938. },
  939. RussiaIpDirectSettings: {
  940. get: function () {
  941. return doAllItemsExist(this.settingsData.ips.ru, this.directIPs);
  942. },
  943. set: function (newValue) {
  944. if (newValue) {
  945. this.directIPs = [...this.directIPs, ...this.settingsData.ips.ru];
  946. } else {
  947. this.directIPs = this.directIPs.filter(data => !this.settingsData.ips.ru.includes(data));
  948. }
  949. }
  950. },
  951. RussiaDomainDirectSettings: {
  952. get: function () {
  953. return doAllItemsExist(this.settingsData.domains.ru, this.directDomains);
  954. },
  955. set: function (newValue) {
  956. if (newValue) {
  957. this.directDomains = [...this.directDomains, ...this.settingsData.domains.ru];
  958. } else {
  959. this.directDomains = this.directDomains.filter(data => !this.settingsData.domains.ru.includes(data));
  960. }
  961. }
  962. },
  963. GoogleWARPSettings: {
  964. get: function () {
  965. return doAllItemsExist(this.settingsData.domains.google, this.templateRuleGetter({ outboundTag: "WARP", property: "domain" }));
  966. },
  967. set: function (newValue) {
  968. oldData = this.templateRuleGetter({ outboundTag: "WARP", property: "domain" });
  969. if (newValue) {
  970. oldData = [...oldData, ...this.settingsData.domains.google];
  971. } else {
  972. oldData = oldData.filter(data => !this.settingsData.domains.google.includes(data))
  973. }
  974. this.templateRuleSetter({
  975. outboundTag: "WARP",
  976. property: "domain",
  977. data: oldData
  978. });
  979. this.syncRulesWithOutbound("WARP", this.warpSettings);
  980. },
  981. },
  982. OpenAIWARPSettings: {
  983. get: function () {
  984. return doAllItemsExist(this.settingsData.domains.openai, this.templateRuleGetter({ outboundTag: "WARP", property: "domain" }));
  985. },
  986. set: function (newValue) {
  987. oldData = this.templateRuleGetter({ outboundTag: "WARP", property: "domain" });
  988. if (newValue) {
  989. oldData = [...oldData, ...this.settingsData.domains.openai];
  990. } else {
  991. oldData = oldData.filter(data => !this.settingsData.domains.openai.includes(data))
  992. }
  993. this.templateRuleSetter({
  994. outboundTag: "WARP",
  995. property: "domain",
  996. data: oldData
  997. });
  998. this.syncRulesWithOutbound("WARP", this.warpSettings);
  999. },
  1000. },
  1001. NetflixWARPSettings: {
  1002. get: function () {
  1003. return doAllItemsExist(this.settingsData.domains.netflix, this.templateRuleGetter({ outboundTag: "WARP", property: "domain" }));
  1004. },
  1005. set: function (newValue) {
  1006. oldData = this.templateRuleGetter({ outboundTag: "WARP", property: "domain" });
  1007. if (newValue) {
  1008. oldData = [...oldData, ...this.settingsData.domains.netflix];
  1009. } else {
  1010. oldData = oldData.filter(data => !this.settingsData.domains.netflix.includes(data))
  1011. }
  1012. this.templateRuleSetter({
  1013. outboundTag: "WARP",
  1014. property: "domain",
  1015. data: oldData
  1016. });
  1017. this.syncRulesWithOutbound("WARP", this.warpSettings);
  1018. },
  1019. },
  1020. SpotifyWARPSettings: {
  1021. get: function () {
  1022. return doAllItemsExist(this.settingsData.domains.spotify, this.templateRuleGetter({ outboundTag: "WARP", property: "domain" }));
  1023. },
  1024. set: function (newValue) {
  1025. oldData = this.templateRuleGetter({ outboundTag: "WARP", property: "domain" });
  1026. if (newValue) {
  1027. oldData = [...oldData, ...this.settingsData.domains.spotify];
  1028. } else {
  1029. oldData = oldData.filter(data => !this.settingsData.domains.spotify.includes(data))
  1030. }
  1031. this.templateRuleSetter({
  1032. outboundTag: "WARP",
  1033. property: "domain",
  1034. data: oldData
  1035. });
  1036. this.syncRulesWithOutbound("WARP", this.warpSettings);
  1037. },
  1038. },
  1039. },
  1040. });
  1041. </script>
  1042. </body>
  1043. </html>