1
0

outbounds.html 6.2 KB

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