diff --git a/README.md b/README.md index b29ac71..cb00ce5 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,8 @@ Distribuições alvo: Clone o projeto e execute o instalador: ```bash -git clone -cd +git clone https://git.dr2.site/penguinehis/DragonCoreSSH-NewWEB +cd DragonCoreSSH-NewWEB sudo bash install.sh ``` @@ -212,8 +212,8 @@ Target distributions: Clone the project and run the installer: ```bash -git clone -cd +git clone https://git.dr2.site/penguinehis/DragonCoreSSH-NewWEB +cd DragonCoreSSH-NewWEB sudo bash install.sh ``` diff --git a/admin/index.html b/admin/index.html index 6a3e3b3..515ea92 100644 --- a/admin/index.html +++ b/admin/index.html @@ -308,6 +308,7 @@ pre.log-box{background:rgba(15,23,42,.9);color:#9ca3af;border:1px solid rgba(55,
- +
@@ -1972,17 +1973,33 @@ function wzToggleAddInbound() { } function onWzProtoChange(val) { - document.getElementById("wzVlessFields").style.display = val === "vless" ? "grid" : "none"; + const usesClientTransport = val === "vless" || val === "vmess"; + document.getElementById("wzVlessFields").style.display = usesClientTransport ? "grid" : "none"; document.getElementById("wzTrojanFields").style.display = val === "trojan" ? "" : "none"; document.getElementById("wzSSFields").style.display = val === "shadowsocks" ? "grid" : "none"; - const portMap = { vless:10086, trojan:8443, shadowsocks:8388, socks:10808 }; - const tagMap = { vless:"vless-in", trojan:"trojan-in", shadowsocks:"ss-in", socks:"socks-local" }; + + const tlsSel = document.getElementById("wzTLS"); + const realityOpt = document.querySelector("#wzTLS option[value='reality']"); + if (realityOpt) { + realityOpt.disabled = val === "vmess"; + if (val === "vmess" && tlsSel.value === "reality") { + tlsSel.value = "none"; + onWzTLSChange("none"); + } + } + + const portMap = { vless:10086, vmess:10087, trojan:8443, shadowsocks:8388, socks:10808 }; + const tagMap = { vless:"vless-in", vmess:"vmess-in", trojan:"trojan-in", shadowsocks:"ss-in", socks:"socks-local" }; const portEl = document.getElementById("wzPort"); const tagEl = document.getElementById("wzTag"); const lisEl = document.getElementById("wzListenIP"); - if (!portEl.value) portEl.value = portMap[val] || ""; - if (!tagEl.value) tagEl.value = tagMap[val] || val+"-in"; - if (!lisEl.value) lisEl.value = val === "socks" ? "127.0.0.1" : "0.0.0.0"; + const knownPorts = Object.values(portMap).map(String); + const knownTags = Object.values(tagMap); + if (!portEl.value || knownPorts.includes(portEl.value)) portEl.value = portMap[val] || ""; + if (!tagEl.value || knownTags.includes(tagEl.value)) tagEl.value = tagMap[val] || val+"-in"; + if (!lisEl.value || lisEl.value === "0.0.0.0" || lisEl.value === "127.0.0.1") { + lisEl.value = val === "socks" ? "127.0.0.1" : "0.0.0.0"; + } } function onWzNetworkChange(val) { @@ -2025,8 +2042,8 @@ function wzSaveInbound() { const tag = document.getElementById("wzTag").value.trim() || proto+"-in"; if (!port) { alert("Port required."); return; } const ib = { tag, port, listen, protocol: proto, settings: {} }; - if (proto === "vless") { - ib.settings = { clients: [], decryption: "none" }; + if (proto === "vless" || proto === "vmess") { + ib.settings = proto === "vless" ? { clients: [], decryption: "none" } : { clients: [] }; const net = document.getElementById("wzNetwork").value; const tlsVal = document.getElementById("wzTLS").value; ib.streamSettings = { network: net }; @@ -2069,7 +2086,7 @@ function wzSaveInbound() { ib.streamSettings.tlsSettings = { certificates: [{ certificateFile: document.getElementById("wzTLSCert").value.trim(), keyFile: document.getElementById("wzTLSKey").value.trim() }], }; - } else if (tlsVal === "reality") { + } else if (tlsVal === "reality" && proto === "vless") { ib.streamSettings.security = "reality"; ib.streamSettings.realitySettings = { dest: document.getElementById("wzRealityDest").value.trim(), diff --git a/xray_integration.go b/xray_integration.go index afd0922..bfdbc9c 100644 --- a/xray_integration.go +++ b/xray_integration.go @@ -471,9 +471,14 @@ func (m *XrayManager) AddXrayClient(inboundTag, uuid, email string) error { } } } - settings["clients"] = append(clients, map[string]interface{}{ + proto, _ := ibMap["protocol"].(string) + client := map[string]interface{}{ "id": uuid, "email": email, "level": 0, - }) + } + if strings.EqualFold(proto, "vmess") { + client["alterId"] = 0 + } + settings["clients"] = append(clients, client) return nil } return fmt.Errorf("inbound %q not found", inboundTag) @@ -578,7 +583,7 @@ func handleXrayClientAdd(w http.ResponseWriter, r *http.Request) { UUID string `json:"uuid"` Email string `json:"email"` Name string `json:"name"` - ExpiresAt string `json:"expires_at"` // RFC3339 or YYYY-MM-DD or empty + ExpiresAt string `json:"expires_at"` // RFC3339 or YYYY-MM-DD or empty MaxConnections int `json:"max_connections"` } if err := json.NewDecoder(r.Body).Decode(&req); err != nil {