settings.html 63 KB

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