settings.html 67 KB

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