settings.html 64 KB

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