inbound_info_modal.html 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  1. {{define "modals/inboundInfoModal"}}
  2. <a-modal id="inbound-info-modal" v-model="infoModal.visible" title='{{ i18n "pages.inbounds.details"}}' :closable="true" :mask-closable="true" :footer="null" width="600px" :class="themeSwitcher.currentTheme">
  3. <a-row>
  4. <a-col :xs="24" :md="12">
  5. <table>
  6. <tr>
  7. <td>{{ i18n "protocol" }}</td>
  8. <td>
  9. <a-tag color="purple">[[ dbInbound.protocol ]]</a-tag>
  10. </td>
  11. </tr>
  12. <tr>
  13. <td>{{ i18n "pages.inbounds.address" }}</td>
  14. <td>
  15. <a-tooltip :title="[[ dbInbound.address ]]">
  16. <a-tag class="info-large-tag">[[ dbInbound.address ]]</a-tag>
  17. </a-tooltip>
  18. </td>
  19. </tr>
  20. <tr>
  21. <td>{{ i18n "pages.inbounds.port" }}</td>
  22. <td>
  23. <a-tag>[[ dbInbound.port ]]</a-tag>
  24. </td>
  25. </tr>
  26. </table>
  27. </a-col>
  28. <a-col :xs="24" :md="12">
  29. <template v-if="dbInbound.isVMess || dbInbound.isVLess || dbInbound.isTrojan || dbInbound.isSS">
  30. <table>
  31. <tr>
  32. <td>{{ i18n "transmission" }}</td>
  33. <td>
  34. <a-tag color="green">[[ inbound.network ]]</a-tag>
  35. </td>
  36. </tr>
  37. <template v-if="inbound.isTcp || inbound.isWs || inbound.isHttpupgrade || inbound.isXHTTP">
  38. <tr>
  39. <td>{{ i18n "host" }}</td>
  40. <td v-if="inbound.host">
  41. <a-tooltip :title="[[ inbound.host ]]">
  42. <a-tag class="info-large-tag">[[ inbound.host ]]</a-tag>
  43. </a-tooltip>
  44. </td>
  45. <td v-else>
  46. <a-tag color="orange">{{ i18n "none" }}</a-tag>
  47. </td>
  48. </tr>
  49. </tr>
  50. <tr>
  51. <td>{{ i18n "path" }}</td>
  52. <td v-if="inbound.path">
  53. <a-tooltip :title="[[ inbound.path ]]">
  54. <a-tag class="info-large-tag">[[ inbound.path ]]</a-tag>
  55. </a-tooltip>
  56. <td v-else>
  57. <a-tag color="orange">{{ i18n "none" }}</a-tag>
  58. </td>
  59. </tr>
  60. </template>
  61. <template v-if="inbound.isXHTTP">
  62. <tr>
  63. <td>Mode</td>
  64. <td>
  65. <a-tag>[[ inbound.stream.xhttp.mode ]]</a-tag>
  66. </td>
  67. </tr>
  68. </template>
  69. <template v-if="inbound.isKcp">
  70. <tr>
  71. <td>kcp {{ i18n "encryption" }}</td>
  72. <td>
  73. <a-tag>[[ inbound.kcpType ]]</a-tag>
  74. </td>
  75. </tr>
  76. <tr>
  77. <td>kcp {{ i18n "password" }}</td>
  78. <td>
  79. <a-tag>[[ inbound.kcpSeed ]]</a-tag>
  80. </td>
  81. </tr>
  82. </template>
  83. <template v-if="inbound.isGrpc">
  84. <tr>
  85. <td>grpc serviceName</td>
  86. <td>
  87. <a-tooltip :title="[[ inbound.serviceName ]]">
  88. <a-tag class="info-large-tag">[[ inbound.serviceName ]]</a-tag>
  89. </a-tooltip>
  90. <tr>
  91. <td>grpc multiMode</td>
  92. <td>
  93. <a-tag>[[ inbound.stream.grpc.multiMode ]]</a-tag>
  94. </td>
  95. </tr>
  96. </template>
  97. </table>
  98. </template>
  99. </a-col>
  100. <template v-if="dbInbound.hasLink()">
  101. {{ i18n "security" }}
  102. <a-tag :color="inbound.stream.security == 'none' ? 'red' : 'green'">[[ inbound.stream.security ]]</a-tag>
  103. <br />
  104. <td>Authentication</td>
  105. <a-tag v-if="inbound.settings.selectedAuth" color="green">[[ inbound.settings.selectedAuth ? inbound.settings.selectedAuth : '' ]]</a-tag>
  106. <a-tag v-else color="red">{{ i18n "none" }}</a-tag>
  107. <br />
  108. {{ i18n "encryption" }}
  109. <a-tag class="info-large-tag" :color="inbound.settings.encryption ? 'green' : 'red'">[[ inbound.settings.encryption ? inbound.settings.encryption : '' ]]</a-tag>
  110. <a-tooltip title='{{ i18n "copy" }}'>
  111. <a-button size="small" icon="snippets" @click="copy(inbound.settings.encryption)"></a-button>
  112. </a-tooltip>
  113. <br />
  114. <template v-if="inbound.stream.security != 'none'">
  115. {{ i18n "domainName" }}
  116. <a-tag v-if="inbound.serverName" color="green">[[ inbound.serverName ? inbound.serverName : '' ]]</a-tag>
  117. <a-tag v-else color="orange">{{ i18n "none" }}</a-tag>
  118. </template>
  119. </template>
  120. <table v-if="dbInbound.isSS" :style="{ marginBottom: '10px', width: '100%' }">
  121. <tr>
  122. <td>{{ i18n "encryption" }}</td>
  123. <td>
  124. <a-tag color="green">[[ inbound.settings.method ]]</a-tag>
  125. </td>
  126. </tr>
  127. <tr v-if="inbound.isSS2022">
  128. <td>{{ i18n "password" }}</td>
  129. <td>
  130. <a-tooltip :title="[[ inbound.settings.password ]]">
  131. <a-tag class="info-large-tag">[[ inbound.settings.password ]]</a-tag>
  132. </a-tooltip>
  133. </td>
  134. </tr>
  135. <tr>
  136. <td>{{ i18n "pages.inbounds.network" }}</td>
  137. <td>
  138. <a-tag color="green">[[ inbound.settings.network ]]</a-tag>
  139. </td>
  140. </tr>
  141. </table>
  142. <template v-if="infoModal.clientSettings">
  143. <a-divider>{{ i18n "pages.inbounds.client" }}</a-divider>
  144. <table :style="{ marginBottom: '10px' }">
  145. <tr>
  146. <td>{{ i18n "pages.inbounds.email" }}</td>
  147. <td v-if="infoModal.clientSettings.email">
  148. <a-tag color="green">[[ infoModal.clientSettings.email ]]</a-tag>
  149. </td>
  150. <td v-else>
  151. <a-tag color="red">{{ i18n "none" }}</a-tag>
  152. </td>
  153. </tr>
  154. <tr v-if="infoModal.clientSettings.id">
  155. <td>ID</td>
  156. <td>
  157. <a-tag>[[ infoModal.clientSettings.id ]]</a-tag>
  158. </td>
  159. </tr>
  160. <tr v-if="dbInbound.isVMess">
  161. <td>{{ i18n "security" }}</td>
  162. <td>
  163. <a-tag>[[ infoModal.clientSettings.security ]]</a-tag>
  164. </td>
  165. </tr>
  166. <tr v-if="infoModal.inbound.canEnableTlsFlow()">
  167. <td>Flow</td>
  168. <td v-if="infoModal.clientSettings.flow">
  169. <a-tag>[[ infoModal.clientSettings.flow ]]</a-tag>
  170. </td>
  171. <td v-else>
  172. <a-tag color="orange">{{ i18n "none" }}</a-tag>
  173. </td>
  174. </tr>
  175. <tr v-if="infoModal.clientSettings.password">
  176. <td>{{ i18n "password" }}</td>
  177. <td>
  178. <a-tooltip :title="[[ infoModal.clientSettings.password ]]">
  179. <a-tag class="info-large-tag">[[ infoModal.clientSettings.password ]]</a-tag>
  180. </a-tooltip>
  181. </td>
  182. </tr>
  183. <tr>
  184. <td>{{ i18n "status" }}</td>
  185. <td>
  186. <a-tag v-if="isDepleted" color="red">{{ i18n "depleted" }}</a-tag>
  187. <a-tag v-else-if="isEnable" color="green">{{ i18n "enabled" }}</a-tag>
  188. <a-tag v-else>{{ i18n "disabled" }}</a-tag>
  189. </td>
  190. </tr>
  191. <tr v-if="infoModal.clientStats">
  192. <td>{{ i18n "usage" }}</td>
  193. <td>
  194. <a-tag color="green">[[ SizeFormatter.sizeFormat(infoModal.clientStats.up + infoModal.clientStats.down) ]]</a-tag>
  195. <a-tag>↑ [[ SizeFormatter.sizeFormat(infoModal.clientStats.up) ]] / [[ SizeFormatter.sizeFormat(infoModal.clientStats.down) ]] ↓</a-tag>
  196. </td>
  197. </tr>
  198. <tr>
  199. <td>{{ i18n "pages.inbounds.createdAt" }}</td>
  200. <td>
  201. <template v-if="infoModal.clientSettings && infoModal.clientSettings.created_at">
  202. <template v-if="app.datepicker === 'gregorian'">
  203. <a-tag>[[ DateUtil.formatMillis(infoModal.clientSettings.created_at) ]]</a-tag>
  204. </template>
  205. <template v-else>
  206. <a-tag>[[ DateUtil.convertToJalalian(moment(infoModal.clientSettings.created_at)) ]]</a-tag>
  207. </template>
  208. </template>
  209. <template v-else>
  210. <a-tag>-</a-tag>
  211. </template>
  212. </td>
  213. </tr>
  214. <tr>
  215. <td>{{ i18n "pages.inbounds.updatedAt" }}</td>
  216. <td>
  217. <template v-if="infoModal.clientSettings && infoModal.clientSettings.updated_at">
  218. <template v-if="app.datepicker === 'gregorian'">
  219. <a-tag>[[ DateUtil.formatMillis(infoModal.clientSettings.updated_at) ]]</a-tag>
  220. </template>
  221. <template v-else>
  222. <a-tag>[[ DateUtil.convertToJalalian(moment(infoModal.clientSettings.updated_at)) ]]</a-tag>
  223. </template>
  224. </template>
  225. <template v-else>
  226. <a-tag>-</a-tag>
  227. </template>
  228. </td>
  229. </tr>
  230. <tr>
  231. <td>{{ i18n "lastOnline" }}</td>
  232. <td>
  233. <a-tag>[[ app.formatLastOnline(infoModal.clientSettings && infoModal.clientSettings.email ? infoModal.clientSettings.email : '') ]]</a-tag>
  234. </td>
  235. </tr>
  236. <tr v-if="infoModal.clientSettings.comment">
  237. <td>{{ i18n "comment" }}</td>
  238. <td>
  239. <a-tooltip :title="[[ infoModal.clientSettings.comment ]]">
  240. <a-tag class="info-large-tag">[[ infoModal.clientSettings.comment ]]</a-tag>
  241. </a-tooltip>
  242. </td>
  243. </tr>
  244. <tr v-if="app.ipLimitEnable">
  245. <td>{{ i18n "pages.inbounds.IPLimit" }}</td>
  246. <td>
  247. <a-tag>[[ infoModal.clientSettings.limitIp ]]</a-tag>
  248. </td>
  249. </tr>
  250. <tr v-if="app.ipLimitEnable && infoModal.clientSettings.limitIp > 0">
  251. <td>{{ i18n "pages.inbounds.IPLimitlog" }}</td>
  252. <td>
  253. <a-tag>[[ infoModal.clientIps ]]</a-tag>
  254. <a-icon type="sync" :spin="refreshing" @click="refreshIPs" :style="{ margin: '0 5px' }"></a-icon>
  255. <a-tooltip :title="[[ dbInbound.address ]]">
  256. <template slot="title">
  257. <span>{{ i18n "pages.inbounds.IPLimitlogclear" }}</span>
  258. </template>
  259. <a-icon type="delete" @click="clearClientIps"></a-icon>
  260. </a-tooltip>
  261. </td>
  262. </tr>
  263. </table>
  264. <table :style="{ display: 'inline-table', marginBlock: '10px', width: '100%', textAlign: 'center' }">
  265. <tr>
  266. <th>{{ i18n "remained" }}</th>
  267. <th>{{ i18n "pages.inbounds.totalFlow" }}</th>
  268. <th>{{ i18n "pages.inbounds.expireDate" }}</th>
  269. </tr>
  270. <tr>
  271. <td>
  272. <a-tag v-if="infoModal.clientStats && infoModal.clientSettings.totalGB > 0" :color="statsColor(infoModal.clientStats)"> [[ getRemStats() ]] </a-tag>
  273. </td>
  274. <td>
  275. <a-tag v-if="infoModal.clientSettings.totalGB > 0" :color="statsColor(infoModal.clientStats)"> [[ SizeFormatter.sizeFormat(infoModal.clientSettings.totalGB) ]] </a-tag>
  276. <a-tag v-else color="purple" class="infinite-tag">
  277. <svg height="10px" width="14px" viewBox="0 0 640 512" fill="currentColor">
  278. <path d="M484.4 96C407 96 349.2 164.1 320 208.5C290.8 164.1 233 96 155.6 96C69.75 96 0 167.8 0 256s69.75 160 155.6 160C233.1 416 290.8 347.9 320 303.5C349.2 347.9 407 416 484.4 416C570.3 416 640 344.2 640 256S570.3 96 484.4 96zM155.6 368C96.25 368 48 317.8 48 256s48.25-112 107.6-112c67.75 0 120.5 82.25 137.1 112C276 285.8 223.4 368 155.6 368zM484.4 368c-67.75 0-120.5-82.25-137.1-112C364 226.2 416.6 144 484.4 144C543.8 144 592 194.2 592 256S543.8 368 484.4 368z" fill="currentColor"></path>
  279. </svg>
  280. </a-tag>
  281. </td>
  282. <td>
  283. <template v-if="infoModal.clientSettings.expiryTime > 0">
  284. <a-tag :color="ColorUtils.usageColor(new Date().getTime(), app.expireDiff, infoModal.clientSettings.expiryTime)">
  285. <template v-if="app.datepicker === 'gregorian'">
  286. [[ DateUtil.formatMillis(infoModal.clientSettings.expiryTime) ]]
  287. </template>
  288. <template v-else>
  289. [[ DateUtil.convertToJalalian(moment(infoModal.clientSettings.expiryTime)) ]]
  290. </template>
  291. </a-tag>
  292. </template>
  293. <a-tag v-else-if="infoModal.clientSettings.expiryTime < 0" color="green">[[ infoModal.clientSettings.expiryTime / -86400000 ]] {{ i18n "pages.client.days" }}
  294. </a-tag>
  295. <a-tag v-else color="purple" class="infinite-tag">
  296. <svg height="10px" width="14px" viewBox="0 0 640 512" fill="currentColor">
  297. <path d="M484.4 96C407 96 349.2 164.1 320 208.5C290.8 164.1 233 96 155.6 96C69.75 96 0 167.8 0 256s69.75 160 155.6 160C233.1 416 290.8 347.9 320 303.5C349.2 347.9 407 416 484.4 416C570.3 416 640 344.2 640 256S570.3 96 484.4 96zM155.6 368C96.25 368 48 317.8 48 256s48.25-112 107.6-112c67.75 0 120.5 82.25 137.1 112C276 285.8 223.4 368 155.6 368zM484.4 368c-67.75 0-120.5-82.25-137.1-112C364 226.2 416.6 144 484.4 144C543.8 144 592 194.2 592 256S543.8 368 484.4 368z" fill="currentColor"></path>
  298. </svg>
  299. </a-tag>
  300. </td>
  301. </tr>
  302. </table>
  303. <template v-if="app.subSettings.enable && infoModal.clientSettings.subId">
  304. <a-divider>Subscription URL</a-divider>
  305. <tr-info-row class="tr-info-row">
  306. <tr-info-title class="tr-info-title">
  307. <a-tag color="purple">Subscription Link</a-tag>
  308. <a-tooltip title='{{ i18n "copy" }}'>
  309. <a-button size="small" icon="snippets" @click="copy(infoModal.subLink)"></a-button>
  310. </a-tooltip>
  311. </tr-info-title>
  312. <a :href="[[ infoModal.subLink ]]" target="_blank">[[ infoModal.subLink ]]</a>
  313. </tr-info-row>
  314. <tr-info-row class="tr-info-row" v-if="app.subSettings.subJsonEnable">
  315. <tr-info-title class="tr-info-title">
  316. <a-tag color="purple">Json Link</a-tag>
  317. <a-tooltip title='{{ i18n "copy" }}'>
  318. <a-button size="small" icon="snippets" @click="copy(infoModal.subJsonLink)"></a-button>
  319. </a-tooltip>
  320. </tr-info-title>
  321. <a :href="[[ infoModal.subJsonLink ]]" target="_blank">[[ infoModal.subJsonLink ]]</a>
  322. </tr-info-row>
  323. </template>
  324. <template v-if="app.tgBotEnable && infoModal.clientSettings.tgId">
  325. <a-divider>Telegram ChatID</a-divider>
  326. <tr-info-row class="tr-info-row">
  327. <tr-info-title class="tr-info-title">
  328. <a-tag color="blue">[[ infoModal.clientSettings.tgId ]]</a-tag>
  329. <a-tooltip title='{{ i18n "copy" }}'>
  330. <a-button size="small" icon="snippets" @click="copy(infoModal.clientSettings.tgId)"></a-button>
  331. </a-tooltip>
  332. </tr-info-title>
  333. </tr-info-row>
  334. </template>
  335. <template v-if="dbInbound.hasLink()">
  336. <a-divider>URL</a-divider>
  337. <tr-info-row v-for="(link,index) in infoModal.links" class="tr-info-row">
  338. <tr-info-title class="tr-info-title">
  339. <a-tag class="tr-info-tag" color="green">[[ link.remark ]]</a-tag>
  340. <a-tooltip title='{{ i18n "copy" }}'>
  341. <a-button :style="{ minWidth: '24px' }" size="small" icon="snippets" @click="copy(link.link)"></a-button>
  342. </a-tooltip>
  343. </tr-info-title>
  344. <code>[[ link.link ]]</code>
  345. </tr-info-row>
  346. </template>
  347. </template>
  348. <template v-else>
  349. <template v-if="dbInbound.isSS && !inbound.isSSMultiUser">
  350. <a-divider>URL</a-divider>
  351. <tr-info-row v-for="(link,index) in infoModal.links" class="tr-info-row">
  352. <tr-info-title class="tr-info-title">
  353. <a-tag class="tr-info-tag" color="green">[[ link.remark ]]</a-tag>
  354. <a-tooltip title='{{ i18n "copy" }}'>
  355. <a-button :style="{ minWidth: '24px' }" size="small" icon="snippets" @click="copy(link.link)"></a-button>
  356. </a-tooltip>
  357. </tr-info-title>
  358. <code>[[ link.link ]]</code>
  359. </tr-info-row>
  360. </template>
  361. <table v-if="inbound.protocol == Protocols.TUNNEL" class="tr-info-table">
  362. <tr>
  363. <th>{{ i18n "pages.inbounds.targetAddress" }}</th>
  364. <th>{{ i18n "pages.inbounds.destinationPort" }}</th>
  365. <th>{{ i18n "pages.inbounds.network" }}</th>
  366. <th>FollowRedirect</th>
  367. </tr>
  368. <tr>
  369. <td>
  370. <a-tag color="green">[[ inbound.settings.address ]]</a-tag>
  371. </td>
  372. <td>
  373. <a-tag color="green">[[ inbound.settings.port ]]</a-tag>
  374. </td>
  375. <td>
  376. <a-tag color="green">[[ inbound.settings.network ]]</a-tag>
  377. </td>
  378. <td>
  379. <a-tag color="green">[[ inbound.settings.followRedirect ]]</a-tag>
  380. </td>
  381. </tr>
  382. </table>
  383. <table v-if="dbInbound.isMixed" class="tr-info-table">
  384. <tr>
  385. <th>{{ i18n "password" }} Auth</th>
  386. <th>{{ i18n "pages.inbounds.enable" }} udp</th>
  387. <th>IP</th>
  388. </tr>
  389. <tr>
  390. <td>
  391. <a-tag color="green">[[ inbound.settings.auth ]]</a-tag>
  392. </td>
  393. <td>
  394. <a-tag color="green">[[ inbound.settings.udp]]</a-tag>
  395. </td>
  396. <td>
  397. <a-tag color="green">[[ inbound.settings.ip ]]</a-tag>
  398. </td>
  399. </tr>
  400. <template v-if="inbound.settings.auth == 'password'">
  401. <tr>
  402. <td></td>
  403. <td>{{ i18n "username" }}</td>
  404. <td>{{ i18n "password" }}</td>
  405. </tr>
  406. <tr v-for="account,index in inbound.settings.accounts">
  407. <td>[[ index ]]</td>
  408. <td>
  409. <a-tag color="green">[[ account.user ]]</a-tag>
  410. </td>
  411. <td>
  412. <a-tag color="green">[[ account.pass ]]</a-tag>
  413. </td>
  414. </tr>
  415. </template>
  416. </table>
  417. <table v-if="dbInbound.isHTTP" class="tr-info-table">
  418. <tr>
  419. <th></th>
  420. <th>{{ i18n "username" }}</th>
  421. <th>{{ i18n "password" }}</th>
  422. </tr>
  423. <tr v-for="account,index in inbound.settings.accounts">
  424. <td>[[ index ]]</td>
  425. <td>
  426. <a-tag color="green">[[ account.user ]]</a-tag>
  427. </td>
  428. <td>
  429. <a-tag color="green">[[ account.pass ]]</a-tag>
  430. </td>
  431. </tr>
  432. </table>
  433. <table v-if="dbInbound.isWireguard" class="tr-info-table">
  434. <tr class="client-table-odd-row">
  435. <td>{{ i18n "pages.xray.wireguard.secretKey" }}</td>
  436. <td>[[ inbound.settings.secretKey ]]</td>
  437. </tr>
  438. <tr>
  439. <td>{{ i18n "pages.xray.wireguard.publicKey" }}</td>
  440. <td>[[ inbound.settings.pubKey ]]</td>
  441. </tr>
  442. <tr class="client-table-odd-row">
  443. <td>MTU</td>
  444. <td>[[ inbound.settings.mtu ]]</td>
  445. </tr>
  446. <tr>
  447. <td>No Kernel Tun</td>
  448. <td>[[ inbound.settings.noKernelTun ]]</td>
  449. </tr>
  450. <template v-for="(peer, index) in inbound.settings.peers">
  451. <tr>
  452. <td colspan="2">
  453. <a-divider>Peer [[ index + 1 ]]</a-divider>
  454. </td>
  455. </tr>
  456. <tr class="client-table-odd-row">
  457. <td>{{ i18n "pages.xray.wireguard.secretKey" }}</td>
  458. <td>[[ peer.privateKey ]]</td>
  459. </tr>
  460. <tr>
  461. <td>{{ i18n "pages.xray.wireguard.publicKey" }}</td>
  462. <td>[[ peer.publicKey ]]</td>
  463. </tr>
  464. <tr class="client-table-odd-row">
  465. <td>{{ i18n "pages.xray.wireguard.psk" }}</td>
  466. <td>[[ peer.psk ]]</td>
  467. </tr>
  468. <tr>
  469. <td>{{ i18n "pages.xray.wireguard.allowedIPs" }}</td>
  470. <td>[[ peer.allowedIPs.join(",") ]]</td>
  471. </tr>
  472. <tr class="client-table-odd-row">
  473. <td>Keep Alive</td>
  474. <td>[[ peer.keepAlive ]]</td>
  475. </tr>
  476. <tr>
  477. <td colspan="2">
  478. <tr-info-row class="tr-info-row">
  479. <tr-info-title class="tr-info-title">
  480. <a-tag color="blue">Config</a-tag>
  481. <a-tooltip title='{{ i18n "copy" }}'>
  482. <a-button :style="{ minWidth: '24px' }" size="small" icon="snippets" @click="copy(infoModal.links[index])"></a-button>
  483. </a-tooltip>
  484. <a-tooltip title='{{ i18n "download" }}'>
  485. <a-button :style="{ minWidth: '24px' }" size="small" icon="download" @click="FileManager.downloadTextFile(infoModal.links[index], `peer-${index + 1}.conf`)"></a-button>
  486. </a-tooltip>
  487. </tr-info-title>
  488. <div v-html="infoModal.links[index].replaceAll(`\n`,`<br />`)" :style="{ borderRadius: '1rem', padding: '0.5rem' }" class="client-table-odd-row">
  489. </div>
  490. </tr-info-row>
  491. </td>
  492. </tr>
  493. </table>
  494. </template>
  495. </template>
  496. </a-modal>
  497. <script>
  498. function refreshIPs(email) {
  499. return HttpUtil.post(`/panel/api/inbounds/clientIps/${email}`).then((msg) => {
  500. if (msg.success) {
  501. try {
  502. return JSON.parse(msg.obj).join(', ');
  503. } catch (e) {
  504. return msg.obj;
  505. }
  506. }
  507. });
  508. }
  509. const infoModal = {
  510. visible: false,
  511. inbound: new Inbound(),
  512. dbInbound: new DBInbound(),
  513. clientSettings: null,
  514. clientStats: [],
  515. upStats: 0,
  516. downStats: 0,
  517. links: [],
  518. index: null,
  519. isExpired: false,
  520. subLink: '',
  521. subJsonLink: '',
  522. clientIps: '',
  523. show(dbInbound, index) {
  524. this.index = index;
  525. this.inbound = dbInbound.toInbound();
  526. this.dbInbound = new DBInbound(dbInbound);
  527. this.clientSettings = this.inbound.clients ? this.inbound.clients[index] : null;
  528. this.isExpired = this.inbound.clients ? this.inbound.isExpiry(index) : this.dbInbound.isExpiry;
  529. this.clientStats = this.inbound.clients ? (this.dbInbound.clientStats.find(row => row.email === this.clientSettings.email) || null) : null;
  530. if (
  531. [
  532. Protocols.VMESS,
  533. Protocols.VLESS,
  534. Protocols.TROJAN,
  535. Protocols.SHADOWSOCKS
  536. ].includes(this.inbound.protocol)
  537. ) {
  538. if (app.ipLimitEnable && this.clientSettings.limitIp) {
  539. refreshIPs(this.clientStats.email).then((ips) => {
  540. this.clientIps = ips;
  541. })
  542. }
  543. }
  544. if (this.inbound.protocol == Protocols.WIREGUARD) {
  545. this.links = this.inbound.genInboundLinks(dbInbound.remark).split('\r\n')
  546. } else {
  547. this.links = this.inbound.genAllLinks(this.dbInbound.remark, app.remarkModel, this.clientSettings);
  548. }
  549. if (this.clientSettings) {
  550. if (this.clientSettings.subId) {
  551. this.subLink = this.genSubLink(this.clientSettings.subId);
  552. this.subJsonLink = app.subSettings.subJsonEnable ? this.genSubJsonLink(this.clientSettings.subId) : '';
  553. }
  554. }
  555. this.visible = true;
  556. },
  557. close() {
  558. infoModal.visible = false;
  559. },
  560. genSubLink(subID) {
  561. return app.subSettings.subURI + subID;
  562. },
  563. genSubJsonLink(subID) {
  564. return app.subSettings.subJsonURI + subID;
  565. }
  566. };
  567. const infoModalApp = new Vue({
  568. delimiters: ['[[', ']]'],
  569. el: '#inbound-info-modal',
  570. data: {
  571. infoModal,
  572. refreshing: false,
  573. get dbInbound() {
  574. return this.infoModal.dbInbound;
  575. },
  576. get inbound() {
  577. return this.infoModal.inbound;
  578. },
  579. get isActive() {
  580. if (infoModal.clientStats) {
  581. return infoModal.clientStats.enable;
  582. }
  583. return true;
  584. },
  585. get isEnable() {
  586. if (infoModal.clientSettings) {
  587. return infoModal.clientSettings.enable;
  588. }
  589. return infoModal.dbInbound.isEnable;
  590. },
  591. get isDepleted() {
  592. const stats = infoModal.clientStats;
  593. const settings = infoModal.clientSettings;
  594. if (!stats || !settings) {
  595. return false;
  596. }
  597. const total = stats.total ?? 0;
  598. const used = (stats.up ?? 0) + (stats.down ?? 0);
  599. const hasTotal = total > 0;
  600. const exhausted = hasTotal && used >= total;
  601. const expiryTime = settings.expiryTime ?? 0;
  602. const hasExpiry = expiryTime > 0;
  603. const now = Date.now();
  604. const expired = hasExpiry && now >= expiryTime;
  605. return expired || exhausted;
  606. },
  607. },
  608. methods: {
  609. copy(content) {
  610. ClipboardManager
  611. .copyText(content)
  612. .then(() => {
  613. app.$message.success('{{ i18n "copied" }}')
  614. })
  615. },
  616. statsColor(stats) {
  617. return ColorUtils.usageColor(stats.up + stats.down, app.trafficDiff, stats.total);
  618. },
  619. getRemStats() {
  620. remained = this.infoModal.clientStats.total - this.infoModal.clientStats.up - this.infoModal.clientStats.down;
  621. return remained > 0 ? SizeFormatter.sizeFormat(remained) : '-';
  622. },
  623. refreshIPs() {
  624. this.refreshing = true;
  625. refreshIPs(this.infoModal.clientStats.email)
  626. .then((ips) => {
  627. this.infoModal.clientIps = ips;
  628. })
  629. .finally(() => {
  630. this.refreshing = false;
  631. });
  632. },
  633. clearClientIps() {
  634. HttpUtil.post(`/panel/api/inbounds/clearClientIps/${this.infoModal.clientStats.email}`)
  635. .then((msg) => {
  636. if (!msg.success) {
  637. return;
  638. }
  639. this.infoModal.clientIps = 'No IP Record';
  640. })
  641. .catch(() => {});
  642. },
  643. },
  644. });
  645. </script>
  646. {{end}}