inbound_info_modal.html 24 KB

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