1
0

settings.html 64 KB

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