client.html 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. {{define "form/client"}}
  2. <a-form
  3. layout="horizontal"
  4. v-if="client"
  5. :colon="false"
  6. :label-col="{ md: {span:8} }"
  7. :wrapper-col="{ md: {span:14} }"
  8. >
  9. <a-form-item label='{{ i18n "pages.inbounds.enable" }}'>
  10. <a-switch v-model="client.enable"></a-switch>
  11. </a-form-item>
  12. <a-form-item>
  13. <template slot="label">
  14. <a-tooltip>
  15. <template slot="title">
  16. <span>{{ i18n "pages.inbounds.emailDesc" }}</span>
  17. </template>
  18. {{ i18n "pages.inbounds.email" }}
  19. <a-icon
  20. type="sync"
  21. @click="client.email = RandomUtil.randomLowerAndNum(9)"
  22. ></a-icon>
  23. </a-tooltip>
  24. </template>
  25. <a-input v-model.trim="client.email"></a-input>
  26. </a-form-item>
  27. <a-form-item
  28. v-if="inbound.protocol === Protocols.TROJAN || inbound.protocol === Protocols.SHADOWSOCKS"
  29. >
  30. <template slot="label">
  31. <a-tooltip>
  32. <template slot="title">
  33. <span>{{ i18n "reset" }}</span>
  34. </template>
  35. {{ i18n "password" }}
  36. <a-icon
  37. v-if="inbound.protocol === Protocols.SHADOWSOCKS"
  38. @click="client.password = RandomUtil.randomShadowsocksPassword(inbound.settings.method)"
  39. type="sync"
  40. ></a-icon>
  41. <a-icon
  42. v-if="inbound.protocol === Protocols.TROJAN"
  43. @click="client.password = RandomUtil.randomSeq(10)"
  44. type="sync"
  45. >
  46. </a-icon>
  47. </a-tooltip>
  48. </template>
  49. <a-input v-model.trim="client.password"></a-input>
  50. </a-form-item>
  51. <a-form-item v-if="inbound.protocol === Protocols.HYSTERIA">
  52. <template slot="label">
  53. <a-tooltip>
  54. <template slot="title">
  55. <span>{{ i18n "reset" }}</span>
  56. </template>
  57. Auth Password
  58. <a-icon
  59. @click="client.auth = RandomUtil.randomSeq(10)"
  60. type="sync"
  61. ></a-icon>
  62. </a-tooltip>
  63. </template>
  64. <a-input v-model.trim="client.auth"></a-input>
  65. </a-form-item>
  66. <a-form-item
  67. v-if="inbound.protocol === Protocols.VMESS || inbound.protocol === Protocols.VLESS"
  68. >
  69. <template slot="label">
  70. <a-tooltip>
  71. <template slot="title">
  72. <span>{{ i18n "reset" }}</span>
  73. </template>
  74. ID
  75. <a-icon
  76. @click="client.id = RandomUtil.randomUUID()"
  77. type="sync"
  78. ></a-icon>
  79. </a-tooltip>
  80. </template>
  81. <a-input v-model.trim="client.id"></a-input>
  82. </a-form-item>
  83. <a-form-item
  84. v-if="inbound.protocol === Protocols.VMESS"
  85. label='{{ i18n "security" }}'
  86. >
  87. <a-select
  88. v-model="client.security"
  89. :dropdown-class-name="themeSwitcher.currentTheme"
  90. >
  91. <a-select-option v-for="key in USERS_SECURITY" :value="key"
  92. >[[ key ]]</a-select-option
  93. >
  94. </a-select>
  95. </a-form-item>
  96. <a-form-item v-if="client.email && app.subSettings?.enable">
  97. <template slot="label">
  98. <a-tooltip>
  99. <template slot="title">
  100. <span>{{ i18n "pages.inbounds.subscriptionDesc" }}</span>
  101. </template>
  102. Subscription
  103. <a-icon
  104. @click="client.subId = RandomUtil.randomLowerAndNum(16)"
  105. type="sync"
  106. ></a-icon>
  107. </a-tooltip>
  108. </template>
  109. <a-input v-model.trim="client.subId"></a-input>
  110. </a-form-item>
  111. <a-form-item v-if="client.email && app.tgBotEnable">
  112. <template slot="label">
  113. <a-tooltip>
  114. <template slot="title">
  115. <span>{{ i18n "pages.inbounds.telegramDesc" }}</span>
  116. </template>
  117. Telegram ChatID
  118. <a-icon type="question-circle"></a-icon>
  119. </a-tooltip>
  120. </template>
  121. <a-input-number
  122. :style="{ width: '50%' }"
  123. v-model.number="client.tgId"
  124. min="0"
  125. ></a-input-number>
  126. </a-form-item>
  127. <a-form-item v-if="client.email" label='{{ i18n "comment" }}'>
  128. <a-input v-model.trim="client.comment"></a-input>
  129. </a-form-item>
  130. <a-form-item v-if="app.ipLimitEnable">
  131. <template slot="label">
  132. <a-tooltip>
  133. <template slot="title">
  134. <span>{{ i18n "pages.inbounds.IPLimitDesc"}}</span>
  135. </template>
  136. <span>{{ i18n "pages.inbounds.IPLimit"}} </span>
  137. <a-icon type="question-circle"></a-icon>
  138. </a-tooltip>
  139. </template>
  140. <a-input-number v-model.number="client.limitIp" min="0"></a-input-number>
  141. </a-form-item>
  142. <a-form-item
  143. v-if="app.ipLimitEnable && client.limitIp > 0 && client.email && isEdit"
  144. >
  145. <template slot="label">
  146. <a-tooltip>
  147. <template slot="title">
  148. <span>{{ i18n "pages.inbounds.IPLimitlogDesc" }}</span>
  149. </template>
  150. <span>{{ i18n "pages.inbounds.IPLimitlog" }} </span>
  151. <a-icon type="question-circle"></a-icon>
  152. </a-tooltip>
  153. </template>
  154. <a-tooltip>
  155. <template slot="title">
  156. <span>{{ i18n "pages.inbounds.IPLimitlogclear" }}</span>
  157. </template>
  158. <span :style="{ color: '#FF4D4F' }">
  159. <a-icon type="delete" @click="clearDBClientIps(client.email)"></a-icon>
  160. </span>
  161. </a-tooltip>
  162. <a-form layout="block">
  163. <a-textarea
  164. id="clientIPs"
  165. readonly
  166. @click="getDBClientIps(client.email)"
  167. placeholder="Click To Get IPs"
  168. :auto-size="{ minRows: 5, maxRows: 10 }"
  169. >
  170. </a-textarea>
  171. </a-form>
  172. </a-form-item>
  173. <a-form-item v-if="inbound.canEnableTlsFlow()" label="Flow">
  174. <a-select
  175. v-model="client.flow"
  176. :dropdown-class-name="themeSwitcher.currentTheme"
  177. >
  178. <a-select-option value selected>{{ i18n "none" }}</a-select-option>
  179. <a-select-option v-for="key in TLS_FLOW_CONTROL" :value="key"
  180. >[[ key ]]</a-select-option
  181. >
  182. </a-select>
  183. </a-form-item>
  184. <a-form-item>
  185. <template slot="label">
  186. <a-tooltip>
  187. <template slot="title">
  188. 0 <span>{{ i18n "pages.inbounds.meansNoLimit" }}</span>
  189. </template>
  190. {{ i18n "pages.inbounds.totalFlow" }}
  191. <a-icon type="question-circle"></a-icon>
  192. </a-tooltip>
  193. </template>
  194. <a-input-number v-model.number="client._totalGB" :min="0"></a-input-number>
  195. </a-form-item>
  196. <a-form-item v-if="isEdit && clientStats" label='{{ i18n "usage" }}'>
  197. <a-tag :color="ColorUtils.clientUsageColor(clientStats, app.trafficDiff)">
  198. [[ SizeFormatter.sizeFormat(clientStats.up) ]] / [[
  199. SizeFormatter.sizeFormat(clientStats.down) ]] ([[
  200. SizeFormatter.sizeFormat(clientStats.up + clientStats.down) ]])
  201. </a-tag>
  202. <a-tooltip>
  203. <template slot="title">{{ i18n "pages.inbounds.resetTraffic" }}</template>
  204. <a-icon
  205. type="retweet"
  206. @click="resetClientTraffic(client.email,clientStats.inboundId,$event.target)"
  207. v-if="client.email.length > 0"
  208. ></a-icon>
  209. </a-tooltip>
  210. </a-form-item>
  211. <a-form-item label='{{ i18n "pages.client.delayedStart" }}'>
  212. <a-switch v-model="delayedStart" @click="client._expiryTime=0"></a-switch>
  213. </a-form-item>
  214. <a-form-item v-if="delayedStart" label='{{ i18n "pages.client.expireDays" }}'>
  215. <a-input-number
  216. v-model.number="delayedExpireDays"
  217. :min="0"
  218. ></a-input-number>
  219. </a-form-item>
  220. <a-form-item v-else>
  221. <template slot="label">
  222. <a-tooltip>
  223. <template slot="title"
  224. >{{ i18n "pages.inbounds.leaveBlankToNeverExpire" }}</template
  225. >
  226. {{ i18n "pages.inbounds.expireDate" }}
  227. <a-icon type="question-circle"></a-icon>
  228. </a-tooltip>
  229. </template>
  230. <a-date-picker
  231. v-if="datepicker == 'gregorian'"
  232. :show-time="{ format: 'HH:mm:ss' }"
  233. format="YYYY-MM-DD HH:mm:ss"
  234. :dropdown-class-name="themeSwitcher.currentTheme"
  235. v-model="client._expiryTime"
  236. ></a-date-picker>
  237. <a-persian-datepicker
  238. v-else
  239. placeholder='{{ i18n "pages.settings.datepickerPlaceholder" }}'
  240. value="client._expiryTime"
  241. v-model="client._expiryTime"
  242. ></a-persian-datepicker>
  243. <a-tag color="red" v-if="isEdit && isExpiry">Expired</a-tag>
  244. </a-form-item>
  245. <a-form-item v-if="client.expiryTime != 0">
  246. <template slot="label">
  247. <a-tooltip>
  248. <template slot="title">{{ i18n "pages.client.renewDesc" }}</template>
  249. {{ i18n "pages.client.renew" }}
  250. <a-icon type="question-circle"></a-icon>
  251. </a-tooltip>
  252. </template>
  253. <a-input-number v-model.number="client.reset" :min="0"></a-input-number>
  254. </a-form-item>
  255. </a-form>
  256. {{end}}