xray.html 81 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. {{template "head" .}}
  4. <link rel="stylesheet" href="{{ .base_path }}assets/codemirror/codemirror.css">
  5. <link rel="stylesheet" href="{{ .base_path }}assets/codemirror/fold/foldgutter.css">
  6. <link rel="stylesheet" href="{{ .base_path }}assets/codemirror/xq.css?{{ .cur_ver }}">
  7. <link rel="stylesheet" href="{{ .base_path }}assets/codemirror/lint/lint.css">
  8. <script src="{{ .base_path }}assets/js/model/outbound.js"></script>
  9. <script src="{{ .base_path }}assets/codemirror/codemirror.js"></script>
  10. <script src="{{ .base_path }}assets/codemirror/javascript.js"></script>
  11. <script src="{{ .base_path }}assets/codemirror/jshint.js"></script>
  12. <script src="{{ .base_path }}assets/codemirror/jsonlint.js"></script>
  13. <script src="{{ .base_path }}assets/codemirror/lint/lint.js"></script>
  14. <script src="{{ .base_path }}assets/codemirror/lint/javascript-lint.js"></script>
  15. <script src="{{ .base_path }}assets/codemirror/hint/javascript-hint.js"></script>
  16. <script src="{{ .base_path }}assets/codemirror/fold/foldcode.js"></script>
  17. <script src="{{ .base_path }}assets/codemirror/fold/foldgutter.js"></script>
  18. <script src="{{ .base_path }}assets/codemirror/fold/brace-fold.js"></script>
  19. <style>
  20. @media (min-width: 769px) {
  21. .ant-layout-content {
  22. margin: 24px 16px;
  23. }
  24. }
  25. @media (max-width: 768px) {
  26. .ant-tabs-nav .ant-tabs-tab {
  27. margin: 0;
  28. padding: 12px .5rem;
  29. }
  30. .ant-table-thead > tr > th,
  31. .ant-table-tbody > tr > td {
  32. padding: 10px 0px;
  33. }
  34. }
  35. .ant-tabs-bar {
  36. margin: 0;
  37. }
  38. .ant-list-item {
  39. display: block;
  40. }
  41. .collapse-title {
  42. color: inherit;
  43. font-weight: bold;
  44. font-size: 18px;
  45. padding: 10px 20px;
  46. border-bottom: 2px solid;
  47. }
  48. .collapse-title > i {
  49. color: inherit;
  50. font-size: 24px;
  51. }
  52. </style>
  53. <body>
  54. <a-layout id="app" v-cloak :class="themeSwitcher.currentTheme">
  55. {{ template "commonSider" . }}
  56. <a-layout id="content-layout">
  57. <a-layout-content>
  58. <a-spin :spinning="spinning" :delay="500" tip='{{ i18n "loading"}}'>
  59. <a-space direction="vertical">
  60. <a-card hoverable style="margin-bottom: .5rem;">
  61. <a-row>
  62. <a-col :xs="24" :sm="8" style="padding: 4px;">
  63. <a-space direction="horizontal">
  64. <a-button type="primary" :disabled="saveBtnDisable" @click="updateXraySetting">{{ i18n "pages.xray.save" }}</a-button>
  65. <a-button type="danger" :disabled="!saveBtnDisable" @click="restartXray">{{ i18n "pages.xray.restart" }}</a-button>
  66. <a-popover v-if="restartResult"
  67. :overlay-class-name="themeSwitcher.currentTheme">
  68. <span slot="title" style="font-size: 12pt">Error in running xray-core</span>
  69. <template slot="content">
  70. <p style="max-width: 400px" v-for="line in restartResult.split('\n')">[[ line ]]</p>
  71. </template>
  72. <a-icon type="question-circle"></a-icon>
  73. </a-popover>
  74. </a-space>
  75. </a-col>
  76. <a-col :xs="24" :sm="16">
  77. <a-back-top :target="() => document.getElementById('content-layout')" visibility-height="200">
  78. </a-back-top>
  79. <a-alert type="warning" style="float: right; width: fit-content"
  80. message='{{ i18n "pages.settings.infoDesc" }}'
  81. show-icon
  82. >
  83. </a-col>
  84. </a-row>
  85. </a-card>
  86. <a-tabs class="ant-card-dark-box-nohover" default-active-key="tpl-1"
  87. @change="(activeKey) => { if(activeKey == 'tpl-4') this.changeCode(); }"
  88. :class="themeSwitcher.currentTheme">
  89. <a-tab-pane key="tpl-1" tab='{{ i18n "pages.xray.basicTemplate"}}'>
  90. <a-space direction="horizontal" style="padding: 20px 20px">
  91. <a-button type="primary" @click="resetXrayConfigToDefault">{{ i18n "pages.settings.resetDefaultConfig" }}</a-button>
  92. </a-space>
  93. <a-collapse>
  94. <a-collapse-panel header='{{ i18n "pages.xray.generalConfigs"}}'>
  95. <a-row :xs="24" :sm="24" :lg="12">
  96. <a-alert type="warning" style="text-align: center;">
  97. <template slot="message">
  98. <a-icon type="exclamation-circle" theme="filled" style="color: #FFA031"></a-icon>
  99. {{ i18n "pages.xray.generalConfigsDesc" }}
  100. </template>
  101. </a-alert>
  102. </a-row>
  103. <a-list-item>
  104. <a-row style="padding: 20px">
  105. <a-col :lg="24" :xl="12">
  106. <a-list-item-meta
  107. title='{{ i18n "pages.xray.FreedomStrategy" }}'
  108. description='{{ i18n "pages.xray.FreedomStrategyDesc" }}'/>
  109. </a-col>
  110. <a-col :lg="24" :xl="12">
  111. <template>
  112. <a-select
  113. v-model="freedomStrategy"
  114. :dropdown-class-name="themeSwitcher.currentTheme"
  115. style="width: 100%">
  116. <a-select-option v-for="s in outboundDomainStrategies" :value="s">[[ s ]]</a-select-option>
  117. </a-select>
  118. </template>
  119. </a-col>
  120. </a-row>
  121. </a-list-item>
  122. <a-row style="padding: 20px">
  123. <a-col :lg="24" :xl="12">
  124. <a-list-item-meta
  125. title='{{ i18n "pages.xray.RoutingStrategy" }}'
  126. description='{{ i18n "pages.xray.RoutingStrategyDesc" }}'/>
  127. </a-col>
  128. <a-col :lg="24" :xl="12">
  129. <template>
  130. <a-select
  131. v-model="routingStrategy"
  132. :dropdown-class-name="themeSwitcher.currentTheme"
  133. style="width: 100%">
  134. <a-select-option v-for="s in routingDomainStrategies" :value="s">[[ s ]]</a-select-option>
  135. </a-select>
  136. </template>
  137. </a-col>
  138. </a-row>
  139. </a-list-item>
  140. </a-collapse-panel>
  141. <a-collapse-panel header='{{ i18n "pages.xray.blockConfigs"}}'>
  142. <a-row :xs="24" :sm="24" :lg="12">
  143. <a-alert type="warning" style="text-align: center;">
  144. <template slot="message">
  145. <a-icon type="exclamation-circle" theme="filled" style="color: #FFA031"></a-icon>
  146. {{ i18n "pages.xray.blockConfigsDesc" }}
  147. </template>
  148. </a-alert>
  149. </a-row>
  150. <setting-list-item type="switch" title='{{ i18n "pages.xray.Torrent"}}' desc='{{ i18n "pages.xray.TorrentDesc"}}' v-model="torrentSettings"></setting-list-item>
  151. <setting-list-item type="switch" title='{{ i18n "pages.xray.PrivateIp"}}' desc='{{ i18n "pages.xray.PrivateIpDesc"}}' v-model="privateIpSettings"></setting-list-item>
  152. <setting-list-item type="switch" title='{{ i18n "pages.xray.Ads"}}' desc='{{ i18n "pages.xray.AdsDesc"}}' v-model="AdsSettings"></setting-list-item>
  153. <setting-list-item type="switch" title='{{ i18n "pages.xray.Family"}}' desc='{{ i18n "pages.xray.FamilyDesc"}}' v-model="familyProtectSettings"></setting-list-item>
  154. <setting-list-item type="switch" title='{{ i18n "pages.xray.Speedtest"}}' desc='{{ i18n "pages.xray.SpeedtestDesc"}}' v-model="SpeedTestSettings"></setting-list-item>
  155. </a-collapse-panel>
  156. <a-collapse-panel header='{{ i18n "pages.xray.blockCountryConfigs"}}'>
  157. <a-row :xs="24" :sm="24" :lg="12">
  158. <a-alert type="warning" style="text-align: center;">
  159. <template slot="message">
  160. <a-icon type="exclamation-circle" theme="filled" style="color: #FFA031"></a-icon>
  161. {{ i18n "pages.xray.blockCountryConfigsDesc" }}
  162. </template>
  163. </a-alert>
  164. </a-row>
  165. <setting-list-item type="switch" title='{{ i18n "pages.xray.IRIp"}}' desc='{{ i18n "pages.xray.IRIpDesc"}}' v-model="IRIpSettings"></setting-list-item>
  166. <setting-list-item type="switch" title='{{ i18n "pages.xray.IRDomain"}}' desc='{{ i18n "pages.xray.IRDomainDesc"}}' v-model="IRDomainSettings"></setting-list-item>
  167. <setting-list-item type="switch" title='{{ i18n "pages.xray.ChinaIp"}}' desc='{{ i18n "pages.xray.ChinaIpDesc"}}' v-model="ChinaIpSettings"></setting-list-item>
  168. <setting-list-item type="switch" title='{{ i18n "pages.xray.ChinaDomain"}}' desc='{{ i18n "pages.xray.ChinaDomainDesc"}}' v-model="ChinaDomainSettings"></setting-list-item>
  169. <setting-list-item type="switch" title='{{ i18n "pages.xray.RussiaIp"}}' desc='{{ i18n "pages.xray.RussiaIpDesc"}}' v-model="RussiaIpSettings"></setting-list-item>
  170. <setting-list-item type="switch" title='{{ i18n "pages.xray.RussiaDomain"}}' desc='{{ i18n "pages.xray.RussiaDomainDesc"}}' v-model="RussiaDomainSettings"></setting-list-item>
  171. <setting-list-item type="switch" title='{{ i18n "pages.xray.VNIp"}}' desc='{{ i18n "pages.xray.VNIpDesc"}}' v-model="VNIpSettings"></setting-list-item>
  172. <setting-list-item type="switch" title='{{ i18n "pages.xray.VNDomain"}}' desc='{{ i18n "pages.xray.VNDomainDesc"}}' v-model="VNDomainSettings"></setting-list-item>
  173. </a-collapse-panel>
  174. <a-collapse-panel header='{{ i18n "pages.xray.directCountryConfigs"}}'>
  175. <a-row :xs="24" :sm="24" :lg="12">
  176. <a-alert type="warning" style="text-align: center;">
  177. <template slot="message">
  178. <a-icon type="exclamation-circle" theme="filled" style="color: #FFA031"></a-icon>
  179. {{ i18n "pages.xray.directCountryConfigsDesc" }}
  180. </template>
  181. </a-alert>
  182. </a-row>
  183. <setting-list-item type="switch" title='{{ i18n "pages.xray.DirectIRIp"}}' desc='{{ i18n "pages.xray.DirectIRIpDesc"}}' v-model="IRIpDirectSettings"></setting-list-item>
  184. <setting-list-item type="switch" title='{{ i18n "pages.xray.DirectIRDomain"}}' desc='{{ i18n "pages.xray.DirectIRDomainDesc"}}' v-model="IRDomainDirectSettings"></setting-list-item>
  185. <setting-list-item type="switch" title='{{ i18n "pages.xray.DirectChinaIp"}}' desc='{{ i18n "pages.xray.DirectChinaIpDesc"}}' v-model="ChinaIpDirectSettings"></setting-list-item>
  186. <setting-list-item type="switch" title='{{ i18n "pages.xray.DirectChinaDomain"}}' desc='{{ i18n "pages.xray.DirectChinaDomainDesc"}}' v-model="ChinaDomainDirectSettings"></setting-list-item>
  187. <setting-list-item type="switch" title='{{ i18n "pages.xray.DirectRussiaIp"}}' desc='{{ i18n "pages.xray.DirectRussiaIpDesc"}}' v-model="RussiaIpDirectSettings"></setting-list-item>
  188. <setting-list-item type="switch" title='{{ i18n "pages.xray.DirectRussiaDomain"}}' desc='{{ i18n "pages.xray.DirectRussiaDomainDesc"}}' v-model="RussiaDomainDirectSettings"></setting-list-item>
  189. <setting-list-item type="switch" title='{{ i18n "pages.xray.DirectVNIp"}}' desc='{{ i18n "pages.xray.DirectVNIpDesc"}}' v-model="VNIpDirectSettings"></setting-list-item>
  190. <setting-list-item type="switch" title='{{ i18n "pages.xray.DirectVNDomain"}}' desc='{{ i18n "pages.xray.DirectVNDomainDesc"}}' v-model="VNDomainDirectSettings"></setting-list-item>
  191. </a-collapse-panel>
  192. <a-collapse-panel header='{{ i18n "pages.xray.ipv4Configs"}}'>
  193. <a-row :xs="24" :sm="24" :lg="12">
  194. <a-alert type="warning" style="text-align: center;">
  195. <template slot="message">
  196. <a-icon type="exclamation-circle" theme="filled" style="color: #FFA031"></a-icon>
  197. {{ i18n "pages.xray.ipv4ConfigsDesc" }}
  198. </template>
  199. </a-alert>
  200. </a-row>
  201. <setting-list-item type="switch" title='{{ i18n "pages.xray.GoogleIPv4"}}' desc='{{ i18n "pages.xray.GoogleIPv4Desc"}}' v-model="GoogleIPv4Settings"></setting-list-item>
  202. <setting-list-item type="switch" title='{{ i18n "pages.xray.NetflixIPv4"}}' desc='{{ i18n "pages.xray.NetflixIPv4Desc"}}' v-model="NetflixIPv4Settings"></setting-list-item>
  203. </a-collapse-panel>
  204. <a-collapse-panel header='{{ i18n "pages.xray.warpConfigs"}}'>
  205. <a-row :xs="24" :sm="24" :lg="12">
  206. <a-alert type="warning" style="text-align: center;">
  207. <template slot="message">
  208. <a-icon type="exclamation-circle" theme="filled" style="color: #FFA031"></a-icon>
  209. {{ i18n "pages.xray.warpConfigsDesc" }}
  210. </template>
  211. </a-alert>
  212. </a-row>
  213. <setting-list-item type="switch" title='{{ i18n "pages.xray.GoogleWARP"}}' desc='{{ i18n "pages.xray.GoogleWARPDesc"}}' v-model="GoogleWARPSettings"></setting-list-item>
  214. <setting-list-item type="switch" title='{{ i18n "pages.xray.OpenAIWARP"}}' desc='{{ i18n "pages.xray.OpenAIWARPDesc"}}' v-model="OpenAIWARPSettings"></setting-list-item>
  215. <setting-list-item type="switch" title='{{ i18n "pages.xray.NetflixWARP"}}' desc='{{ i18n "pages.xray.NetflixWARPDesc"}}' v-model="NetflixWARPSettings"></setting-list-item>
  216. <setting-list-item type="switch" title='{{ i18n "pages.xray.SpotifyWARP"}}' desc='{{ i18n "pages.xray.SpotifyWARPDesc"}}' v-model="SpotifyWARPSettings"></setting-list-item>
  217. </a-collapse-panel>
  218. </a-collapse>
  219. </a-tab-pane>
  220. <a-tab-pane key="tpl-2" tab='{{ i18n "pages.xray.Routings"}}' style="padding-top: 20px;">
  221. <a-alert type="warning" style="margin-bottom: 10px; width: fit-content"
  222. message='{{ i18n "pages.xray.RoutingsDesc"}}' show-icon></a-alert>
  223. <a-button type="primary" icon="plus" @click="addRule">{{ i18n "pages.xray.rules.add" }}</a-button>
  224. <a-table :columns="isMobile ? rulesMobileColumns : rulesColumns" bordered
  225. :row-key="r => r.key"
  226. :data-source="routingRuleData"
  227. :scroll="isMobile ? {} : { x: 1000 }"
  228. :pagination="false"
  229. :indent-size="0"
  230. :style="isMobile ? 'padding: 5px 0' : 'margin-top: 10px;'">
  231. <template slot="action" slot-scope="text, rule, index">
  232. [[ index+1 ]]
  233. <a-dropdown :trigger="['click']">
  234. <a-icon @click="e => e.preventDefault()" type="more" style="font-size: 16px; text-decoration: bold;"></a-icon>
  235. <a-menu slot="overlay" :theme="themeSwitcher.currentTheme">
  236. <a-menu-item v-if="index>0" @click="replaceRule(index,0)">
  237. <a-icon type="vertical-align-top"></a-icon>
  238. {{ i18n "pages.xray.rules.first"}}
  239. </a-menu-item>
  240. <a-menu-item v-if="index>0" @click="replaceRule(index,index-1)">
  241. <a-icon type="arrow-up"></a-icon>
  242. {{ i18n "pages.xray.rules.up"}}
  243. </a-menu-item>
  244. <a-menu-item v-if="index<routingRuleData.length-1" @click="replaceRule(index,index+1)">
  245. <a-icon type="arrow-down"></a-icon>
  246. {{ i18n "pages.xray.rules.down"}}
  247. </a-menu-item>
  248. <a-menu-item v-if="index<routingRuleData.length-1" @click="replaceRule(index,routingRuleData.length-1)">
  249. <a-icon type="vertical-align-bottom"></a-icon>
  250. {{ i18n "pages.xray.rules.last"}}
  251. </a-menu-item>
  252. <a-menu-item @click="editRule(index)">
  253. <a-icon type="edit"></a-icon>
  254. {{ i18n "edit" }}
  255. </a-menu-item>
  256. <a-menu-item @click="deleteRule(index)">
  257. <span style="color: #FF4D4F">
  258. <a-icon type="delete"></a-icon> {{ i18n "delete"}}
  259. </span>
  260. </a-menu-item>
  261. </a-menu>
  262. </a-dropdown>
  263. </template>
  264. <template slot="inbound" slot-scope="text, rule, index">
  265. <a-popover :overlay-class-name="themeSwitcher.currentTheme">
  266. <template slot="content">
  267. <p v-if="rule.inboundTag">Inbound Tag: [[ rule.inboundTag ]]</p>
  268. <p v-if="rule.user">User email: [[ rule.user ]]</p>
  269. </template>
  270. [[ [rule.inboundTag,rule.user].join('\n') ]]
  271. </a-popover>
  272. </template>
  273. <template slot="outbound" slot-scope="text, rule, index">
  274. <a-popover :overlay-class-name="themeSwitcher.currentTheme">
  275. <template slot="content">
  276. <p v-if="rule.outboundTag">Outbound Tag: [[ rule.outboundTag ]]</p>
  277. </template>
  278. [[ rule.outboundTag ]]
  279. </a-popover>
  280. </template>
  281. <template slot="info" slot-scope="text, rule, index">
  282. <a-popover placement="bottomRight"
  283. v-if="(rule.source+rule.sourcePort+rule.network+rule.protocol+rule.attrs+rule.ip+rule.domain+rule.port).length>0"
  284. :overlay-class-name="themeSwitcher.currentTheme" trigger="click">
  285. <template slot="content">
  286. <table cellpadding="2" style="max-width: 300px;">
  287. <tr v-if="rule.source">
  288. <td>Source</td>
  289. <td><a-tag color="blue" v-for="r in rule.source.split(',')">[[ r ]]</a-tag></td>
  290. </tr>
  291. <tr v-if="rule.sourcePort">
  292. <td>Source Port</td>
  293. <td><a-tag color="green" v-for="r in rule.sourcePort.split(',')">[[ r ]]</a-tag></td>
  294. </tr>
  295. <tr v-if="rule.network">
  296. <td>Network</td>
  297. <td><a-tag color="blue" v-for="r in rule.network.split(',')">[[ r ]]</a-tag></td>
  298. </tr>
  299. <tr v-if="rule.protocol">
  300. <td>Protocol</td>
  301. <td><a-tag color="green" v-for="r in rule.protocol.split(',')">[[ r ]]</a-tag></td>
  302. </tr>
  303. <tr v-if="rule.attrs">
  304. <td>Attrs</td>
  305. <td><a-tag color="blue" v-for="r in rule.attrs.split(',')">[[ r ]]</a-tag></td>
  306. </tr>
  307. <tr v-if="rule.ip">
  308. <td>IP</td>
  309. <td><a-tag color="green" v-for="r in rule.ip.split(',')">[[ r ]]</a-tag></td>
  310. </tr>
  311. <tr v-if="rule.domain">
  312. <td>Domain</td>
  313. <td><a-tag color="blue" v-for="r in rule.domain.split(',')">[[ r ]]</a-tag></td>
  314. </tr>
  315. <tr v-if="rule.port">
  316. <td>Port</td>
  317. <td><a-tag color="green" v-for="r in rule.port.split(',')">[[ r ]]</a-tag></td>
  318. </tr>
  319. </table>
  320. </template>
  321. <a-button shape="round" size="small" style="font-size: 14px; padding: 0 10px;">
  322. <a-icon type="info"></a-icon>
  323. </a-button>
  324. </a-popover>
  325. </template>
  326. </a-table>
  327. </a-tab-pane>
  328. <a-tab-pane key="tpl-3" tab='{{ i18n "pages.xray.Outbounds"}}' style="padding-top: 20px;" force-render="true">
  329. <a-button type="primary" icon="plus" @click="addOutbound()">{{ i18n "pages.xray.outbound.addOutbound" }}</a-button>
  330. <a-button type="primary" icon="plus" @click="addReverse()">{{ i18n "pages.xray.outbound.addReverse" }}</a-button>
  331. <a-row>
  332. <a-col :sm="24" :md="12">
  333. <p style="margin: 10px;">{{ i18n "pages.xray.Outbounds"}}</p>
  334. <a-table :columns="outboundColumns" bordered
  335. :row-key="r => r.key"
  336. :data-source="outboundData"
  337. :scroll="isMobile ? {} : { x: 200 }"
  338. :pagination="false"
  339. :indent-size="0"
  340. :style="isMobile ? 'padding: 5px 5px' : 'margin-right: 1px;'">
  341. <template slot="action" slot-scope="text, outbound, index">
  342. [[ index+1 ]]
  343. <a-dropdown :trigger="['click']">
  344. <a-icon @click="e => e.preventDefault()" type="more" style="font-size: 16px; text-decoration: bold;"></a-icon>
  345. <a-menu slot="overlay" :theme="themeSwitcher.currentTheme">
  346. <a-menu-item @click="editOutbound(index)">
  347. <a-icon type="edit"></a-icon>
  348. {{ i18n "edit" }}
  349. </a-menu-item>
  350. <a-menu-item @click="deleteOutbound(index)">
  351. <span style="color: #FF4D4F">
  352. <a-icon type="delete"></a-icon> {{ i18n "delete"}}
  353. </span>
  354. </a-menu-item>
  355. </a-menu>
  356. </a-dropdown>
  357. </template>
  358. <template slot="address" slot-scope="text, outbound, index">
  359. <p style="margin: 0 5px;" v-for="addr in findOutboundAddress(outbound)">[[ addr ]]</p>
  360. </template>
  361. <template slot="protocol" slot-scope="text, outbound, index">
  362. <a-tag style="margin:0;" color="purple">[[ outbound.protocol ]]</a-tag>
  363. <template v-if="[Protocols.VMess, Protocols.VLESS, Protocols.Trojan, Protocols.Shadowsocks].includes(outbound.protocol)">
  364. <a-tag style="margin:0;" color="blue">[[ outbound.streamSettings.network ]]</a-tag>
  365. <a-tag style="margin:0;" v-if="outbound.streamSettings.security=='tls'" color="green">tls</a-tag>
  366. <a-tag style="margin:0;" v-if="outbound.streamSettings.security=='reality'" color="green">reality</a-tag>
  367. </template>
  368. </template>
  369. </a-table>
  370. </a-col>
  371. <a-col :sm="24" :md="12" v-if="reverseData.length>0">
  372. <p style="margin: 10px;">{{ i18n "pages.xray.outbound.reverse"}}</p>
  373. <a-table :columns="reverseColumns" bordered
  374. :row-key="r => r.key"
  375. :data-source="reverseData"
  376. :scroll="isMobile ? {} : { x: 200 }"
  377. :pagination="false"
  378. :indent-size="0"
  379. :style="isMobile ? 'padding: 5px 0' : 'margin-left: 1px;'">
  380. <template slot="action" slot-scope="text, reverse, index">
  381. [[ index+1 ]]
  382. <a-dropdown :trigger="['click']">
  383. <a-icon @click="e => e.preventDefault()" type="more" style="font-size: 16px; text-decoration: bold;"></a-icon>
  384. <a-menu slot="overlay" :theme="themeSwitcher.currentTheme">
  385. <a-menu-item @click="editReverse(index)">
  386. <a-icon type="edit"></a-icon>
  387. {{ i18n "edit" }}
  388. </a-menu-item>
  389. <a-menu-item @click="deleteReverse(index)">
  390. <span style="color: #FF4D4F">
  391. <a-icon type="delete"></a-icon> {{ i18n "delete"}}
  392. </span>
  393. </a-menu-item>
  394. </a-menu>
  395. </a-dropdown>
  396. </template>
  397. </a-table>
  398. </a-col>
  399. </a-row>
  400. </a-tab-pane>
  401. <a-tab-pane key="tpl-4" tab='{{ i18n "pages.xray.advancedTemplate"}}' style="padding-top: 20px;" force-render="true">
  402. <a-list-item-meta title='{{ i18n "pages.xray.Template"}}' description='{{ i18n "pages.xray.TemplateDesc"}}'></a-list-item-meta>
  403. <a-radio-group v-model="advSettings" @change="changeCode" button-style="solid" style="margin: 10px 0;" :size="isMobile ? 'small' : ''">
  404. <a-radio-button value="xraySetting">{{ i18n "pages.xray.completeTemplate"}}</a-radio-button>
  405. <a-radio-button value="inboundSettings">{{ i18n "pages.xray.Inbounds" }}</a-radio-button>
  406. <a-radio-button value="outboundSettings">{{ i18n "pages.xray.Outbounds" }}</a-radio-button>
  407. <a-radio-button value="routingRuleSettings">{{ i18n "pages.xray.Routings" }}</a-radio-button>
  408. </a-radio-group>
  409. <textarea style="position:absolute; left: -800px;" id="xraySetting"></textarea>
  410. </a-tab-pane>
  411. </a-tabs>
  412. </a-space>
  413. </a-spin>
  414. </a-layout-content>
  415. </a-layout>
  416. </a-layout>
  417. {{template "js" .}}
  418. {{template "component/themeSwitcher" .}}
  419. {{template "component/setting"}}
  420. {{template "ruleModal"}}
  421. {{template "outModal"}}
  422. {{template "reverseModal"}}
  423. <script>
  424. const rulesColumns = [
  425. { title: "#", align: 'center', width: 15, scopedSlots: { customRender: 'action' } },
  426. { title: '{{ i18n "pages.xray.rules.source"}}', children: [
  427. { title: 'IP', dataIndex: "source", align: 'center', width: 20, ellipsis: true },
  428. { title: 'port', dataIndex: 'sourcePort', align: 'center', width: 10, ellipsis: true } ]},
  429. { title: '{{ i18n "pages.inbounds.network"}}', children: [
  430. { title: 'L4', dataIndex: 'network', align: 'center', width: 10 },
  431. { title: 'Protocol', dataIndex: 'protocol', align: 'center', width: 10, ellipsis: true },
  432. { title: 'Attrs', dataIndex: 'attrs', align: 'center', width: 20, ellipsis: true } ]},
  433. { title: '{{ i18n "pages.xray.rules.dest"}}', children: [
  434. { title: 'IP', dataIndex: 'ip', align: 'center', width: 20, ellipsis: true },
  435. { title: 'Domain', dataIndex: 'domain', align: 'center', width: 20, ellipsis: true },
  436. { title: 'Port', dataIndex: 'port', align: 'center', width: 10, ellipsis: true }]},
  437. { title: '{{ i18n "pages.xray.rules.inbound"}}', children: [
  438. { title: 'Inbound Tag', dataIndex: 'inboundTag', align: 'center', width: 20, ellipsis: true },
  439. { title: 'Client Email', dataIndex: 'user', align: 'center', width: 20, ellipsis: true }]},
  440. { title: '{{ i18n "pages.xray.rules.outbound"}}', dataIndex: 'outboundTag', align: 'center', width: 20 },
  441. ];
  442. const rulesMobileColumns = [
  443. { title: "#", align: 'center', width: 20, scopedSlots: { customRender: 'action' } },
  444. { title: '{{ i18n "pages.xray.rules.inbound"}}', align: 'center', width: 50, ellipsis: true, scopedSlots: { customRender: 'inbound' } },
  445. { title: '{{ i18n "pages.xray.rules.outbound"}}', align: 'center', width: 50, ellipsis: true, scopedSlots: { customRender: 'outbound' } },
  446. { title: '{{ i18n "pages.xray.rules.info"}}', align: 'center', width: 50, ellipsis: true, scopedSlots: { customRender: 'info' } },
  447. ];
  448. const outboundColumns = [
  449. { title: "#", align: 'center', width: 20, scopedSlots: { customRender: 'action' } },
  450. { title: '{{ i18n "pages.xray.outbound.tag"}}', dataIndex: 'tag', align: 'center', width: 50 },
  451. { title: '{{ i18n "protocol"}}', align: 'center', width: 50, scopedSlots: { customRender: 'protocol' } },
  452. { title: '{{ i18n "pages.xray.outbound.address"}}', align: 'center', width: 50, scopedSlots: { customRender: 'address' } },
  453. ];
  454. const reverseColumns = [
  455. { title: "#", align: 'center', width: 20, scopedSlots: { customRender: 'action' } },
  456. { title: '{{ i18n "pages.xray.outbound.type"}}', dataIndex: 'type', align: 'center', width: 50 },
  457. { title: '{{ i18n "pages.xray.outbound.tag"}}', dataIndex: 'tag', align: 'center', width: 50 },
  458. { title: '{{ i18n "pages.xray.outbound.domain"}}', dataIndex: 'domain', align: 'center', width: 50 },
  459. ];
  460. const app = new Vue({
  461. delimiters: ['[[', ']]'],
  462. el: '#app',
  463. data: {
  464. siderDrawer,
  465. themeSwitcher,
  466. isDarkTheme: themeSwitcher.isDarkTheme,
  467. spinning: false,
  468. oldXraySetting: '',
  469. xraySetting: '',
  470. inboundTags: [],
  471. saveBtnDisable: true,
  472. restartResult: '',
  473. isMobile: window.innerWidth <= 768,
  474. advSettings: 'xraySetting',
  475. cm: null,
  476. cmOptions: {
  477. lineNumbers: true,
  478. mode: "application/json",
  479. lint: true,
  480. styleActiveLine: true,
  481. matchBrackets: true,
  482. theme: "xq",
  483. autoCloseTags: true,
  484. lineWrapping: true,
  485. indentUnit: 2,
  486. indentWithTabs: true,
  487. smartIndent: true,
  488. tabSize: 2,
  489. lineWiseCopyCut: false,
  490. foldGutter: true,
  491. gutters: [
  492. "CodeMirror-lint-markers",
  493. "CodeMirror-linenumbers",
  494. "CodeMirror-foldgutter",
  495. ],
  496. },
  497. ipv4Settings: {
  498. tag: "IPv4",
  499. protocol: "freedom",
  500. settings: {
  501. domainStrategy: "UseIPv4"
  502. }
  503. },
  504. warpSettings: {
  505. tag: "WARP",
  506. protocol: "socks",
  507. settings: {
  508. servers: [
  509. {
  510. address: "127.0.0.1",
  511. port: 40000
  512. }
  513. ]
  514. }
  515. },
  516. directSettings: {
  517. tag: "direct",
  518. protocol: "freedom"
  519. },
  520. outboundDomainStrategies: ["AsIs", "UseIP", "UseIPv4", "UseIPv6"],
  521. routingDomainStrategies: ["AsIs", "IPIfNonMatch", "IPOnDemand"],
  522. settingsData: {
  523. protocols: {
  524. bittorrent: ["bittorrent"],
  525. },
  526. ips: {
  527. local: ["geoip:private"],
  528. cn: ["geoip:cn"],
  529. ir: ["ext:geoip_IR.dat:ir"],
  530. ru: ["geoip:ru"],
  531. vn: ["ext:geoip_VN.dat:vn"],
  532. },
  533. domains: {
  534. ads: [
  535. "geosite:category-ads-all",
  536. "ext:geosite_IR.dat:category-ads-all"
  537. ],
  538. speedtest: ["geosite:speedtest"],
  539. openai: ["geosite:openai"],
  540. google: ["geosite:google"],
  541. spotify: ["geosite:spotify"],
  542. netflix: ["geosite:netflix"],
  543. cn: [
  544. "geosite:cn",
  545. "regexp:.*\\.cn$"
  546. ],
  547. ru: [
  548. "geosite:category-gov-ru",
  549. "regexp:.*\\.ru$"
  550. ],
  551. ir: [
  552. "regexp:.*\\.ir$",
  553. "regexp:.*\\.xn--mgba3a4f16a$", // .ایران
  554. "ext:geosite_IR.dat:ir" // have rules to bypass all .ir domains.
  555. ],
  556. vn: [
  557. "regexp:.*\\.vn$",
  558. "ext:geosite_VN.dat:vn",
  559. "ext:geosite_VN.dat:ads"
  560. ]
  561. },
  562. familyProtectDNS: {
  563. "servers": [
  564. "1.1.1.3", // https://developers.cloudflare.com/1.1.1.1/setup/
  565. "1.0.0.3",
  566. "94.140.14.15", // https://adguard-dns.io/kb/general/dns-providers/
  567. "94.140.15.16"
  568. ],
  569. "queryStrategy": "UseIPv4"
  570. },
  571. }
  572. },
  573. methods: {
  574. loading(spinning = true) {
  575. this.spinning = spinning;
  576. },
  577. async getXraySetting() {
  578. this.loading(true);
  579. const msg = await HttpUtil.post("/panel/xray/");
  580. this.loading(false);
  581. if (msg.success) {
  582. result = JSON.parse(msg.obj);
  583. xs = JSON.stringify(result.xraySetting, null, 2);
  584. this.oldXraySetting = xs;
  585. this.xraySetting = xs;
  586. this.inboundTags = result.inboundTags;
  587. this.saveBtnDisable = true;
  588. }
  589. },
  590. async updateXraySetting() {
  591. this.loading(true);
  592. const msg = await HttpUtil.post("/panel/xray/update", {xraySetting : this.xraySetting});
  593. this.loading(false);
  594. if (msg.success) {
  595. await this.getXraySetting();
  596. }
  597. },
  598. async restartXray() {
  599. this.loading(true);
  600. const msg = await HttpUtil.post("server/restartXrayService");
  601. this.loading(false);
  602. if (msg.success) {
  603. await PromiseUtil.sleep(500);
  604. await this.getXrayResult();
  605. }
  606. this.loading(false);
  607. },
  608. async getXrayResult() {
  609. const msg = await HttpUtil.get("/panel/xray/getXrayResult");
  610. if(msg.success){
  611. this.restartResult=msg.obj;
  612. if(msg.obj.length > 1) Vue.prototype.$message.error(msg.obj);
  613. }
  614. },
  615. async fetchUserSecret() {
  616. this.loading(true);
  617. const userMessage = await HttpUtil.post("/panel/setting/getUserSecret", this.user);
  618. if (userMessage.success) {
  619. this.user = userMessage.obj;
  620. }
  621. this.loading(false);
  622. },
  623. async updateSecret() {
  624. this.loading(true);
  625. const msg = await HttpUtil.post("/panel/setting/updateUserSecret", this.user);
  626. if (msg.success) {
  627. this.user = msg.obj;
  628. window.location.replace(basePath + "logout");
  629. }
  630. this.loading(false);
  631. await this.updateXraySetting();
  632. },
  633. generateRandomString(length) {
  634. var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
  635. let randomString = "";
  636. for (let i = 0; i < length; i++) {
  637. randomString += chars[Math.floor(Math.random() * chars.length)];
  638. }
  639. return randomString;
  640. },
  641. async getNewSecret() {
  642. this.loading(true);
  643. await PromiseUtil.sleep(600);
  644. const newSecret = this.generateRandomString(64);
  645. this.user.loginSecret = newSecret;
  646. document.getElementById("token").textContent = newSecret;
  647. this.loading(false);
  648. },
  649. async toggleToken(value) {
  650. if (value) {
  651. await this.getNewSecret();
  652. } else {
  653. this.user.loginSecret = "";
  654. }
  655. },
  656. async resetXrayConfigToDefault() {
  657. this.loading(true);
  658. const msg = await HttpUtil.get("/panel/setting/getDefaultJsonConfig");
  659. this.loading(false);
  660. if (msg.success) {
  661. this.templateSettings = JSON.parse(JSON.stringify(msg.obj, null, 2));
  662. this.saveBtnDisable = true;
  663. }
  664. },
  665. syncRulesWithOutbound(tag, setting) {
  666. const newTemplateSettings = {...this.templateSettings};
  667. const haveRules = newTemplateSettings.routing.rules.some((r) => r?.outboundTag === tag);
  668. const outboundIndex = newTemplateSettings.outbounds.findIndex((o) => o.tag === tag);
  669. if (!haveRules && outboundIndex >= 0) {
  670. newTemplateSettings.outbounds.splice(outboundIndex, 1);
  671. }
  672. if (haveRules && outboundIndex === -1) {
  673. newTemplateSettings.outbounds.push(setting);
  674. }
  675. this.templateSettings = newTemplateSettings;
  676. },
  677. templateRuleGetter(routeSettings) {
  678. const { property, outboundTag } = routeSettings;
  679. let result = [];
  680. if (this.templateSettings != null) {
  681. this.templateSettings.routing.rules.forEach(
  682. (routingRule) => {
  683. if (
  684. routingRule.hasOwnProperty(property) &&
  685. routingRule.hasOwnProperty("outboundTag") &&
  686. routingRule.outboundTag === outboundTag
  687. ) {
  688. result.push(...routingRule[property]);
  689. }
  690. }
  691. );
  692. }
  693. return result;
  694. },
  695. templateRuleSetter(routeSettings) {
  696. const { data, property, outboundTag } = routeSettings;
  697. const oldTemplateSettings = this.templateSettings;
  698. const newTemplateSettings = oldTemplateSettings;
  699. currentProperty = this.templateRuleGetter({ outboundTag, property })
  700. if (currentProperty.length == 0) {
  701. const propertyRule = {
  702. type: "field",
  703. outboundTag,
  704. [property]: data
  705. };
  706. newTemplateSettings.routing.rules.push(propertyRule);
  707. }
  708. else {
  709. const newRules = [];
  710. insertedOnce = false;
  711. newTemplateSettings.routing.rules.forEach(
  712. (routingRule) => {
  713. if (
  714. routingRule.hasOwnProperty(property) &&
  715. routingRule.hasOwnProperty("outboundTag") &&
  716. routingRule.outboundTag === outboundTag
  717. ) {
  718. if (!insertedOnce && data.length > 0) {
  719. insertedOnce = true;
  720. routingRule[property] = data;
  721. newRules.push(routingRule);
  722. }
  723. }
  724. else {
  725. newRules.push(routingRule);
  726. }
  727. }
  728. );
  729. newTemplateSettings.routing.rules = newRules;
  730. }
  731. this.templateSettings = newTemplateSettings;
  732. },
  733. changeCode() {
  734. if(this.cm != null) {
  735. this.cm.toTextArea();
  736. }
  737. textAreaObj = document.getElementById('xraySetting');
  738. textAreaObj.value = this[this.advSettings];
  739. this.cm = CodeMirror.fromTextArea(textAreaObj, this.cmOptions);
  740. this.cm.on('change',editor => {
  741. value = editor.getValue();
  742. if(this.isJsonString(value)){
  743. this[this.advSettings] = value;
  744. }
  745. });
  746. },
  747. isJsonString(str) {
  748. try {
  749. JSON.parse(str);
  750. } catch (e) {
  751. return false;
  752. }
  753. return true;
  754. },
  755. findOutboundAddress(o) {
  756. serverObj = null;
  757. switch(o.protocol){
  758. case Protocols.VMess:
  759. case Protocols.VLESS:
  760. serverObj = o.settings.vnext;
  761. break;
  762. case Protocols.HTTP:
  763. case Protocols.Socks:
  764. case Protocols.Shadowsocks:
  765. case Protocols.Trojan:
  766. serverObj = o.settings.servers;
  767. break;
  768. case Protocols.DNS:
  769. return [o.settings.address + ':' + o.settings.port];
  770. default:
  771. return null;
  772. }
  773. return serverObj ? serverObj.map(obj => obj.address + ':' + obj.port) : null;
  774. },
  775. addOutbound(){
  776. outModal.show({
  777. title: '{{ i18n "pages.xray.outbound.addOutbound"}}',
  778. okText: '{{ i18n "pages.xray.outbound.addOutbound" }}',
  779. confirm: (outbound) => {
  780. outModal.loading();
  781. if(outbound.tag.length > 0){
  782. this.templateSettings.outbounds.push(outbound);
  783. this.outboundSettings = JSON.stringify(this.templateSettings.outbounds);
  784. }
  785. outModal.close();
  786. },
  787. isEdit: false,
  788. tags: this.templateSettings.outbounds.map(obj => obj.tag)
  789. });
  790. },
  791. editOutbound(index){
  792. outModal.show({
  793. title: '{{ i18n "pages.xray.outbound.editOutbound"}} ' + (index+1),
  794. outbound: app.templateSettings.outbounds[index],
  795. confirm: (outbound) => {
  796. outModal.loading();
  797. this.templateSettings.outbounds[index] = outbound;
  798. this.outboundSettings = JSON.stringify(this.templateSettings.outbounds);
  799. outModal.close();
  800. },
  801. isEdit: true,
  802. tags: this.outboundData.filter((o) => o.key != index ).map(obj => obj.tag)
  803. });
  804. },
  805. deleteOutbound(index){
  806. outbounds = this.templateSettings.outbounds;
  807. outbounds.splice(index,1);
  808. this.outboundSettings = JSON.stringify(outbounds);
  809. },
  810. addReverse(){
  811. reverseModal.show({
  812. title: '{{ i18n "pages.xray.outbound.addReverse"}}',
  813. okText: '{{ i18n "pages.xray.outbound.addReverse" }}',
  814. confirm: (reverse, rules) => {
  815. reverseModal.loading();
  816. if(reverse.tag.length > 0){
  817. newTemplateSettings = this.templateSettings;
  818. if(newTemplateSettings.reverse == undefined) newTemplateSettings.reverse = {};
  819. if(newTemplateSettings.reverse[reverse.type+'s'] == undefined) newTemplateSettings.reverse[reverse.type+'s'] = [];
  820. newTemplateSettings.reverse[reverse.type+'s'].push({ tag: reverse.tag, domain: reverse.domain });
  821. this.templateSettings = newTemplateSettings;
  822. // Add related rules
  823. this.templateSettings.routing.rules.push(...rules);
  824. this.routingRuleSettings = JSON.stringify(this.templateSettings.routing.rules);
  825. }
  826. reverseModal.close();
  827. },
  828. isEdit: false
  829. });
  830. },
  831. editReverse(index){
  832. if(this.reverseData[index].type == "bridge") {
  833. oldRules = this.templateSettings.routing.rules.filter(r => r.inboundTag && r.inboundTag[0] == this.reverseData[index].tag);
  834. } else {
  835. oldRules = this.templateSettings.routing.rules.filter(r => r.outboundTag && r.outboundTag == this.reverseData[index].tag);
  836. }
  837. reverseModal.show({
  838. title: '{{ i18n "pages.xray.outbound.editReverse"}} ' + (index+1),
  839. reverse: this.reverseData[index],
  840. rules: oldRules,
  841. confirm: (reverse, rules) => {
  842. reverseModal.loading();
  843. if(reverse.tag.length > 0){
  844. oldtag = this.reverseData[index].tag;
  845. this.deleteReverse(index);
  846. newTemplateSettings = this.templateSettings;
  847. if(newTemplateSettings.reverse == undefined) newTemplateSettings.reverse = {};
  848. if(newTemplateSettings.reverse[reverse.type+'s'] == undefined) newTemplateSettings.reverse[reverse.type+'s'] = [];
  849. newTemplateSettings.reverse[reverse.type+'s'].push({ tag: reverse.tag, domain: reverse.domain });
  850. this.templateSettings = newTemplateSettings;
  851. // Adjust Rules
  852. newRules = this.templateSettings.routing.rules.filter(r => r.outboundTag != oldtag && (r.inboundTag && !r.inboundTag.includes(oldtag)));
  853. newRules.push(...rules)
  854. this.routingRuleSettings = JSON.stringify(newRules);
  855. }
  856. reverseModal.close();
  857. },
  858. isEdit: true
  859. });
  860. },
  861. deleteReverse(index){
  862. oldData = this.reverseData[index];
  863. newTemplateSettings = this.templateSettings;
  864. reverseTypeObj = newTemplateSettings.reverse[oldData.type+'s'];
  865. realIndex = reverseTypeObj.findIndex(r => r.tag==oldData.tag && r.domain==oldData.domain);
  866. newTemplateSettings.reverse[oldData.type+'s'].splice(realIndex,1);
  867. if(reverseTypeObj.length == 0) Reflect.deleteProperty(newTemplateSettings.reverse, oldData.type+'s');
  868. if(Object.keys(newTemplateSettings.reverse).length === 0) Reflect.deleteProperty(newTemplateSettings, 'reverse');
  869. newRules = newTemplateSettings.routing.rules.filter(r => r.outboundTag != oldData.tag && (r.inboundTag && !r.inboundTag.includes(oldData.tag)));
  870. newTemplateSettings.routing.rules = newRules;
  871. this.templateSettings = newTemplateSettings;
  872. },
  873. addRule(){
  874. ruleModal.show({
  875. title: '{{ i18n "pages.xray.rules.add"}}',
  876. okText: '{{ i18n "pages.xray.rules.add" }}',
  877. confirm: (rule) => {
  878. ruleModal.loading();
  879. if(JSON.stringify(rule).length > 3){
  880. this.templateSettings.routing.rules.push(rule);
  881. this.routingRuleSettings = JSON.stringify(this.templateSettings.routing.rules);
  882. }
  883. ruleModal.close();
  884. },
  885. isEdit: false
  886. });
  887. },
  888. editRule(index){
  889. ruleModal.show({
  890. title: '{{ i18n "pages.xray.rules.edit"}} ' + (index+1),
  891. rule: app.templateSettings.routing.rules[index],
  892. confirm: (rule) => {
  893. ruleModal.loading();
  894. if(JSON.stringify(rule).length > 3){
  895. this.templateSettings.routing.rules[index] = rule;
  896. this.routingRuleSettings = JSON.stringify(this.templateSettings.routing.rules);
  897. }
  898. ruleModal.close();
  899. },
  900. isEdit: true
  901. });
  902. },
  903. replaceRule(old_index,new_index){
  904. rules = this.templateSettings.routing.rules;
  905. if (new_index >= rules.length) rules.push(undefined);
  906. rules.splice(new_index, 0, rules.splice(old_index, 1)[0]);
  907. this.routingRuleSettings = JSON.stringify(rules);
  908. },
  909. deleteRule(index){
  910. rules = this.templateSettings.routing.rules;
  911. rules.splice(index,1);
  912. this.routingRuleSettings = JSON.stringify(rules);
  913. }
  914. },
  915. async mounted() {
  916. await this.getXraySetting();
  917. await this.getXrayResult();
  918. while (true) {
  919. await PromiseUtil.sleep(600);
  920. this.saveBtnDisable = this.oldXraySetting === this.xraySetting;
  921. }
  922. },
  923. computed: {
  924. templateSettings: {
  925. get: function () { return this.xraySetting ? JSON.parse(this.xraySetting) : null; },
  926. set: function (newValue) { this.xraySetting = JSON.stringify(newValue, null, 2); },
  927. },
  928. inboundSettings: {
  929. get: function () { return this.templateSettings ? JSON.stringify(this.templateSettings.inbounds, null, 2) : null; },
  930. set: function (newValue) {
  931. newTemplateSettings = this.templateSettings;
  932. newTemplateSettings.inbounds = JSON.parse(newValue);
  933. this.templateSettings = newTemplateSettings;
  934. },
  935. },
  936. outboundSettings: {
  937. get: function () { return this.templateSettings ? JSON.stringify(this.templateSettings.outbounds, null, 2) : null; },
  938. set: function (newValue) {
  939. newTemplateSettings = this.templateSettings;
  940. newTemplateSettings.outbounds = JSON.parse(newValue);
  941. this.templateSettings = newTemplateSettings;
  942. },
  943. },
  944. outboundData: {
  945. get: function () {
  946. data = []
  947. if (this.templateSettings != null) {
  948. this.templateSettings.outbounds.forEach((o, index) => {
  949. data.push({'key': index, ...o});
  950. });
  951. }
  952. return data;
  953. },
  954. },
  955. reverseData: {
  956. get: function () {
  957. data = []
  958. if (this.templateSettings != null && this.templateSettings.reverse != null) {
  959. if(this.templateSettings.reverse.bridges) {
  960. this.templateSettings.reverse.bridges.forEach((o, index) => {
  961. data.push({'key': index, 'type':'bridge', ...o});
  962. });
  963. }
  964. if(this.templateSettings.reverse.portals){
  965. this.templateSettings.reverse.portals.forEach((o, index) => {
  966. data.push({'key': index, 'type':'portal', ...o});
  967. });
  968. }
  969. }
  970. return data;
  971. },
  972. },
  973. routingRuleSettings: {
  974. get: function () { return this.templateSettings ? JSON.stringify(this.templateSettings.routing.rules, null, 2) : null; },
  975. set: function (newValue) {
  976. newTemplateSettings = this.templateSettings;
  977. newTemplateSettings.routing.rules = JSON.parse(newValue);
  978. this.templateSettings = newTemplateSettings;
  979. },
  980. },
  981. routingRuleData: {
  982. get: function () {
  983. data = [];
  984. if (this.templateSettings != null) {
  985. this.templateSettings.routing.rules.forEach((r, index) => {
  986. data.push({'key': index, ...r});
  987. });
  988. // Make rules readable
  989. data.forEach(r => {
  990. if(r.domain) r.domain = r.domain.join(',')
  991. if(r.ip) r.ip = r.ip.join(',')
  992. if(r.source) r.source = r.source.join(',');
  993. if(r.user) r.user = r.user.join(',')
  994. if(r.inboundTag) r.inboundTag = r.inboundTag.join(',')
  995. if(r.protocol) r.protocol = r.protocol.join(',')
  996. if(r.attrs) r.attrs = JSON.stringify(r.attrs, null, 2)
  997. });
  998. }
  999. return data;
  1000. }
  1001. },
  1002. freedomStrategy: {
  1003. get: function () {
  1004. if (!this.templateSettings) return "AsIs";
  1005. freedomOutbound = this.templateSettings.outbounds.find((o) => o.protocol === "freedom" && o.tag == "direct");
  1006. if (!freedomOutbound) return "AsIs";
  1007. if (!freedomOutbound.settings || !freedomOutbound.settings.domainStrategy) return "AsIs";
  1008. return freedomOutbound.settings.domainStrategy;
  1009. },
  1010. set: function (newValue) {
  1011. newTemplateSettings = this.templateSettings;
  1012. freedomOutboundIndex = newTemplateSettings.outbounds.findIndex((o) => o.protocol === "freedom" && o.tag == "direct");
  1013. if(freedomOutboundIndex == -1){
  1014. newTemplateSettings.outbounds.push({protocol: "freedom", tag: "direct", settings: { "domainStrategy": newValue }});
  1015. } else if (!newTemplateSettings.outbounds[freedomOutboundIndex].settings) {
  1016. newTemplateSettings.outbounds[freedomOutboundIndex].settings = {"domainStrategy": newValue};
  1017. } else {
  1018. newTemplateSettings.outbounds[freedomOutboundIndex].settings.domainStrategy = newValue;
  1019. }
  1020. this.templateSettings = newTemplateSettings;
  1021. }
  1022. },
  1023. routingStrategy: {
  1024. get: function () {
  1025. if (!this.templateSettings || !this.templateSettings.routing || !this.templateSettings.routing.domainStrategy) return "AsIs";
  1026. return this.templateSettings.routing.domainStrategy;
  1027. },
  1028. set: function (newValue) {
  1029. newTemplateSettings = this.templateSettings;
  1030. newTemplateSettings.routing.domainStrategy = newValue;
  1031. this.templateSettings = newTemplateSettings;
  1032. }
  1033. },
  1034. blockedIPs: {
  1035. get: function () {
  1036. return this.templateRuleGetter({ outboundTag: "blocked", property: "ip" });
  1037. },
  1038. set: function (newValue) {
  1039. this.templateRuleSetter({ outboundTag: "blocked", property: "ip", data: newValue });
  1040. }
  1041. },
  1042. blockedDomains: {
  1043. get: function () {
  1044. return this.templateRuleGetter({ outboundTag: "blocked", property: "domain" });
  1045. },
  1046. set: function (newValue) {
  1047. this.templateRuleSetter({ outboundTag: "blocked", property: "domain", data: newValue });
  1048. }
  1049. },
  1050. blockedProtocols: {
  1051. get: function () {
  1052. return this.templateRuleGetter({ outboundTag: "blocked", property: "protocol" });
  1053. },
  1054. set: function (newValue) {
  1055. this.templateRuleSetter({ outboundTag: "blocked", property: "protocol", data: newValue });
  1056. }
  1057. },
  1058. directIPs: {
  1059. get: function () {
  1060. return this.templateRuleGetter({ outboundTag: "direct", property: "ip" });
  1061. },
  1062. set: function (newValue) {
  1063. this.templateRuleSetter({ outboundTag: "direct", property: "ip", data: newValue });
  1064. this.syncRulesWithOutbound("direct", this.directSettings);
  1065. }
  1066. },
  1067. directDomains: {
  1068. get: function () {
  1069. return this.templateRuleGetter({ outboundTag: "direct", property: "domain" });
  1070. },
  1071. set: function (newValue) {
  1072. this.templateRuleSetter({ outboundTag: "direct", property: "domain", data: newValue });
  1073. this.syncRulesWithOutbound("direct", this.directSettings);
  1074. }
  1075. },
  1076. ipv4Domains: {
  1077. get: function () {
  1078. return this.templateRuleGetter({ outboundTag: "IPv4", property: "domain" });
  1079. },
  1080. set: function (newValue) {
  1081. this.templateRuleSetter({ outboundTag: "IPv4", property: "domain", data: newValue });
  1082. this.syncRulesWithOutbound("IPv4", this.ipv4Settings);
  1083. }
  1084. },
  1085. warpDomains: {
  1086. get: function () {
  1087. return this.templateRuleGetter({ outboundTag: "WARP", property: "domain" });
  1088. },
  1089. set: function (newValue) {
  1090. this.templateRuleSetter({ outboundTag: "WARP", property: "domain", data: newValue });
  1091. this.syncRulesWithOutbound("WARP", this.warpSettings);
  1092. }
  1093. },
  1094. manualBlockedIPs: {
  1095. get: function () { return JSON.stringify(this.blockedIPs, null, 2); },
  1096. set: debounce(function (value) { this.blockedIPs = JSON.parse(value); }, 1000)
  1097. },
  1098. manualBlockedDomains: {
  1099. get: function () { return JSON.stringify(this.blockedDomains, null, 2); },
  1100. set: debounce(function (value) { this.blockedDomains = JSON.parse(value); }, 1000)
  1101. },
  1102. manualDirectIPs: {
  1103. get: function () { return JSON.stringify(this.directIPs, null, 2); },
  1104. set: debounce(function (value) { this.directIPs = JSON.parse(value); }, 1000)
  1105. },
  1106. manualDirectDomains: {
  1107. get: function () { return JSON.stringify(this.directDomains, null, 2); },
  1108. set: debounce(function (value) { this.directDomains = JSON.parse(value); }, 1000)
  1109. },
  1110. manualIPv4Domains: {
  1111. get: function () { return JSON.stringify(this.ipv4Domains, null, 2); },
  1112. set: debounce(function (value) { this.ipv4Domains = JSON.parse(value); }, 1000)
  1113. },
  1114. manualWARPDomains: {
  1115. get: function () { return JSON.stringify(this.warpDomains, null, 2); },
  1116. set: debounce(function (value) { this.warpDomains = JSON.parse(value); }, 1000)
  1117. },
  1118. torrentSettings: {
  1119. get: function () {
  1120. return doAllItemsExist(this.settingsData.protocols.bittorrent, this.blockedProtocols);
  1121. },
  1122. set: function (newValue) {
  1123. if (newValue) {
  1124. this.blockedProtocols = [...this.blockedProtocols, ...this.settingsData.protocols.bittorrent];
  1125. } else {
  1126. this.blockedProtocols = this.blockedProtocols.filter(data => !this.settingsData.protocols.bittorrent.includes(data));
  1127. }
  1128. },
  1129. },
  1130. privateIpSettings: {
  1131. get: function () {
  1132. return doAllItemsExist(this.settingsData.ips.local, this.blockedIPs);
  1133. },
  1134. set: function (newValue) {
  1135. if (newValue) {
  1136. this.blockedIPs = [...this.blockedIPs, ...this.settingsData.ips.local];
  1137. } else {
  1138. this.blockedIPs = this.blockedIPs.filter(data => !this.settingsData.ips.local.includes(data));
  1139. }
  1140. },
  1141. },
  1142. AdsSettings: {
  1143. get: function () {
  1144. return doAllItemsExist(this.settingsData.domains.ads, this.blockedDomains);
  1145. },
  1146. set: function (newValue) {
  1147. if (newValue) {
  1148. this.blockedDomains = [...this.blockedDomains, ...this.settingsData.domains.ads];
  1149. } else {
  1150. this.blockedDomains = this.blockedDomains.filter(data => !this.settingsData.domains.ads.includes(data));
  1151. }
  1152. },
  1153. },
  1154. SpeedTestSettings: {
  1155. get: function () {
  1156. return doAllItemsExist(this.settingsData.domains.speedtest, this.blockedDomains);
  1157. },
  1158. set: function (newValue) {
  1159. if (newValue) {
  1160. this.blockedDomains = [...this.blockedDomains, ...this.settingsData.domains.speedtest];
  1161. } else {
  1162. this.blockedDomains = this.blockedDomains.filter(data => !this.settingsData.domains.speedtest.includes(data));
  1163. }
  1164. },
  1165. },
  1166. familyProtectSettings: {
  1167. get: function () {
  1168. if (!this.templateSettings || !this.templateSettings.dns || !this.templateSettings.dns.servers) return false;
  1169. return doAllItemsExist(this.templateSettings.dns.servers, this.settingsData.familyProtectDNS.servers);
  1170. },
  1171. set: function (newValue) {
  1172. newTemplateSettings = this.templateSettings;
  1173. if (newValue) {
  1174. newTemplateSettings.dns = this.settingsData.familyProtectDNS;
  1175. } else {
  1176. delete newTemplateSettings.dns;
  1177. }
  1178. this.templateSettings = newTemplateSettings;
  1179. },
  1180. },
  1181. GoogleIPv4Settings: {
  1182. get: function () {
  1183. return doAllItemsExist(this.settingsData.domains.google, this.ipv4Domains);
  1184. },
  1185. set: function (newValue) {
  1186. if (newValue) {
  1187. this.ipv4Domains = [...this.ipv4Domains, ...this.settingsData.domains.google];
  1188. } else {
  1189. this.ipv4Domains = this.ipv4Domains.filter(data => !this.settingsData.domains.google.includes(data));
  1190. }
  1191. },
  1192. },
  1193. NetflixIPv4Settings: {
  1194. get: function () {
  1195. return doAllItemsExist(this.settingsData.domains.netflix, this.ipv4Domains);
  1196. },
  1197. set: function (newValue) {
  1198. if (newValue) {
  1199. this.ipv4Domains = [...this.ipv4Domains, ...this.settingsData.domains.netflix];
  1200. } else {
  1201. this.ipv4Domains = this.ipv4Domains.filter(data => !this.settingsData.domains.netflix.includes(data));
  1202. }
  1203. },
  1204. },
  1205. IRIpSettings: {
  1206. get: function () {
  1207. return doAllItemsExist(this.settingsData.ips.ir, this.blockedIPs);
  1208. },
  1209. set: function (newValue) {
  1210. if (newValue) {
  1211. this.blockedIPs = [...this.blockedIPs, ...this.settingsData.ips.ir];
  1212. } else {
  1213. this.blockedIPs = this.blockedIPs.filter(data => !this.settingsData.ips.ir.includes(data));
  1214. }
  1215. }
  1216. },
  1217. IRDomainSettings: {
  1218. get: function () {
  1219. return doAllItemsExist(this.settingsData.domains.ir, this.blockedDomains);
  1220. },
  1221. set: function (newValue) {
  1222. if (newValue) {
  1223. this.blockedDomains = [...this.blockedDomains, ...this.settingsData.domains.ir];
  1224. } else {
  1225. this.blockedDomains = this.blockedDomains.filter(data => !this.settingsData.domains.ir.includes(data));
  1226. }
  1227. }
  1228. },
  1229. ChinaIpSettings: {
  1230. get: function () {
  1231. return doAllItemsExist(this.settingsData.ips.cn, this.blockedIPs);
  1232. },
  1233. set: function (newValue) {
  1234. if (newValue) {
  1235. this.blockedIPs = [...this.blockedIPs, ...this.settingsData.ips.cn];
  1236. } else {
  1237. this.blockedIPs = this.blockedIPs.filter(data => !this.settingsData.ips.cn.includes(data));
  1238. }
  1239. }
  1240. },
  1241. ChinaDomainSettings: {
  1242. get: function () {
  1243. return doAllItemsExist(this.settingsData.domains.cn, this.blockedDomains);
  1244. },
  1245. set: function (newValue) {
  1246. if (newValue) {
  1247. this.blockedDomains = [...this.blockedDomains, ...this.settingsData.domains.cn];
  1248. } else {
  1249. this.blockedDomains = this.blockedDomains.filter(data => !this.settingsData.domains.cn.includes(data));
  1250. }
  1251. }
  1252. },
  1253. RussiaIpSettings: {
  1254. get: function () {
  1255. return doAllItemsExist(this.settingsData.ips.ru, this.blockedIPs);
  1256. },
  1257. set: function (newValue) {
  1258. if (newValue) {
  1259. this.blockedIPs = [...this.blockedIPs, ...this.settingsData.ips.ru];
  1260. } else {
  1261. this.blockedIPs = this.blockedIPs.filter(data => !this.settingsData.ips.ru.includes(data));
  1262. }
  1263. }
  1264. },
  1265. RussiaDomainSettings: {
  1266. get: function () {
  1267. return doAllItemsExist(this.settingsData.domains.ru, this.blockedDomains);
  1268. },
  1269. set: function (newValue) {
  1270. if (newValue) {
  1271. this.blockedDomains = [...this.blockedDomains, ...this.settingsData.domains.ru];
  1272. } else {
  1273. this.blockedDomains = this.blockedDomains.filter(data => !this.settingsData.domains.ru.includes(data));
  1274. }
  1275. }
  1276. },
  1277. VNIpSettings: {
  1278. get: function () {
  1279. return doAllItemsExist(this.settingsData.ips.vn, this.blockedIPs);
  1280. },
  1281. set: function (newValue) {
  1282. if (newValue) {
  1283. this.blockedIPs = [...this.blockedIPs, ...this.settingsData.ips.vn];
  1284. } else {
  1285. this.blockedIPs = this.blockedIPs.filter(data => !this.settingsData.ips.vn.includes(data));
  1286. }
  1287. }
  1288. },
  1289. VNDomainSettings: {
  1290. get: function () {
  1291. return doAllItemsExist(this.settingsData.domains.vn, this.blockedDomains);
  1292. },
  1293. set: function (newValue) {
  1294. if (newValue) {
  1295. this.blockedDomains = [...this.blockedDomains, ...this.settingsData.domains.vn];
  1296. } else {
  1297. this.blockedDomains = this.blockedDomains.filter(data => !this.settingsData.domains.vn.includes(data));
  1298. }
  1299. }
  1300. },
  1301. IRIpDirectSettings: {
  1302. get: function () {
  1303. return doAllItemsExist(this.settingsData.ips.ir, this.directIPs);
  1304. },
  1305. set: function (newValue) {
  1306. if (newValue) {
  1307. this.directIPs = [...this.directIPs, ...this.settingsData.ips.ir];
  1308. } else {
  1309. this.directIPs = this.directIPs.filter(data => !this.settingsData.ips.ir.includes(data));
  1310. }
  1311. }
  1312. },
  1313. IRDomainDirectSettings: {
  1314. get: function () {
  1315. return doAllItemsExist(this.settingsData.domains.ir, this.directDomains);
  1316. },
  1317. set: function (newValue) {
  1318. if (newValue) {
  1319. this.directDomains = [...this.directDomains, ...this.settingsData.domains.ir];
  1320. } else {
  1321. this.directDomains = this.directDomains.filter(data => !this.settingsData.domains.ir.includes(data));
  1322. }
  1323. }
  1324. },
  1325. ChinaIpDirectSettings: {
  1326. get: function () {
  1327. return doAllItemsExist(this.settingsData.ips.cn, this.directIPs);
  1328. },
  1329. set: function (newValue) {
  1330. if (newValue) {
  1331. this.directIPs = [...this.directIPs, ...this.settingsData.ips.cn];
  1332. } else {
  1333. this.directIPs = this.directIPs.filter(data => !this.settingsData.ips.cn.includes(data));
  1334. }
  1335. }
  1336. },
  1337. ChinaDomainDirectSettings: {
  1338. get: function () {
  1339. return doAllItemsExist(this.settingsData.domains.cn, this.directDomains);
  1340. },
  1341. set: function (newValue) {
  1342. if (newValue) {
  1343. this.directDomains = [...this.directDomains, ...this.settingsData.domains.cn];
  1344. } else {
  1345. this.directDomains = this.directDomains.filter(data => !this.settingsData.domains.cn.includes(data));
  1346. }
  1347. }
  1348. },
  1349. RussiaIpDirectSettings: {
  1350. get: function () {
  1351. return doAllItemsExist(this.settingsData.ips.ru, this.directIPs);
  1352. },
  1353. set: function (newValue) {
  1354. if (newValue) {
  1355. this.directIPs = [...this.directIPs, ...this.settingsData.ips.ru];
  1356. } else {
  1357. this.directIPs = this.directIPs.filter(data => !this.settingsData.ips.ru.includes(data));
  1358. }
  1359. }
  1360. },
  1361. RussiaDomainDirectSettings: {
  1362. get: function () {
  1363. return doAllItemsExist(this.settingsData.domains.ru, this.directDomains);
  1364. },
  1365. set: function (newValue) {
  1366. if (newValue) {
  1367. this.directDomains = [...this.directDomains, ...this.settingsData.domains.ru];
  1368. } else {
  1369. this.directDomains = this.directDomains.filter(data => !this.settingsData.domains.ru.includes(data));
  1370. }
  1371. }
  1372. },
  1373. VNIpDirectSettings: {
  1374. get: function () {
  1375. return doAllItemsExist(this.settingsData.ips.vn, this.directIPs);
  1376. },
  1377. set: function (newValue) {
  1378. if (newValue) {
  1379. this.directIPs = [...this.directIPs, ...this.settingsData.ips.vn];
  1380. } else {
  1381. this.directIPs = this.directIPs.filter(data => !this.settingsData.ips.vn.includes(data));
  1382. }
  1383. }
  1384. },
  1385. VNDomainDirectSettings: {
  1386. get: function () {
  1387. return doAllItemsExist(this.settingsData.domains.vn, this.directDomains);
  1388. },
  1389. set: function (newValue) {
  1390. if (newValue) {
  1391. this.directDomains = [...this.directDomains, ...this.settingsData.domains.vn];
  1392. } else {
  1393. this.directDomains = this.directDomains.filter(data => !this.settingsData.domains.vn.includes(data));
  1394. }
  1395. }
  1396. },
  1397. GoogleWARPSettings: {
  1398. get: function () {
  1399. return doAllItemsExist(this.settingsData.domains.google, this.warpDomains);
  1400. },
  1401. set: function (newValue) {
  1402. if (newValue) {
  1403. this.warpDomains = [...this.warpDomains, ...this.settingsData.domains.google];
  1404. } else {
  1405. this.warpDomains = this.warpDomains.filter(data => !this.settingsData.domains.google.includes(data));
  1406. }
  1407. },
  1408. },
  1409. OpenAIWARPSettings: {
  1410. get: function () {
  1411. return doAllItemsExist(this.settingsData.domains.openai, this.warpDomains);
  1412. },
  1413. set: function (newValue) {
  1414. if (newValue) {
  1415. this.warpDomains = [...this.warpDomains, ...this.settingsData.domains.openai];
  1416. } else {
  1417. this.warpDomains = this.warpDomains.filter(data => !this.settingsData.domains.openai.includes(data));
  1418. }
  1419. },
  1420. },
  1421. NetflixWARPSettings: {
  1422. get: function () {
  1423. return doAllItemsExist(this.settingsData.domains.netflix, this.warpDomains);
  1424. },
  1425. set: function (newValue) {
  1426. if (newValue) {
  1427. this.warpDomains = [...this.warpDomains, ...this.settingsData.domains.netflix];
  1428. } else {
  1429. this.warpDomains = this.warpDomains.filter(data => !this.settingsData.domains.netflix.includes(data));
  1430. }
  1431. },
  1432. },
  1433. SpotifyWARPSettings: {
  1434. get: function () {
  1435. return doAllItemsExist(this.settingsData.domains.spotify, this.warpDomains);
  1436. },
  1437. set: function (newValue) {
  1438. if (newValue) {
  1439. this.warpDomains = [...this.warpDomains, ...this.settingsData.domains.spotify];
  1440. } else {
  1441. this.warpDomains = this.warpDomains.filter(data => !this.settingsData.domains.spotify.includes(data));
  1442. }
  1443. },
  1444. },
  1445. },
  1446. });
  1447. </script>
  1448. </body>
  1449. </html>