outbounds.html 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. {{define "settings/xray/outbounds"}}
  2. <a-space direction="vertical" size="middle">
  3. <a-row>
  4. <a-col :xs="12" :sm="12" :lg="12">
  5. <a-space direction="horizontal" size="small">
  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"
  11. @click="showWarp()">WARP</a-button>
  12. <a-button type="primary" icon="api"
  13. @click="showNord()">NordVPN</a-button>
  14. </a-space>
  15. </a-col>
  16. <a-col :xs="12" :sm="12" :lg="12" :style="{ textAlign: 'right' }">
  17. <a-button-group>
  18. <a-button icon="sync" @click="refreshOutboundTraffic()"
  19. :loading="refreshing"></a-button>
  20. <a-popconfirm placement="topRight"
  21. @confirm="resetOutboundTraffic(-1)"
  22. title='{{ i18n "pages.inbounds.resetTrafficContent"}}'
  23. :overlay-class-name="themeSwitcher.currentTheme"
  24. ok-text='{{ i18n "reset"}}'
  25. cancel-text='{{ i18n "cancel"}}'>
  26. <a-icon slot="icon" type="question-circle-o"
  27. :style="{ color: themeSwitcher.isDarkTheme ? '#008771' : '#008771' }"></a-icon>
  28. <a-button icon="retweet"></a-button>
  29. </a-popconfirm>
  30. </a-button-group>
  31. </a-col>
  32. </a-row>
  33. <a-table :columns="outboundColumns" bordered :row-key="r => r.key"
  34. :data-source="outboundData"
  35. :scroll="isMobile ? {} : { x: 800 }" :pagination="false"
  36. :indent-size="0"
  37. :locale='{ filterConfirm: `{{ i18n "confirm" }}`, filterReset: `{{ i18n "reset" }}` }'>
  38. <template slot="action" slot-scope="text, outbound, index">
  39. <span>[[ index+1 ]]</span>
  40. <a-dropdown :trigger="['click']">
  41. <a-icon @click="e => e.preventDefault()" type="more"
  42. :style="{ fontSize: '16px', textDecoration: 'bold' }"></a-icon>
  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. <span>
  55. <a-icon type="retweet"></a-icon>
  56. <span>{{ i18n "pages.inbounds.resetTraffic"}}</span>
  57. </span>
  58. </a-menu-item>
  59. <a-menu-item @click="deleteOutbound(index)">
  60. <span :style="{ color: '#FF4D4F' }">
  61. <a-icon type="delete"></a-icon>
  62. <span>{{ i18n "delete"}}</span>
  63. </span>
  64. </a-menu-item>
  65. </a-menu>
  66. </a-dropdown>
  67. </template>
  68. <template slot="address" slot-scope="text, outbound, index">
  69. <p :style="{ margin: '0 5px' }"
  70. v-for="addr in findOutboundAddress(outbound)">[[ addr ]]</p>
  71. </template>
  72. <template slot="protocol" slot-scope="text, outbound, index">
  73. <a-tag :style="{ margin: '0' }" color="purple">[[ outbound.protocol
  74. ]]</a-tag>
  75. <template
  76. v-if="[Protocols.VMess, Protocols.VLESS, Protocols.Trojan, Protocols.Shadowsocks].includes(outbound.protocol)">
  77. <a-tag :style="{ margin: '0' }" color="blue">[[
  78. outbound.streamSettings.network ]]</a-tag>
  79. <a-tag :style="{ margin: '0' }"
  80. v-if="outbound.streamSettings.security=='tls'"
  81. color="green">tls</a-tag>
  82. <a-tag :style="{ margin: '0' }"
  83. v-if="outbound.streamSettings.security=='reality'"
  84. color="green">reality</a-tag>
  85. </template>
  86. </template>
  87. <template slot="traffic" slot-scope="text, outbound, index">
  88. <a-tag color="green">[[ findOutboundTraffic(outbound) ]]</a-tag>
  89. </template>
  90. <template slot="test" slot-scope="text, outbound, index">
  91. <a-tooltip>
  92. <template slot="title">{{ i18n "pages.xray.outbound.test"
  93. }}</template>
  94. <a-button
  95. type="primary"
  96. shape="circle"
  97. icon="thunderbolt"
  98. :loading="outboundTestStates[index] && outboundTestStates[index].testing"
  99. @click="testOutbound(index)"
  100. :disabled="(outbound.protocol === 'blackhole' || outbound.tag === 'blocked') || (outboundTestStates[index] && outboundTestStates[index].testing)">
  101. </a-button>
  102. </a-tooltip>
  103. </template>
  104. <template slot="testResult" slot-scope="text, outbound, index">
  105. <div
  106. v-if="outboundTestStates[index] && outboundTestStates[index].result">
  107. <a-tag v-if="outboundTestStates[index].result.success"
  108. color="green">
  109. [[ outboundTestStates[index].result.delay ]]ms
  110. <span v-if="outboundTestStates[index].result.statusCode">
  111. ([[ outboundTestStates[index].result.statusCode
  112. ]])</span>
  113. </a-tag>
  114. <a-tooltip v-else
  115. :title="outboundTestStates[index].result.error">
  116. <a-tag color="red">
  117. Failed
  118. </a-tag>
  119. </a-tooltip>
  120. </div>
  121. <span
  122. v-else-if="outboundTestStates[index] && outboundTestStates[index].testing">
  123. <a-icon type="loading" />
  124. </span>
  125. <span v-else>-</span>
  126. </template>
  127. </a-table>
  128. </a-space>
  129. {{end}}