settings.html 69 KB

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