inbound_info_modal.html 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. {{define "inboundInfoModal"}}
  2. <a-modal id="inbound-info-modal" v-model="infoModal.visible" title='{{ i18n "pages.inbounds.details"}}'
  3. :closable="true"
  4. :mask-closable="true"
  5. :footer="null"
  6. >
  7. <table style="margin-bottom: 10px; width: 100%;">
  8. <tr><td>
  9. <table>
  10. <tr><td>{{ i18n "protocol" }}</td><td><a-tag color="green">[[ dbInbound.protocol ]]</a-tag></td></tr>
  11. <tr><td>{{ i18n "pages.inbounds.address" }}</td><td><a-tag color="blue">[[ dbInbound.address ]]</a-tag></td></tr>
  12. <tr><td>{{ i18n "pages.inbounds.port" }}</td><td><a-tag color="green">[[ dbInbound.port ]]</a-tag></td></tr>
  13. </table>
  14. </td>
  15. <td v-if="dbInbound.isVMess || dbInbound.isVLess || dbInbound.isTrojan || dbInbound.isSS">
  16. <table>
  17. <tr>
  18. <td>{{ i18n "transmission" }}</td><td><a-tag color="green">[[ inbound.network ]]</a-tag></td>
  19. </tr>
  20. <template v-if="inbound.isTcp || inbound.isWs || inbound.isH2">
  21. <tr v-if="inbound.host"><td>{{ i18n "host" }}</td><td><a-tag color="green">[[ inbound.host ]]</a-tag></td></tr>
  22. <tr v-else><td>{{ i18n "host" }}</td><td><a-tag color="orange">{{ i18n "none" }}</a-tag></td></tr>
  23. <tr v-if="inbound.path"><td>{{ i18n "path" }}</td><td><a-tag color="green">[[ inbound.path ]]</a-tag></td></tr>
  24. <tr v-else><td>{{ i18n "path" }}</td><td><a-tag color="orange">{{ i18n "none" }}</a-tag></td></tr>
  25. </template>
  26. <template v-if="inbound.isQuic">
  27. <tr><td>quic {{ i18n "encryption" }}</td><td><a-tag color="green">[[ inbound.quicSecurity ]]</a-tag></td></tr>
  28. <tr><td>quic {{ i18n "password" }}</td><td><a-tag color="green">[[ inbound.quicKey ]]</a-tag></td></tr>
  29. <tr><td>quic {{ i18n "camouflage" }}</td><td><a-tag color="green">[[ inbound.quicType ]]</a-tag></td></tr>
  30. </template>
  31. <template v-if="inbound.isKcp">
  32. <tr><td>kcp {{ i18n "encryption" }}</td><td><a-tag color="green">[[ inbound.kcpType ]]</a-tag></td></tr>
  33. <tr><td>kcp {{ i18n "password" }}</td><td><a-tag color="green">[[ inbound.kcpSeed ]]</a-tag></td></tr>
  34. </template>
  35. <template v-if="inbound.isGrpc">
  36. <tr><td>grpc serviceName</td><td><a-tag color="green">[[ inbound.serviceName ]]</a-tag></td></tr>
  37. </template>
  38. </table>
  39. </td></tr>
  40. <tr colspan="2">
  41. <td v-if="inbound.tls">
  42. tls: <a-tag color="green">{{ i18n "enabled" }}</a-tag><br />
  43. tls {{ i18n "domainName" }}: <a-tag :color="inbound.serverName ? 'green' : 'orange'">[[ inbound.serverName ? inbound.serverName : '' ]]</a-tag>
  44. </td>
  45. <td v-else-if="inbound.xtls">
  46. xtls: <a-tag color="green">{{ i18n "enabled" }}</a-tag><br />
  47. xtls {{ i18n "domainName" }}: <a-tag :color="inbound.serverName ? 'green' : 'orange'">[[ inbound.serverName ? inbound.serverName : '' ]]</a-tag>
  48. </td>
  49. <td v-else>tls: <a-tag color="red">{{ i18n "disabled" }}</a-tag>
  50. </td>
  51. </tr>
  52. </table>
  53. <a-divider>{{ i18n "pages.inbounds.client" }}</a-divider>
  54. <template v-if="dbInbound.hasLink()">
  55. <p>Client URL:</p>
  56. <p>[[ infoModal.link ]]</p>
  57. <button class="btn" id="copy-url-link"><a-icon type="snippets"></a-icon>{{ i18n "copy" }}</button>
  58. </template>
  59. </a-modal>
  60. <script>
  61. const infoModal = {
  62. visible: false,
  63. inbound: new Inbound(),
  64. dbInbound: new DBInbound(),
  65. clipboard: null,
  66. link: null,
  67. index: 0,
  68. show(dbInbound, index=0) {
  69. this.index = index;
  70. this.inbound = dbInbound.toInbound();
  71. this.dbInbound = new DBInbound(dbInbound);
  72. this.link = dbInbound.genLink(index);
  73. this.visible = true;
  74. infoModalApp.$nextTick(() => {
  75. if (this.clipboard === null) {
  76. this.clipboard = new ClipboardJS('#copy-url-link', {
  77. text: () => this.link,
  78. });
  79. this.clipboard.on('success', () => app.$message.success('{{ i18n "copySuccess" }}'));
  80. }
  81. });
  82. },
  83. close() {
  84. infoModal.visible = false;
  85. },
  86. };
  87. const infoModalApp = new Vue({
  88. delimiters: ['[[', ']]'],
  89. el: '#inbound-info-modal',
  90. data: {
  91. infoModal,
  92. get dbInbound() {
  93. return this.infoModal.dbInbound;
  94. },
  95. get inbound() {
  96. return this.infoModal.inbound;
  97. }
  98. },
  99. methods: {
  100. setQrCode(elmentId,index) {
  101. content = infoModal.inbound.genLink(infoModal.dbInbound.address,infoModal.dbInbound.remark,index)
  102. new QRious({
  103. element: document.querySelector('#'+elmentId),
  104. size: 260,
  105. value: content,
  106. });
  107. },
  108. copyTextToClipboard(elmentId,content) {
  109. this.infoModal.clipboard = new ClipboardJS('#' + elmentId, {
  110. text: () => content,
  111. });
  112. this.infoModal.clipboard.on('success', () => {
  113. app.$message.success('{{ i18n "copySuccess" }}')
  114. this.infoModal.clipboard.destroy();
  115. });
  116. }
  117. },
  118. });
  119. </script>
  120. {{end}}