1
0

settings.html 67 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086
  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. <setting-list-item type="textarea" title='{{ i18n "pages.settings.templates.manualIPv4Domains"}}' v-model="manualIPv4Domains"></setting-list-item>
  293. <setting-list-item type="textarea" title='{{ i18n "pages.settings.templates.manualWARPDomains"}}' v-model="manualWARPDomains"></setting-list-item>
  294. </a-collapse-panel>
  295. </a-collapse>
  296. </a-tab-pane>
  297. <a-tab-pane key="tpl-2" tab='{{ i18n "pages.settings.templates.advancedTemplate"}}' style="padding-top: 20px;">
  298. <a-collapse>
  299. <a-collapse-panel header='{{ i18n "pages.settings.templates.xrayConfigInbounds"}}'>
  300. <setting-list-item type="textarea" title='{{ i18n "pages.settings.templates.xrayConfigInbounds"}}' desc='{{ i18n "pages.settings.templates.xrayConfigInboundsDesc"}}' v-model="inboundSettings"></setting-list-item>
  301. </a-collapse-panel>
  302. <a-collapse-panel header='{{ i18n "pages.settings.templates.xrayConfigOutbounds"}}'>
  303. <setting-list-item type="textarea" title='{{ i18n "pages.settings.templates.xrayConfigOutbounds"}}' desc='{{ i18n "pages.settings.templates.xrayConfigOutboundsDesc"}}' v-model="outboundSettings"></setting-list-item>
  304. </a-collapse-panel>
  305. <a-collapse-panel header='{{ i18n "pages.settings.templates.xrayConfigRoutings"}}'>
  306. <setting-list-item type="textarea" title='{{ i18n "pages.settings.templates.xrayConfigRoutings"}}' desc='{{ i18n "pages.settings.templates.xrayConfigRoutingsDesc"}}' v-model="routingRuleSettings"></setting-list-item>
  307. </a-collapse-panel>
  308. </a-collapse>
  309. </a-tab-pane>
  310. <a-tab-pane key="tpl-3" tab='{{ i18n "pages.settings.templates.completeTemplate"}}' style="padding-top: 20px;">
  311. <setting-list-item type="textarea" title='{{ i18n "pages.settings.templates.xrayConfigTemplate"}}' desc='{{ i18n "pages.settings.templates.xrayConfigTemplateDesc"}}' v-model="allSetting.xrayTemplateConfig"></setting-list-item>
  312. </a-tab-pane>
  313. </a-tabs>
  314. </a-list>
  315. </a-tab-pane>
  316. <a-tab-pane key="4" tab='{{ i18n "pages.settings.TGBotSettings"}}'>
  317. <a-row :xs="24" :sm="24" :lg="12">
  318. <h2 class="alert-msg">
  319. <a-icon type="warning"></a-icon>
  320. {{ i18n "pages.settings.infoDesc" }}
  321. </h2>
  322. </a-row>
  323. <a-list item-layout="horizontal" :style="themeSwitcher.textStyle">
  324. <setting-list-item type="switch" title='{{ i18n "pages.settings.telegramBotEnable" }}' desc='{{ i18n "pages.settings.telegramBotEnableDesc" }}' v-model="allSetting.tgBotEnable"></setting-list-item>
  325. <setting-list-item type="text" title='{{ i18n "pages.settings.telegramToken"}}' desc='{{ i18n "pages.settings.telegramTokenDesc"}}' v-model="allSetting.tgBotToken"></setting-list-item>
  326. <setting-list-item type="text" title='{{ i18n "pages.settings.telegramChatId"}}' desc='{{ i18n "pages.settings.telegramChatIdDesc"}}' v-model="allSetting.tgBotChatId"></setting-list-item>
  327. <setting-list-item type="text" title='{{ i18n "pages.settings.telegramNotifyTime"}}' desc='{{ i18n "pages.settings.telegramNotifyTimeDesc"}}' v-model="allSetting.tgRunTime"></setting-list-item>
  328. <setting-list-item type="switch" title='{{ i18n "pages.settings.tgNotifyBackup" }}' desc='{{ i18n "pages.settings.tgNotifyBackupDesc" }}' v-model="allSetting.tgBotBackup"></setting-list-item>
  329. <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>
  330. <a-list-item>
  331. <a-row style="padding: 20px">
  332. <a-col :lg="24" :xl="12">
  333. <a-list-item-meta title="Telegram Bot Language" />
  334. </a-col>
  335. <a-col :lg="24" :xl="12">
  336. <template>
  337. <a-select
  338. ref="selectBotLang"
  339. v-model="allSetting.tgLang"
  340. :dropdown-class-name="themeSwitcher.darkCardClass"
  341. style="width: 100%"
  342. >
  343. <a-select-option :value="l.value" :label="l.value" v-for="l in supportLangs">
  344. <span role="img" aria-label="l.name" v-text="l.icon"></span>
  345. &nbsp;&nbsp;<span v-text="l.name"></span>
  346. </a-select-option>
  347. </a-select>
  348. </template>
  349. </a-col>
  350. </a-row>
  351. </a-list-item>
  352. </a-list>
  353. </a-tab-pane>
  354. <a-tab-pane key="5" tab='{{ i18n "pages.settings.subSettings" }}'>
  355. <a-row :xs="24" :sm="24" :lg="12">
  356. <h2 style="color: inherit; font-weight: bold; font-size: 18px; padding: 20px 20px; text-align: center;">
  357. <a-icon type="warning" style="color: inherit; font-size: 24px;"></a-icon>
  358. {{ i18n "pages.settings.infoDesc" }}
  359. </h2>
  360. </a-row>
  361. <a-list item-layout="horizontal" :style="themeSwitcher.textStyle">
  362. <setting-list-item type="switch" title='{{ i18n "pages.settings.subEnable"}}' desc='{{ i18n "pages.settings.subEnableDesc"}}' v-model="allSetting.subEnable"></setting-list-item>
  363. <setting-list-item type="text" title='{{ i18n "pages.settings.subListen"}}' desc='{{ i18n "pages.settings.subListenDesc"}}' v-model="allSetting.subListen"></setting-list-item>
  364. <setting-list-item type="number" title='{{ i18n "pages.settings.subPort"}}' desc='{{ i18n "pages.settings.subPortDesc"}}' v-model.number="allSetting.subPort"></setting-list-item>
  365. <setting-list-item type="text" title='{{ i18n "pages.settings.subPath"}}' desc='{{ i18n "pages.settings.subPathDesc"}}' v-model="allSetting.subPath"></setting-list-item>
  366. <setting-list-item type="text" title='{{ i18n "pages.settings.subDomain"}}' desc='{{ i18n "pages.settings.subDomainDesc"}}' v-model="allSetting.subDomain"></setting-list-item>
  367. <setting-list-item type="text" title='{{ i18n "pages.settings.subCertPath"}}' desc='{{ i18n "pages.settings.subCertPathDesc"}}' v-model="allSetting.subCertFile"></setting-list-item>
  368. <setting-list-item type="text" title='{{ i18n "pages.settings.subKeyPath"}}' desc='{{ i18n "pages.settings.subKeyPathDesc"}}' v-model="allSetting.subKeyFile"></setting-list-item>
  369. <setting-list-item type="number" title='{{ i18n "pages.settings.subUpdates"}}' desc='{{ i18n "pages.settings.subUpdatesDesc"}}' v-model="allSetting.subUpdates"></setting-list-item>
  370. </a-list>
  371. </a-tab-pane>
  372. </a-tabs>
  373. </a-space>
  374. </a-spin>
  375. </a-layout-content>
  376. </a-layout>
  377. </a-layout>
  378. {{template "js" .}}
  379. {{template "component/themeSwitcher" .}}
  380. {{template "component/password" .}}
  381. {{template "component/setting"}}
  382. <script>
  383. const app = new Vue({
  384. delimiters: ['[[', ']]'],
  385. el: '#app',
  386. data: {
  387. siderDrawer,
  388. themeSwitcher,
  389. spinning: false,
  390. oldAllSetting: new AllSetting(),
  391. allSetting: new AllSetting(),
  392. saveBtnDisable: true,
  393. user: new User(),
  394. lang: getLang(),
  395. ipv4Settings: {
  396. tag: "IPv4",
  397. protocol: "freedom",
  398. settings: {
  399. domainStrategy: "UseIPv4"
  400. }
  401. },
  402. warpSettings: {
  403. tag: "WARP",
  404. protocol: "socks",
  405. settings: {
  406. servers: [
  407. {
  408. address: "127.0.0.1",
  409. port: 40000
  410. }
  411. ]
  412. }
  413. },
  414. directSettings: {
  415. tag: "direct",
  416. protocol: "freedom"
  417. },
  418. outboundDomainStrategies: ["AsIs", "UseIP", "UseIPv4", "UseIPv6"],
  419. routingDomainStrategies: ["AsIs", "IPIfNonMatch", "IPOnDemand"],
  420. settingsData: {
  421. protocols: {
  422. bittorrent: ["bittorrent"],
  423. },
  424. ips: {
  425. local: ["geoip:private"],
  426. cn: ["geoip:cn"],
  427. ir: ["geoip:ir"],
  428. ru: ["geoip:ru"],
  429. },
  430. domains: {
  431. ads: [
  432. "geosite:category-ads-all",
  433. "ext:iran.dat:ads"
  434. ],
  435. speedtest: ["geosite:speedtest"],
  436. openai: ["geosite:openai"],
  437. google: ["geosite:google"],
  438. spotify: ["geosite:spotify"],
  439. netflix: ["geosite:netflix"],
  440. cn: [
  441. "geosite:cn",
  442. "regexp:.*\\.cn$"
  443. ],
  444. ru: [
  445. "geosite:category-gov-ru",
  446. "regexp:.*\\.ru$"
  447. ],
  448. ir: [
  449. "regexp:.*\\.ir$",
  450. "ext:iran.dat:ir",
  451. "ext:iran.dat:other",
  452. "geosite:category-ir"
  453. ]
  454. },
  455. familyProtectDNS: {
  456. "servers": [
  457. "1.1.1.3", // https://developers.cloudflare.com/1.1.1.1/setup/
  458. "1.0.0.3",
  459. "94.140.14.15", // https://adguard-dns.io/kb/general/dns-providers/
  460. "94.140.15.16"
  461. ],
  462. "queryStrategy": "UseIPv4"
  463. },
  464. }
  465. },
  466. methods: {
  467. loading(spinning = true) {
  468. this.spinning = spinning;
  469. },
  470. async getAllSetting() {
  471. this.loading(true);
  472. const msg = await HttpUtil.post("/panel/setting/all");
  473. this.loading(false);
  474. if (msg.success) {
  475. this.oldAllSetting = new AllSetting(msg.obj);
  476. this.allSetting = new AllSetting(msg.obj);
  477. this.saveBtnDisable = true;
  478. }
  479. await this.fetchUserSecret();
  480. },
  481. async updateAllSetting() {
  482. this.loading(true);
  483. const msg = await HttpUtil.post("/panel/setting/update", this.allSetting);
  484. this.loading(false);
  485. if (msg.success) {
  486. await this.getAllSetting();
  487. }
  488. },
  489. async updateUser() {
  490. this.loading(true);
  491. const msg = await HttpUtil.post("/panel/setting/updateUser", this.user);
  492. this.loading(false);
  493. if (msg.success) {
  494. this.user = {};
  495. window.location.replace(basePath + "logout")
  496. }
  497. },
  498. async restartPanel() {
  499. await new Promise(resolve => {
  500. this.$confirm({
  501. title: '{{ i18n "pages.settings.restartPanel" }}',
  502. content: '{{ i18n "pages.settings.restartPanelDesc" }}',
  503. okText: '{{ i18n "sure" }}',
  504. cancelText: '{{ i18n "cancel" }}',
  505. onOk: () => resolve(),
  506. });
  507. });
  508. this.loading(true);
  509. const msg = await HttpUtil.post("/panel/setting/restartPanel");
  510. this.loading(false);
  511. if (msg.success) {
  512. this.loading(true);
  513. await PromiseUtil.sleep(5000);
  514. let protocol = "http://";
  515. if (this.allSetting.webCertFile !== "") {
  516. protocol = "https://";
  517. }
  518. const { host, pathname } = window.location;
  519. window.location.replace(protocol + host + this.allSetting.webBasePath + pathname.slice(1));
  520. }
  521. },
  522. async fetchUserSecret() {
  523. this.loading(true);
  524. const userMessage = await HttpUtil.post("/panel/setting/getUserSecret", this.user);
  525. if (userMessage.success) {
  526. this.user = userMessage.obj;
  527. }
  528. this.loading(false);
  529. },
  530. async updateSecret() {
  531. this.loading(true);
  532. const msg = await HttpUtil.post("/panel/setting/updateUserSecret", this.user);
  533. if (msg.success) {
  534. this.user = msg.obj;
  535. window.location.replace(basePath + "logout");
  536. }
  537. this.loading(false);
  538. await this.updateAllSetting();
  539. },
  540. generateRandomString(length) {
  541. var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
  542. let randomString = "";
  543. for (let i = 0; i < length; i++) {
  544. randomString += chars[Math.floor(Math.random() * chars.length)];
  545. }
  546. return randomString;
  547. },
  548. async getNewSecret() {
  549. this.loading(true);
  550. await PromiseUtil.sleep(600);
  551. const newSecret = this.generateRandomString(64);
  552. this.user.loginSecret = newSecret;
  553. document.getElementById("token").textContent = newSecret;
  554. this.loading(false);
  555. },
  556. async toggleToken(value) {
  557. if (value) {
  558. await this.getNewSecret();
  559. } else {
  560. this.user.loginSecret = "";
  561. }
  562. },
  563. async resetXrayConfigToDefault() {
  564. this.loading(true);
  565. const msg = await HttpUtil.get("/panel/setting/getDefaultJsonConfig");
  566. this.loading(false);
  567. if (msg.success) {
  568. this.templateSettings = JSON.parse(JSON.stringify(msg.obj, null, 2));
  569. this.saveBtnDisable = true;
  570. }
  571. },
  572. syncRulesWithOutbound(tag, setting) {
  573. const newTemplateSettings = {...this.templateSettings};
  574. const haveRules = newTemplateSettings.routing.rules.some((r) => r?.outboundTag === tag);
  575. const outboundIndex = newTemplateSettings.outbounds.findIndex((o) => o.tag === tag);
  576. if (!haveRules && outboundIndex >= 0) {
  577. newTemplateSettings.outbounds.splice(outboundIndex, 1);
  578. }
  579. if (haveRules && outboundIndex === -1) {
  580. newTemplateSettings.outbounds.push(setting);
  581. }
  582. this.templateSettings = newTemplateSettings;
  583. },
  584. templateRuleGetter(routeSettings) {
  585. const { property, outboundTag } = routeSettings;
  586. let result = [];
  587. if (this.templateSettings != null) {
  588. this.templateSettings.routing.rules.forEach(
  589. (routingRule) => {
  590. if (
  591. routingRule.hasOwnProperty(property) &&
  592. routingRule.hasOwnProperty("outboundTag") &&
  593. routingRule.outboundTag === outboundTag
  594. ) {
  595. result.push(...routingRule[property]);
  596. }
  597. }
  598. );
  599. }
  600. return result;
  601. },
  602. templateRuleSetter(routeSettings) {
  603. const { data, property, outboundTag } = routeSettings;
  604. const oldTemplateSettings = this.templateSettings;
  605. const newTemplateSettings = oldTemplateSettings;
  606. currentProperty = this.templateRuleGetter({ outboundTag, property })
  607. if (currentProperty.length == 0) {
  608. const propertyRule = {
  609. type: "field",
  610. outboundTag,
  611. [property]: data
  612. };
  613. newTemplateSettings.routing.rules.push(propertyRule);
  614. }
  615. else {
  616. const newRules = [];
  617. insertedOnce = false;
  618. newTemplateSettings.routing.rules.forEach(
  619. (routingRule) => {
  620. if (
  621. routingRule.hasOwnProperty(property) &&
  622. routingRule.hasOwnProperty("outboundTag") &&
  623. routingRule.outboundTag === outboundTag
  624. ) {
  625. if (!insertedOnce && data.length > 0) {
  626. insertedOnce = true;
  627. routingRule[property] = data;
  628. newRules.push(routingRule);
  629. }
  630. }
  631. else {
  632. newRules.push(routingRule);
  633. }
  634. }
  635. );
  636. newTemplateSettings.routing.rules = newRules;
  637. }
  638. this.templateSettings = newTemplateSettings;
  639. }
  640. },
  641. async mounted() {
  642. await this.getAllSetting();
  643. while (true) {
  644. await PromiseUtil.sleep(600);
  645. this.saveBtnDisable = this.oldAllSetting.equals(this.allSetting);
  646. }
  647. },
  648. computed: {
  649. templateSettings: {
  650. get: function () { return this.allSetting.xrayTemplateConfig ? JSON.parse(this.allSetting.xrayTemplateConfig) : null; },
  651. set: function (newValue) { this.allSetting.xrayTemplateConfig = JSON.stringify(newValue, null, 2); },
  652. },
  653. inboundSettings: {
  654. get: function () { return this.templateSettings ? JSON.stringify(this.templateSettings.inbounds, null, 2) : null; },
  655. set: function (newValue) {
  656. newTemplateSettings = this.templateSettings;
  657. newTemplateSettings.inbounds = JSON.parse(newValue);
  658. this.templateSettings = newTemplateSettings;
  659. },
  660. },
  661. outboundSettings: {
  662. get: function () { return this.templateSettings ? JSON.stringify(this.templateSettings.outbounds, null, 2) : null; },
  663. set: function (newValue) {
  664. newTemplateSettings = this.templateSettings;
  665. newTemplateSettings.outbounds = JSON.parse(newValue);
  666. this.templateSettings = newTemplateSettings;
  667. },
  668. },
  669. routingRuleSettings: {
  670. get: function () { return this.templateSettings ? JSON.stringify(this.templateSettings.routing.rules, null, 2) : null; },
  671. set: function (newValue) {
  672. newTemplateSettings = this.templateSettings;
  673. newTemplateSettings.routing.rules = JSON.parse(newValue);
  674. this.templateSettings = newTemplateSettings;
  675. },
  676. },
  677. freedomStrategy: {
  678. get: function () {
  679. if (!this.templateSettings) return "AsIs";
  680. freedomOutbound = this.templateSettings.outbounds.find((o) => o.protocol === "freedom" && !o.tag);
  681. if (!freedomOutbound) return "AsIs";
  682. if (!freedomOutbound.settings || !freedomOutbound.settings.domainStrategy) return "AsIs";
  683. return freedomOutbound.settings.domainStrategy;
  684. },
  685. set: function (newValue) {
  686. newTemplateSettings = this.templateSettings;
  687. freedomOutboundIndex = newTemplateSettings.outbounds.findIndex((o) => o.protocol === "freedom" && !o.tag);
  688. if (!newTemplateSettings.outbounds[freedomOutboundIndex].settings) {
  689. newTemplateSettings.outbounds[freedomOutboundIndex].settings = {"domainStrategy": newValue};
  690. } else {
  691. newTemplateSettings.outbounds[freedomOutboundIndex].settings.domainStrategy = newValue;
  692. }
  693. this.templateSettings = newTemplateSettings;
  694. }
  695. },
  696. routingStrategy: {
  697. get: function () {
  698. if (!this.templateSettings || !this.templateSettings.routing || !this.templateSettings.routing.domainStrategy) return "AsIs";
  699. return this.templateSettings.routing.domainStrategy;
  700. },
  701. set: function (newValue) {
  702. newTemplateSettings = this.templateSettings;
  703. newTemplateSettings.routing.domainStrategy = newValue;
  704. this.templateSettings = newTemplateSettings;
  705. }
  706. },
  707. blockedIPs: {
  708. get: function () {
  709. return this.templateRuleGetter({ outboundTag: "blocked", property: "ip" });
  710. },
  711. set: function (newValue) {
  712. this.templateRuleSetter({ outboundTag: "blocked", property: "ip", data: newValue });
  713. }
  714. },
  715. blockedDomains: {
  716. get: function () {
  717. return this.templateRuleGetter({ outboundTag: "blocked", property: "domain" });
  718. },
  719. set: function (newValue) {
  720. this.templateRuleSetter({ outboundTag: "blocked", property: "domain", data: newValue });
  721. }
  722. },
  723. blockedProtocols: {
  724. get: function () {
  725. return this.templateRuleGetter({ outboundTag: "blocked", property: "protocol" });
  726. },
  727. set: function (newValue) {
  728. this.templateRuleSetter({ outboundTag: "blocked", property: "protocol", data: newValue });
  729. }
  730. },
  731. directIPs: {
  732. get: function () {
  733. return this.templateRuleGetter({ outboundTag: "direct", property: "ip" });
  734. },
  735. set: function (newValue) {
  736. this.templateRuleSetter({ outboundTag: "direct", property: "ip", data: newValue });
  737. this.syncRulesWithOutbound("direct", this.directSettings);
  738. }
  739. },
  740. directDomains: {
  741. get: function () {
  742. return this.templateRuleGetter({ outboundTag: "direct", property: "domain" });
  743. },
  744. set: function (newValue) {
  745. this.templateRuleSetter({ outboundTag: "direct", property: "domain", data: newValue });
  746. this.syncRulesWithOutbound("direct", this.directSettings);
  747. }
  748. },
  749. ipv4Domains: {
  750. get: function () {
  751. return this.templateRuleGetter({ outboundTag: "IPv4", property: "domain" });
  752. },
  753. set: function (newValue) {
  754. this.templateRuleSetter({ outboundTag: "IPv4", property: "domain", data: newValue });
  755. this.syncRulesWithOutbound("IPv4", this.ipv4Settings);
  756. }
  757. },
  758. warpDomains: {
  759. get: function () {
  760. return this.templateRuleGetter({ outboundTag: "WARP", property: "domain" });
  761. },
  762. set: function (newValue) {
  763. this.templateRuleSetter({ outboundTag: "WARP", property: "domain", data: newValue });
  764. this.syncRulesWithOutbound("WARP", this.warpSettings);
  765. }
  766. },
  767. manualBlockedIPs: {
  768. get: function () { return JSON.stringify(this.blockedIPs, null, 2); },
  769. set: debounce(function (value) { this.blockedIPs = JSON.parse(value); }, 1000)
  770. },
  771. manualBlockedDomains: {
  772. get: function () { return JSON.stringify(this.blockedDomains, null, 2); },
  773. set: debounce(function (value) { this.blockedDomains = JSON.parse(value); }, 1000)
  774. },
  775. manualDirectIPs: {
  776. get: function () { return JSON.stringify(this.directIPs, null, 2); },
  777. set: debounce(function (value) { this.directIPs = JSON.parse(value); }, 1000)
  778. },
  779. manualDirectDomains: {
  780. get: function () { return JSON.stringify(this.directDomains, null, 2); },
  781. set: debounce(function (value) { this.directDomains = JSON.parse(value); }, 1000)
  782. },
  783. manualIPv4Domains: {
  784. get: function () { return JSON.stringify(this.ipv4Domains, null, 2); },
  785. set: debounce(function (value) { this.ipv4Domains = JSON.parse(value); }, 1000)
  786. },
  787. manualWARPDomains: {
  788. get: function () { return JSON.stringify(this.warpDomains, null, 2); },
  789. set: debounce(function (value) { this.warpDomains = JSON.parse(value); }, 1000)
  790. },
  791. torrentSettings: {
  792. get: function () {
  793. return doAllItemsExist(this.settingsData.protocols.bittorrent, this.blockedProtocols);
  794. },
  795. set: function (newValue) {
  796. if (newValue) {
  797. this.blockedProtocols = [...this.blockedProtocols, ...this.settingsData.protocols.bittorrent];
  798. } else {
  799. this.blockedProtocols = this.blockedProtocols.filter(data => !this.settingsData.protocols.bittorrent.includes(data));
  800. }
  801. },
  802. },
  803. privateIpSettings: {
  804. get: function () {
  805. return doAllItemsExist(this.settingsData.ips.local, this.blockedIPs);
  806. },
  807. set: function (newValue) {
  808. if (newValue) {
  809. this.blockedIPs = [...this.blockedIPs, ...this.settingsData.ips.local];
  810. } else {
  811. this.blockedIPs = this.blockedIPs.filter(data => !this.settingsData.ips.local.includes(data));
  812. }
  813. },
  814. },
  815. AdsSettings: {
  816. get: function () {
  817. return doAllItemsExist(this.settingsData.domains.ads, this.blockedDomains);
  818. },
  819. set: function (newValue) {
  820. if (newValue) {
  821. this.blockedDomains = [...this.blockedDomains, ...this.settingsData.domains.ads];
  822. } else {
  823. this.blockedDomains = this.blockedDomains.filter(data => !this.settingsData.domains.ads.includes(data));
  824. }
  825. },
  826. },
  827. SpeedTestSettings: {
  828. get: function () {
  829. return doAllItemsExist(this.settingsData.domains.speedtest, this.blockedDomains);
  830. },
  831. set: function (newValue) {
  832. if (newValue) {
  833. this.blockedDomains = [...this.blockedDomains, ...this.settingsData.domains.speedtest];
  834. } else {
  835. this.blockedDomains = this.blockedDomains.filter(data => !this.settingsData.domains.speedtest.includes(data));
  836. }
  837. },
  838. },
  839. familyProtectSettings: {
  840. get: function () {
  841. if (!this.templateSettings || !this.templateSettings.dns || !this.templateSettings.dns.servers) return false;
  842. return doAllItemsExist(this.templateSettings.dns.servers, this.settingsData.familyProtectDNS.servers);
  843. },
  844. set: function (newValue) {
  845. newTemplateSettings = this.templateSettings;
  846. if (newValue) {
  847. newTemplateSettings.dns = this.settingsData.familyProtectDNS;
  848. } else {
  849. delete newTemplateSettings.dns;
  850. }
  851. this.templateSettings = newTemplateSettings;
  852. },
  853. },
  854. GoogleIPv4Settings: {
  855. get: function () {
  856. return doAllItemsExist(this.settingsData.domains.google, this.ipv4Domains);
  857. },
  858. set: function (newValue) {
  859. if (newValue) {
  860. this.ipv4Domains = [...this.ipv4Domains, ...this.settingsData.domains.google];
  861. } else {
  862. this.ipv4Domains = this.ipv4Domains.filter(data => !this.settingsData.domains.google.includes(data));
  863. }
  864. },
  865. },
  866. NetflixIPv4Settings: {
  867. get: function () {
  868. return doAllItemsExist(this.settingsData.domains.netflix, this.ipv4Domains);
  869. },
  870. set: function (newValue) {
  871. if (newValue) {
  872. this.ipv4Domains = [...this.ipv4Domains, ...this.settingsData.domains.netflix];
  873. } else {
  874. this.ipv4Domains = this.ipv4Domains.filter(data => !this.settingsData.domains.netflix.includes(data));
  875. }
  876. },
  877. },
  878. IRIpSettings: {
  879. get: function () {
  880. return doAllItemsExist(this.settingsData.ips.ir, this.blockedIPs);
  881. },
  882. set: function (newValue) {
  883. if (newValue) {
  884. this.blockedIPs = [...this.blockedIPs, ...this.settingsData.ips.ir];
  885. } else {
  886. this.blockedIPs = this.blockedIPs.filter(data => !this.settingsData.ips.ir.includes(data));
  887. }
  888. }
  889. },
  890. IRDomainSettings: {
  891. get: function () {
  892. return doAllItemsExist(this.settingsData.domains.ir, this.blockedDomains);
  893. },
  894. set: function (newValue) {
  895. if (newValue) {
  896. this.blockedDomains = [...this.blockedDomains, ...this.settingsData.domains.ir];
  897. } else {
  898. this.blockedDomains = this.blockedDomains.filter(data => !this.settingsData.domains.ir.includes(data));
  899. }
  900. }
  901. },
  902. ChinaIpSettings: {
  903. get: function () {
  904. return doAllItemsExist(this.settingsData.ips.cn, this.blockedIPs);
  905. },
  906. set: function (newValue) {
  907. if (newValue) {
  908. this.blockedIPs = [...this.blockedIPs, ...this.settingsData.ips.cn];
  909. } else {
  910. this.blockedIPs = this.blockedIPs.filter(data => !this.settingsData.ips.cn.includes(data));
  911. }
  912. }
  913. },
  914. ChinaDomainSettings: {
  915. get: function () {
  916. return doAllItemsExist(this.settingsData.domains.cn, this.blockedDomains);
  917. },
  918. set: function (newValue) {
  919. if (newValue) {
  920. this.blockedDomains = [...this.blockedDomains, ...this.settingsData.domains.cn];
  921. } else {
  922. this.blockedDomains = this.blockedDomains.filter(data => !this.settingsData.domains.cn.includes(data));
  923. }
  924. }
  925. },
  926. RussiaIpSettings: {
  927. get: function () {
  928. return doAllItemsExist(this.settingsData.ips.ru, this.blockedIPs);
  929. },
  930. set: function (newValue) {
  931. if (newValue) {
  932. this.blockedIPs = [...this.blockedIPs, ...this.settingsData.ips.ru];
  933. } else {
  934. this.blockedIPs = this.blockedIPs.filter(data => !this.settingsData.ips.ru.includes(data));
  935. }
  936. }
  937. },
  938. RussiaDomainSettings: {
  939. get: function () {
  940. return doAllItemsExist(this.settingsData.domains.ru, this.blockedDomains);
  941. },
  942. set: function (newValue) {
  943. if (newValue) {
  944. this.blockedDomains = [...this.blockedDomains, ...this.settingsData.domains.ru];
  945. } else {
  946. this.blockedDomains = this.blockedDomains.filter(data => !this.settingsData.domains.ru.includes(data));
  947. }
  948. }
  949. },
  950. IRIpDirectSettings: {
  951. get: function () {
  952. return doAllItemsExist(this.settingsData.ips.ir, this.directIPs);
  953. },
  954. set: function (newValue) {
  955. if (newValue) {
  956. this.directIPs = [...this.directIPs, ...this.settingsData.ips.ir];
  957. } else {
  958. this.directIPs = this.directIPs.filter(data => !this.settingsData.ips.ir.includes(data));
  959. }
  960. }
  961. },
  962. IRDomainDirectSettings: {
  963. get: function () {
  964. return doAllItemsExist(this.settingsData.domains.ir, this.directDomains);
  965. },
  966. set: function (newValue) {
  967. if (newValue) {
  968. this.directDomains = [...this.directDomains, ...this.settingsData.domains.ir];
  969. } else {
  970. this.directDomains = this.directDomains.filter(data => !this.settingsData.domains.ir.includes(data));
  971. }
  972. }
  973. },
  974. ChinaIpDirectSettings: {
  975. get: function () {
  976. return doAllItemsExist(this.settingsData.ips.cn, this.directIPs);
  977. },
  978. set: function (newValue) {
  979. if (newValue) {
  980. this.directIPs = [...this.directIPs, ...this.settingsData.ips.cn];
  981. } else {
  982. this.directIPs = this.directIPs.filter(data => !this.settingsData.ips.cn.includes(data));
  983. }
  984. }
  985. },
  986. ChinaDomainDirectSettings: {
  987. get: function () {
  988. return doAllItemsExist(this.settingsData.domains.cn, this.directDomains);
  989. },
  990. set: function (newValue) {
  991. if (newValue) {
  992. this.directDomains = [...this.directDomains, ...this.settingsData.domains.cn];
  993. } else {
  994. this.directDomains = this.directDomains.filter(data => !this.settingsData.domains.cn.includes(data));
  995. }
  996. }
  997. },
  998. RussiaIpDirectSettings: {
  999. get: function () {
  1000. return doAllItemsExist(this.settingsData.ips.ru, this.directIPs);
  1001. },
  1002. set: function (newValue) {
  1003. if (newValue) {
  1004. this.directIPs = [...this.directIPs, ...this.settingsData.ips.ru];
  1005. } else {
  1006. this.directIPs = this.directIPs.filter(data => !this.settingsData.ips.ru.includes(data));
  1007. }
  1008. }
  1009. },
  1010. RussiaDomainDirectSettings: {
  1011. get: function () {
  1012. return doAllItemsExist(this.settingsData.domains.ru, this.directDomains);
  1013. },
  1014. set: function (newValue) {
  1015. if (newValue) {
  1016. this.directDomains = [...this.directDomains, ...this.settingsData.domains.ru];
  1017. } else {
  1018. this.directDomains = this.directDomains.filter(data => !this.settingsData.domains.ru.includes(data));
  1019. }
  1020. }
  1021. },
  1022. GoogleWARPSettings: {
  1023. get: function () {
  1024. return doAllItemsExist(this.settingsData.domains.google, this.warpDomains);
  1025. },
  1026. set: function (newValue) {
  1027. if (newValue) {
  1028. this.warpDomains = [...this.warpDomains, ...this.settingsData.domains.google];
  1029. } else {
  1030. this.warpDomains = this.warpDomains.filter(data => !this.settingsData.domains.google.includes(data));
  1031. }
  1032. },
  1033. },
  1034. OpenAIWARPSettings: {
  1035. get: function () {
  1036. return doAllItemsExist(this.settingsData.domains.openai, this.warpDomains);
  1037. },
  1038. set: function (newValue) {
  1039. if (newValue) {
  1040. this.warpDomains = [...this.warpDomains, ...this.settingsData.domains.openai];
  1041. } else {
  1042. this.warpDomains = this.warpDomains.filter(data => !this.settingsData.domains.openai.includes(data));
  1043. }
  1044. },
  1045. },
  1046. NetflixWARPSettings: {
  1047. get: function () {
  1048. return doAllItemsExist(this.settingsData.domains.netflix, this.warpDomains);
  1049. },
  1050. set: function (newValue) {
  1051. if (newValue) {
  1052. this.warpDomains = [...this.warpDomains, ...this.settingsData.domains.netflix];
  1053. } else {
  1054. this.warpDomains = this.warpDomains.filter(data => !this.settingsData.domains.netflix.includes(data));
  1055. }
  1056. },
  1057. },
  1058. SpotifyWARPSettings: {
  1059. get: function () {
  1060. return doAllItemsExist(this.settingsData.domains.spotify, this.warpDomains);
  1061. },
  1062. set: function (newValue) {
  1063. if (newValue) {
  1064. this.warpDomains = [...this.warpDomains, ...this.settingsData.domains.spotify];
  1065. } else {
  1066. this.warpDomains = this.warpDomains.filter(data => !this.settingsData.domains.spotify.includes(data));
  1067. }
  1068. },
  1069. },
  1070. },
  1071. });
  1072. </script>
  1073. </body>
  1074. </html>