From b2d32f588ff114a277805cb9401272162ee27e3d Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Tue, 5 May 2026 21:00:03 +0200 Subject: [PATCH] new: vless reverse legacy reverse removed --- database/model/model.go | 37 +++--- web/assets/js/model/inbound.js | 9 +- web/assets/js/model/outbound.js | 7 +- web/html/form/client.html | 12 ++ web/html/form/outbound.html | 12 ++ web/html/modals/xray_reverse_modal.html | 164 ----------------------- web/html/modals/xray_rule_modal.html | 7 - web/html/settings/xray/reverse.html | 39 ------ web/html/xray.html | 166 ------------------------ web/service/xray.go | 2 +- web/translation/translate.ar_EG.toml | 3 + web/translation/translate.en_US.toml | 3 + web/translation/translate.es_ES.toml | 3 + web/translation/translate.fa_IR.toml | 3 + web/translation/translate.id_ID.toml | 3 + web/translation/translate.ja_JP.toml | 3 + web/translation/translate.pt_BR.toml | 3 + web/translation/translate.ru_RU.toml | 3 + web/translation/translate.tr_TR.toml | 3 + web/translation/translate.uk_UA.toml | 3 + web/translation/translate.vi_VN.toml | 3 + web/translation/translate.zh_CN.toml | 3 + web/translation/translate.zh_TW.toml | 3 + 23 files changed, 99 insertions(+), 395 deletions(-) delete mode 100644 web/html/modals/xray_reverse_modal.html delete mode 100644 web/html/settings/xray/reverse.html diff --git a/database/model/model.go b/database/model/model.go index 01654d22..047780e5 100644 --- a/database/model/model.go +++ b/database/model/model.go @@ -129,22 +129,27 @@ type CustomGeoResource struct { UpdatedAt int64 `json:"updatedAt" gorm:"autoUpdateTime;column:updated_at"` } +type ClientReverse struct { + Tag string `json:"tag"` +} + // Client represents a client configuration for Xray inbounds with traffic limits and settings. type Client struct { - ID string `json:"id,omitempty"` // Unique client identifier - Security string `json:"security"` // Security method (e.g., "auto", "aes-128-gcm") - Password string `json:"password,omitempty"` // Client password - Flow string `json:"flow,omitempty"` // Flow control (XTLS) - Auth string `json:"auth,omitempty"` // Auth password (Hysteria) - Email string `json:"email"` // Client email identifier - LimitIP int `json:"limitIp"` // IP limit for this client - TotalGB int64 `json:"totalGB" form:"totalGB"` // Total traffic limit in GB - ExpiryTime int64 `json:"expiryTime" form:"expiryTime"` // Expiration timestamp - Enable bool `json:"enable" form:"enable"` // Whether the client is enabled - TgID int64 `json:"tgId" form:"tgId"` // Telegram user ID for notifications - SubID string `json:"subId" form:"subId"` // Subscription identifier - Comment string `json:"comment" form:"comment"` // Client comment - Reset int `json:"reset" form:"reset"` // Reset period in days - CreatedAt int64 `json:"created_at,omitempty"` // Creation timestamp - UpdatedAt int64 `json:"updated_at,omitempty"` // Last update timestamp + ID string `json:"id,omitempty"` // Unique client identifier + Security string `json:"security"` // Security method (e.g., "auto", "aes-128-gcm") + Password string `json:"password,omitempty"` // Client password + Flow string `json:"flow,omitempty"` // Flow control (XTLS) + Reverse *ClientReverse `json:"reverse,omitempty"` // VLESS simple reverse proxy settings + Auth string `json:"auth,omitempty"` // Auth password (Hysteria) + Email string `json:"email"` // Client email identifier + LimitIP int `json:"limitIp"` // IP limit for this client + TotalGB int64 `json:"totalGB" form:"totalGB"` // Total traffic limit in GB + ExpiryTime int64 `json:"expiryTime" form:"expiryTime"` // Expiration timestamp + Enable bool `json:"enable" form:"enable"` // Whether the client is enabled + TgID int64 `json:"tgId" form:"tgId"` // Telegram user ID for notifications + SubID string `json:"subId" form:"subId"` // Subscription identifier + Comment string `json:"comment" form:"comment"` // Client comment + Reset int `json:"reset" form:"reset"` // Reset period in days + CreatedAt int64 `json:"created_at,omitempty"` // Creation timestamp + UpdatedAt int64 `json:"updated_at,omitempty"` // Last update timestamp } diff --git a/web/assets/js/model/inbound.js b/web/assets/js/model/inbound.js index dfffeffe..bb30dbcc 100644 --- a/web/assets/js/model/inbound.js +++ b/web/assets/js/model/inbound.js @@ -2616,27 +2616,34 @@ Inbound.VLESSSettings.VLESS = class extends Inbound.ClientBase { constructor( id = RandomUtil.randomUUID(), flow = '', + reverseTag = '', email, limitIp, totalGB, expiryTime, enable, tgId, subId, comment, reset, created_at, updated_at, ) { super(email, limitIp, totalGB, expiryTime, enable, tgId, subId, comment, reset, created_at, updated_at); this.id = id; this.flow = flow; + this.reverseTag = reverseTag; } static fromJson(json = {}) { return new Inbound.VLESSSettings.VLESS( json.id, json.flow, + json.reverse?.tag ?? '', ...Inbound.ClientBase.commonArgsFromJson(json), ); } toJson() { - return { + const json = { id: this.id, flow: this.flow, ...this._clientBaseToJson(), }; + if (this.reverseTag) { + json.reverse = { tag: this.reverseTag }; + } + return json; } }; diff --git a/web/assets/js/model/outbound.js b/web/assets/js/model/outbound.js index 1c2d67d9..9b740297 100644 --- a/web/assets/js/model/outbound.js +++ b/web/assets/js/model/outbound.js @@ -1747,13 +1747,14 @@ Outbound.VmessSettings = class extends CommonClass { } }; Outbound.VLESSSettings = class extends CommonClass { - constructor(address, port, id, flow, encryption, testpre = 0, testseed = [900, 500, 900, 256]) { + constructor(address, port, id, flow, encryption, reverseTag = '', testpre = 0, testseed = [900, 500, 900, 256]) { super(); this.address = address; this.port = port; this.id = id; this.flow = flow; this.encryption = encryption; + this.reverseTag = reverseTag; this.testpre = testpre; this.testseed = testseed; } @@ -1766,6 +1767,7 @@ Outbound.VLESSSettings = class extends CommonClass { json.id, json.flow, json.encryption, + json.reverse?.tag || '', json.testpre || 0, json.testseed && json.testseed.length >= 4 ? json.testseed : [900, 500, 900, 256] ); @@ -1779,6 +1781,9 @@ Outbound.VLESSSettings = class extends CommonClass { flow: this.flow, encryption: this.encryption, }; + if (!ObjectUtil.isEmpty(this.reverseTag)) { + result.reverse = { tag: this.reverseTag }; + } // Only include Vision settings when flow is set if (this.flow && this.flow !== '') { if (this.testpre > 0) { diff --git a/web/html/form/client.html b/web/html/form/client.html index 989bb471..737c102e 100644 --- a/web/html/form/client.html +++ b/web/html/form/client.html @@ -129,6 +129,18 @@ [[ key ]] + + + + {{ template "settings/xray/outbounds" . }} - - - {{ template "settings/xray/reverse" . }} -