settings.html 68 KB

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