settings.html 64 KB

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