outbounds.html 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. {{define "settings/xray/outbounds"}}
  2. <a-space direction="vertical" size="middle" class="outbounds-modern">
  3. <a-row :gutter="[12, 12]" align="middle" justify="space-between">
  4. <a-col :xs="24" :sm="14" :lg="14">
  5. <a-space direction="horizontal" size="small" class="outbounds-toolbar">
  6. <a-button type="primary" icon="plus" @click="addOutbound">
  7. <span v-if="!isMobile">{{ i18n
  8. "pages.xray.outbound.addOutbound" }}</span>
  9. </a-button>
  10. <a-button type="primary" icon="cloud" @click="showWarp()">WARP</a-button>
  11. <a-button type="primary" icon="api" @click="showNord()">NordVPN</a-button>
  12. </a-space>
  13. </a-col>
  14. <a-col :xs="24" :sm="10" :lg="10" class="outbounds-toolbar-right">
  15. <a-button-group>
  16. <a-button icon="sync" @click="refreshOutboundTraffic()" :loading="refreshing"></a-button>
  17. <a-popconfirm placement="topRight" @confirm="resetOutboundTraffic(-1)"
  18. title='{{ i18n "pages.inbounds.resetTrafficContent"}}'
  19. :overlay-class-name="themeSwitcher.currentTheme" ok-text='{{ i18n "reset"}}'
  20. cancel-text='{{ i18n "cancel"}}'>
  21. <a-icon slot="icon" type="question-circle-o"
  22. :style="{ color: '#008771' }"></a-icon>
  23. <a-button icon="retweet"></a-button>
  24. </a-popconfirm>
  25. </a-button-group>
  26. </a-col>
  27. </a-row>
  28. <a-table :columns="outboundColumns" :row-key="r => r.key"
  29. :data-source="outboundData"
  30. :scroll="isMobile ? { x: 720 } : {}"
  31. :pagination="false"
  32. :indent-size="0"
  33. class="outbounds-table"
  34. :locale='{ filterConfirm: `{{ i18n "confirm" }}`, filterReset: `{{ i18n "reset" }}` }'>
  35. <template slot="action" slot-scope="text, outbound, index">
  36. <div class="outbound-action-cell">
  37. <span class="outbound-index">[[ index+1 ]]</span>
  38. <a-dropdown :trigger="['click']">
  39. <a-button shape="circle" size="small" class="outbound-action-btn"
  40. @click="e => e.preventDefault()">
  41. <a-icon type="more"></a-icon>
  42. </a-button>
  43. <a-menu slot="overlay" :theme="themeSwitcher.currentTheme">
  44. <a-menu-item v-if="index>0"
  45. @click="setFirstOutbound(index)">
  46. <a-icon type="vertical-align-top"></a-icon>
  47. <span>{{ i18n "pages.xray.rules.first"}}</span>
  48. </a-menu-item>
  49. <a-menu-item @click="editOutbound(index)">
  50. <a-icon type="edit"></a-icon>
  51. <span>{{ i18n "edit" }}</span>
  52. </a-menu-item>
  53. <a-menu-item @click="resetOutboundTraffic(index)">
  54. <a-icon type="retweet"></a-icon>
  55. <span>{{ i18n "pages.inbounds.resetTraffic"}}</span>
  56. </a-menu-item>
  57. <a-menu-item @click="deleteOutbound(index)">
  58. <span :style="{ color: '#FF4D4F' }">
  59. <a-icon type="delete"></a-icon>
  60. <span>{{ i18n "delete"}}</span>
  61. </span>
  62. </a-menu-item>
  63. </a-menu>
  64. </a-dropdown>
  65. </div>
  66. </template>
  67. <template slot="identity" slot-scope="text, outbound">
  68. <div class="outbound-identity-cell">
  69. <a-tooltip :title="outbound.tag" :overlay-class-name="themeSwitcher.currentTheme">
  70. <span class="outbound-tag">[[ outbound.tag ]]</span>
  71. </a-tooltip>
  72. <div class="outbound-protocol-cell">
  73. <span class="outbound-pill"
  74. :class="outboundProtocolTone(outbound.protocol)">
  75. [[ outbound.protocol ]]
  76. </span>
  77. <template
  78. v-if="[Protocols.VMess, Protocols.VLESS, Protocols.Trojan, Protocols.Shadowsocks].includes(outbound.protocol)">
  79. <span class="outbound-pill"
  80. :class="outboundNetworkTone(outbound.streamSettings.network)">
  81. [[ outbound.streamSettings.network ]]
  82. </span>
  83. <span class="outbound-pill"
  84. :class="outboundSecurityTone(outbound.streamSettings.security)"
  85. v-if="isOutboundSecurityVisible(outbound.streamSettings.security)">
  86. [[ outbound.streamSettings.security ]]
  87. </span>
  88. </template>
  89. </div>
  90. </div>
  91. </template>
  92. <template slot="address" slot-scope="text, outbound">
  93. <div class="outbound-address-list">
  94. <a-tooltip
  95. v-for="addr in outboundAddresses(outbound)"
  96. :key="addr"
  97. :title="addr"
  98. :overlay-class-name="themeSwitcher.currentTheme">
  99. <span class="outbound-address-pill">[[ addr ]]</span>
  100. </a-tooltip>
  101. <span class="outbound-address-empty"
  102. v-if="outboundAddresses(outbound).length === 0">—</span>
  103. </div>
  104. </template>
  105. <template slot="traffic" slot-scope="text, outbound">
  106. <div class="outbound-traffic-cell">
  107. <span class="outbound-traffic-up" :title='`{{ i18n "pages.index.upload" }}`'>
  108. <a-icon type="arrow-up"></a-icon>
  109. [[ SizeFormatter.sizeFormat(findOutboundUp(outbound)) ]]
  110. </span>
  111. <span class="outbound-traffic-sep" aria-hidden="true"></span>
  112. <span class="outbound-traffic-down" :title='`{{ i18n "pages.index.download" }}`'>
  113. <a-icon type="arrow-down"></a-icon>
  114. [[ SizeFormatter.sizeFormat(findOutboundDown(outbound)) ]]
  115. </span>
  116. </div>
  117. </template>
  118. <template slot="test" slot-scope="text, outbound, index">
  119. <a-tooltip>
  120. <template slot="title">{{ i18n "pages.xray.outbound.test" }}</template>
  121. <a-button
  122. type="primary"
  123. shape="circle"
  124. icon="thunderbolt"
  125. class="outbound-test-btn"
  126. :loading="isOutboundTesting(index)"
  127. @click="testOutbound(index)"
  128. :disabled="isOutboundUntestable(outbound) || isOutboundTesting(index)">
  129. </a-button>
  130. </a-tooltip>
  131. </template>
  132. <template slot="testResult" slot-scope="text, outbound, index">
  133. <div class="outbound-result-cell" v-if="outboundTestResult(index)">
  134. <span v-if="outboundTestResult(index).success"
  135. class="outbound-result-pill outbound-result-ok">
  136. <a-icon type="check-circle" theme="filled"></a-icon>
  137. [[ outboundTestResult(index).delay ]]&nbsp;ms
  138. <span class="outbound-result-status"
  139. v-if="outboundTestResult(index).statusCode">
  140. · [[ outboundTestResult(index).statusCode ]]
  141. </span>
  142. </span>
  143. <a-tooltip v-else
  144. :title="outboundTestResult(index).error"
  145. :overlay-class-name="themeSwitcher.currentTheme">
  146. <span class="outbound-result-pill outbound-result-fail">
  147. <a-icon type="close-circle" theme="filled"></a-icon>
  148. {{ i18n "pages.xray.outbound.testFailed" }}
  149. </span>
  150. </a-tooltip>
  151. </div>
  152. <span class="outbound-result-loading" v-else-if="isOutboundTesting(index)">
  153. <a-icon type="loading"></a-icon>
  154. </span>
  155. <span class="outbound-result-idle" v-else>—</span>
  156. </template>
  157. </a-table>
  158. </a-space>
  159. {{end}}