Fix VLESS share links to Remnawave format and default inbound to VLESS.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user