settings.html 68 KB

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