inbound_info_modal.html 24 KB

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