Fix VLESS share links to Remnawave format and default inbound to VLESS.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
orohi
2026-07-29 05:26:00 +03:00
co-authored by Cursor
parent 20a20168b6
commit b48b936c27
3 changed files with 171 additions and 49 deletions
+25 -2
View File
@@ -78,7 +78,7 @@ func (s *Server) profileView(w http.ResponseWriter, r *http.Request) {
"UserName": s.Auth.CurrentName(r),
"Active": "profiles",
"Profile": p,
"Protocols": protocols,
"Protocols": inboundProtocols(protocols),
"Flash": r.URL.Query().Get("ok"),
"Error": r.URL.Query().Get("err"),
})
@@ -226,6 +226,12 @@ func (s *Server) inboundCreate(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/admin/profiles/"+profileID.String()+"?err=protocol", http.StatusSeeOther)
return
}
switch proto.Code {
case "vless", "vmess", "trojan", "shadowsocks":
default:
http.Redirect(w, r, "/admin/profiles/"+profileID.String()+"?err=protocol", http.StatusSeeOther)
return
}
in, err := parseInboundForm(r, profileID, protocolID, proto)
if err != nil {
log.Printf("inbound form: %v", err)
@@ -278,12 +284,23 @@ func (s *Server) inboundEditGet(w http.ResponseWriter, r *http.Request) {
"Active": "profiles",
"Profile": p,
"Inbound": in,
"Protocols": protocols,
"Protocols": inboundProtocols(protocols),
"Flash": r.URL.Query().Get("ok"),
"Error": r.URL.Query().Get("err"),
})
}
func inboundProtocols(all []models.Protocol) []models.Protocol {
var out []models.Protocol
for _, p := range all {
switch p.Code {
case "vless", "vmess", "trojan", "shadowsocks":
out = append(out, p)
}
}
return out
}
func (s *Server) inboundUpdate(w http.ResponseWriter, r *http.Request) {
profileID, err := uuid.Parse(mux.Vars(r)["id"])
if err != nil {
@@ -311,6 +328,12 @@ func (s *Server) inboundUpdate(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/admin/profiles/"+profileID.String()+"/inbounds/"+inboundID.String()+"?err=protocol", http.StatusSeeOther)
return
}
switch proto.Code {
case "vless", "vmess", "trojan", "shadowsocks":
default:
http.Redirect(w, r, "/admin/profiles/"+profileID.String()+"/inbounds/"+inboundID.String()+"?err=protocol", http.StatusSeeOther)
return
}
in, err := parseInboundForm(r, profileID, protocolID, proto)
if err != nil {
http.Redirect(w, r, "/admin/profiles/"+profileID.String()+"/inbounds/"+inboundID.String()+"?err=keys", http.StatusSeeOther)