2023-12-08 18:17:17 +00:00
|
|
|
package webrtc
|
2023-05-16 13:59:37 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
_ "embed"
|
2024-01-03 20:13:20 +00:00
|
|
|
"errors"
|
2023-05-16 13:59:37 +00:00
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
"net"
|
|
|
|
"net/http"
|
2023-10-24 14:30:44 +00:00
|
|
|
"regexp"
|
2023-05-16 13:59:37 +00:00
|
|
|
"strings"
|
2023-07-23 18:18:58 +00:00
|
|
|
"time"
|
2023-05-16 13:59:37 +00:00
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"github.com/google/uuid"
|
|
|
|
|
2023-05-16 14:14:20 +00:00
|
|
|
"github.com/bluenviron/mediamtx/internal/conf"
|
2023-10-31 13:19:04 +00:00
|
|
|
"github.com/bluenviron/mediamtx/internal/defs"
|
2023-05-16 14:14:20 +00:00
|
|
|
"github.com/bluenviron/mediamtx/internal/logger"
|
2023-10-26 19:46:18 +00:00
|
|
|
"github.com/bluenviron/mediamtx/internal/protocols/httpserv"
|
|
|
|
"github.com/bluenviron/mediamtx/internal/protocols/webrtc"
|
2023-10-31 13:19:04 +00:00
|
|
|
"github.com/bluenviron/mediamtx/internal/restrictnetwork"
|
2023-05-16 13:59:37 +00:00
|
|
|
)
|
|
|
|
|
2023-12-08 18:17:17 +00:00
|
|
|
//go:embed publish_index.html
|
|
|
|
var publishIndex []byte
|
2023-05-16 13:59:37 +00:00
|
|
|
|
2023-12-08 18:17:17 +00:00
|
|
|
//go:embed read_index.html
|
|
|
|
var readIndex []byte
|
2023-05-16 13:59:37 +00:00
|
|
|
|
2023-10-24 14:30:44 +00:00
|
|
|
var (
|
|
|
|
reWHIPWHEPNoID = regexp.MustCompile("^/(.+?)/(whip|whep)$")
|
|
|
|
reWHIPWHEPWithID = regexp.MustCompile("^/(.+?)/(whip|whep)/(.+?)$")
|
|
|
|
)
|
|
|
|
|
2023-12-08 18:17:17 +00:00
|
|
|
func writeError(ctx *gin.Context, statusCode int, err error) {
|
2023-10-31 13:19:04 +00:00
|
|
|
ctx.JSON(statusCode, &defs.APIError{
|
2023-10-28 12:08:34 +00:00
|
|
|
Error: err.Error(),
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2023-11-03 16:36:51 +00:00
|
|
|
func sessionLocation(publish bool, secret uuid.UUID) string {
|
|
|
|
ret := ""
|
|
|
|
if publish {
|
|
|
|
ret += "whip"
|
|
|
|
} else {
|
|
|
|
ret += "whep"
|
|
|
|
}
|
|
|
|
ret += "/" + secret.String()
|
|
|
|
return ret
|
|
|
|
}
|
|
|
|
|
2023-12-08 18:17:17 +00:00
|
|
|
type httpServer struct {
|
|
|
|
address string
|
|
|
|
encryption bool
|
|
|
|
serverKey string
|
|
|
|
serverCert string
|
|
|
|
allowOrigin string
|
|
|
|
trustedProxies conf.IPsOrCIDRs
|
|
|
|
readTimeout conf.StringDuration
|
|
|
|
pathManager defs.PathManager
|
|
|
|
parent *Server
|
2023-05-16 13:59:37 +00:00
|
|
|
|
2023-07-30 21:03:00 +00:00
|
|
|
inner *httpserv.WrappedServer
|
2023-05-16 13:59:37 +00:00
|
|
|
}
|
|
|
|
|
2023-12-08 18:17:17 +00:00
|
|
|
func (s *httpServer) initialize() error {
|
|
|
|
if s.encryption {
|
|
|
|
if s.serverCert == "" {
|
|
|
|
return fmt.Errorf("server cert is missing")
|
2023-05-16 13:59:37 +00:00
|
|
|
}
|
2023-05-16 18:12:45 +00:00
|
|
|
} else {
|
2023-12-08 18:17:17 +00:00
|
|
|
s.serverKey = ""
|
|
|
|
s.serverCert = ""
|
2023-05-16 13:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
router := gin.New()
|
2023-12-08 18:17:17 +00:00
|
|
|
router.SetTrustedProxies(s.trustedProxies.ToTrustedProxies()) //nolint:errcheck
|
2023-08-07 15:16:33 +00:00
|
|
|
router.NoRoute(s.onRequest)
|
2023-07-30 21:03:00 +00:00
|
|
|
|
2023-12-08 18:17:17 +00:00
|
|
|
network, address := restrictnetwork.Restrict("tcp", s.address)
|
2023-05-16 13:59:37 +00:00
|
|
|
|
2023-05-16 18:12:45 +00:00
|
|
|
var err error
|
2023-07-30 21:03:00 +00:00
|
|
|
s.inner, err = httpserv.NewWrappedServer(
|
|
|
|
network,
|
2023-05-16 18:12:45 +00:00
|
|
|
address,
|
2023-12-08 18:17:17 +00:00
|
|
|
time.Duration(s.readTimeout),
|
|
|
|
s.serverCert,
|
|
|
|
s.serverKey,
|
2023-05-16 18:12:45 +00:00
|
|
|
router,
|
2023-08-07 15:16:33 +00:00
|
|
|
s,
|
2023-05-16 18:12:45 +00:00
|
|
|
)
|
|
|
|
if err != nil {
|
2023-12-08 18:17:17 +00:00
|
|
|
return err
|
2023-05-16 13:59:37 +00:00
|
|
|
}
|
|
|
|
|
2023-12-08 18:17:17 +00:00
|
|
|
return nil
|
2023-05-16 13:59:37 +00:00
|
|
|
}
|
|
|
|
|
2023-12-08 18:17:17 +00:00
|
|
|
// Log implements logger.Writer.
|
|
|
|
func (s *httpServer) Log(level logger.Level, format string, args ...interface{}) {
|
2023-05-16 13:59:37 +00:00
|
|
|
s.parent.Log(level, format, args...)
|
|
|
|
}
|
|
|
|
|
2023-12-08 18:17:17 +00:00
|
|
|
func (s *httpServer) close() {
|
2023-07-30 21:03:00 +00:00
|
|
|
s.inner.Close()
|
2023-05-16 13:59:37 +00:00
|
|
|
}
|
|
|
|
|
2023-12-08 18:17:17 +00:00
|
|
|
func (s *httpServer) checkAuthOutsideSession(ctx *gin.Context, path string, publish bool) bool {
|
2023-10-24 14:30:44 +00:00
|
|
|
ip := ctx.ClientIP()
|
|
|
|
_, port, _ := net.SplitHostPort(ctx.Request.RemoteAddr)
|
|
|
|
remoteAddr := net.JoinHostPort(ip, port)
|
|
|
|
user, pass, hasCredentials := ctx.Request.BasicAuth()
|
2023-05-16 13:59:37 +00:00
|
|
|
|
2023-12-08 18:17:17 +00:00
|
|
|
res := s.pathManager.GetConfForPath(defs.PathGetConfForPathReq{
|
|
|
|
AccessRequest: defs.PathAccessRequest{
|
|
|
|
Name: path,
|
|
|
|
Query: ctx.Request.URL.RawQuery,
|
|
|
|
Publish: publish,
|
|
|
|
IP: net.ParseIP(ip),
|
|
|
|
User: user,
|
|
|
|
Pass: pass,
|
|
|
|
Proto: defs.AuthProtocolWebRTC,
|
2023-10-24 14:30:44 +00:00
|
|
|
},
|
|
|
|
})
|
2023-12-08 18:17:17 +00:00
|
|
|
if res.Err != nil {
|
2024-01-03 20:13:20 +00:00
|
|
|
var terr defs.AuthenticationError
|
|
|
|
if errors.As(res.Err, &terr) {
|
2023-10-24 14:30:44 +00:00
|
|
|
if !hasCredentials {
|
|
|
|
ctx.Header("WWW-Authenticate", `Basic realm="mediamtx"`)
|
|
|
|
ctx.Writer.WriteHeader(http.StatusUnauthorized)
|
|
|
|
return false
|
|
|
|
}
|
2023-06-22 10:49:59 +00:00
|
|
|
|
2023-12-08 18:17:17 +00:00
|
|
|
s.Log(logger.Info, "connection %v failed to authenticate: %v", remoteAddr, terr.Message)
|
2023-05-16 13:59:37 +00:00
|
|
|
|
2024-01-18 21:48:25 +00:00
|
|
|
// wait some seconds to mitigate brute force attacks
|
|
|
|
<-time.After(pauseAfterAuthError)
|
2023-06-21 11:53:58 +00:00
|
|
|
|
2023-12-08 18:17:17 +00:00
|
|
|
writeError(ctx, http.StatusUnauthorized, terr)
|
2023-10-24 14:30:44 +00:00
|
|
|
return false
|
2023-05-16 13:59:37 +00:00
|
|
|
}
|
2023-10-24 14:30:44 +00:00
|
|
|
|
2023-12-08 18:17:17 +00:00
|
|
|
writeError(ctx, http.StatusInternalServerError, res.Err)
|
2023-10-24 14:30:44 +00:00
|
|
|
return false
|
2023-05-16 13:59:37 +00:00
|
|
|
}
|
|
|
|
|
2023-10-24 14:30:44 +00:00
|
|
|
return true
|
|
|
|
}
|
2023-05-16 13:59:37 +00:00
|
|
|
|
2023-12-08 18:17:17 +00:00
|
|
|
func (s *httpServer) onWHIPOptions(ctx *gin.Context, path string, publish bool) {
|
2023-10-24 14:30:44 +00:00
|
|
|
if !s.checkAuthOutsideSession(ctx, path, publish) {
|
2023-05-16 13:59:37 +00:00
|
|
|
return
|
2023-10-24 14:30:44 +00:00
|
|
|
}
|
2023-05-16 13:59:37 +00:00
|
|
|
|
2023-10-24 14:30:44 +00:00
|
|
|
servers, err := s.parent.generateICEServers()
|
|
|
|
if err != nil {
|
2023-12-08 18:17:17 +00:00
|
|
|
writeError(ctx, http.StatusInternalServerError, err)
|
2023-10-24 14:30:44 +00:00
|
|
|
return
|
|
|
|
}
|
2023-05-16 13:59:37 +00:00
|
|
|
|
2023-10-24 14:30:44 +00:00
|
|
|
ctx.Writer.Header().Set("Access-Control-Allow-Methods", "OPTIONS, GET, POST, PATCH, DELETE")
|
|
|
|
ctx.Writer.Header().Set("Access-Control-Allow-Headers", "Authorization, Content-Type, If-Match")
|
|
|
|
ctx.Writer.Header().Set("Access-Control-Expose-Headers", "Link")
|
2023-10-25 09:48:57 +00:00
|
|
|
ctx.Writer.Header()["Link"] = webrtc.LinkHeaderMarshal(servers)
|
2023-10-24 14:30:44 +00:00
|
|
|
ctx.Writer.WriteHeader(http.StatusNoContent)
|
|
|
|
}
|
2023-05-16 13:59:37 +00:00
|
|
|
|
2023-12-08 18:17:17 +00:00
|
|
|
func (s *httpServer) onWHIPPost(ctx *gin.Context, path string, publish bool) {
|
2023-10-24 14:30:44 +00:00
|
|
|
if ctx.Request.Header.Get("Content-Type") != "application/sdp" {
|
2023-12-08 18:17:17 +00:00
|
|
|
writeError(ctx, http.StatusBadRequest, fmt.Errorf("invalid Content-Type"))
|
2023-10-24 14:30:44 +00:00
|
|
|
return
|
2023-05-16 13:59:37 +00:00
|
|
|
}
|
|
|
|
|
2023-10-24 14:30:44 +00:00
|
|
|
offer, err := io.ReadAll(ctx.Request.Body)
|
|
|
|
if err != nil {
|
2023-05-16 13:59:37 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-07-23 16:23:15 +00:00
|
|
|
ip := ctx.ClientIP()
|
|
|
|
_, port, _ := net.SplitHostPort(ctx.Request.RemoteAddr)
|
2023-07-23 18:06:16 +00:00
|
|
|
remoteAddr := net.JoinHostPort(ip, port)
|
2023-10-24 14:30:44 +00:00
|
|
|
user, pass, _ := ctx.Request.BasicAuth()
|
|
|
|
|
|
|
|
res := s.parent.newSession(webRTCNewSessionReq{
|
|
|
|
pathName: path,
|
|
|
|
remoteAddr: remoteAddr,
|
|
|
|
query: ctx.Request.URL.RawQuery,
|
|
|
|
user: user,
|
|
|
|
pass: pass,
|
|
|
|
offer: offer,
|
|
|
|
publish: publish,
|
|
|
|
})
|
|
|
|
if res.err != nil {
|
2023-12-08 18:17:17 +00:00
|
|
|
writeError(ctx, res.errStatusCode, res.err)
|
2023-10-24 14:30:44 +00:00
|
|
|
return
|
|
|
|
}
|
2023-05-16 13:59:37 +00:00
|
|
|
|
2023-10-24 14:30:44 +00:00
|
|
|
servers, err := s.parent.generateICEServers()
|
|
|
|
if err != nil {
|
2023-12-08 18:17:17 +00:00
|
|
|
writeError(ctx, http.StatusInternalServerError, err)
|
2023-10-24 14:30:44 +00:00
|
|
|
return
|
|
|
|
}
|
2023-07-23 18:18:58 +00:00
|
|
|
|
2023-10-24 14:30:44 +00:00
|
|
|
ctx.Writer.Header().Set("Content-Type", "application/sdp")
|
2023-10-28 12:08:34 +00:00
|
|
|
ctx.Writer.Header().Set("Access-Control-Expose-Headers", "ETag, ID, Accept-Patch, Link, Location")
|
2023-10-24 14:30:44 +00:00
|
|
|
ctx.Writer.Header().Set("ETag", "*")
|
|
|
|
ctx.Writer.Header().Set("ID", res.sx.uuid.String())
|
|
|
|
ctx.Writer.Header().Set("Accept-Patch", "application/trickle-ice-sdpfrag")
|
2023-10-25 09:48:57 +00:00
|
|
|
ctx.Writer.Header()["Link"] = webrtc.LinkHeaderMarshal(servers)
|
2023-11-03 16:36:51 +00:00
|
|
|
ctx.Writer.Header().Set("Location", sessionLocation(publish, res.sx.secret))
|
2023-10-24 14:30:44 +00:00
|
|
|
ctx.Writer.WriteHeader(http.StatusCreated)
|
|
|
|
ctx.Writer.Write(res.answer)
|
|
|
|
}
|
2023-05-16 13:59:37 +00:00
|
|
|
|
2023-12-08 18:17:17 +00:00
|
|
|
func (s *httpServer) onWHIPPatch(ctx *gin.Context, rawSecret string) {
|
2023-10-24 14:30:44 +00:00
|
|
|
secret, err := uuid.Parse(rawSecret)
|
|
|
|
if err != nil {
|
2023-12-08 18:17:17 +00:00
|
|
|
writeError(ctx, http.StatusBadRequest, fmt.Errorf("invalid secret"))
|
2023-10-24 14:30:44 +00:00
|
|
|
return
|
2023-05-16 13:59:37 +00:00
|
|
|
}
|
|
|
|
|
2023-10-24 14:30:44 +00:00
|
|
|
if ctx.Request.Header.Get("Content-Type") != "application/trickle-ice-sdpfrag" {
|
2023-12-08 18:17:17 +00:00
|
|
|
writeError(ctx, http.StatusBadRequest, fmt.Errorf("invalid Content-Type"))
|
2023-10-24 14:30:44 +00:00
|
|
|
return
|
|
|
|
}
|
2023-05-16 13:59:37 +00:00
|
|
|
|
2023-10-24 14:30:44 +00:00
|
|
|
byts, err := io.ReadAll(ctx.Request.Body)
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
2023-05-16 13:59:37 +00:00
|
|
|
|
2023-10-25 09:48:57 +00:00
|
|
|
candidates, err := webrtc.ICEFragmentUnmarshal(byts)
|
2023-10-24 14:30:44 +00:00
|
|
|
if err != nil {
|
2023-12-08 18:17:17 +00:00
|
|
|
writeError(ctx, http.StatusBadRequest, err)
|
2023-10-24 14:30:44 +00:00
|
|
|
return
|
|
|
|
}
|
2023-07-30 20:30:41 +00:00
|
|
|
|
2023-10-24 14:30:44 +00:00
|
|
|
res := s.parent.addSessionCandidates(webRTCAddSessionCandidatesReq{
|
|
|
|
secret: secret,
|
|
|
|
candidates: candidates,
|
|
|
|
})
|
|
|
|
if res.err != nil {
|
2023-12-08 18:17:17 +00:00
|
|
|
writeError(ctx, http.StatusInternalServerError, res.err)
|
2023-10-24 14:30:44 +00:00
|
|
|
return
|
|
|
|
}
|
2023-05-16 13:59:37 +00:00
|
|
|
|
2023-10-24 14:30:44 +00:00
|
|
|
ctx.Writer.WriteHeader(http.StatusNoContent)
|
|
|
|
}
|
2023-05-16 13:59:37 +00:00
|
|
|
|
2023-12-08 18:17:17 +00:00
|
|
|
func (s *httpServer) onWHIPDelete(ctx *gin.Context, rawSecret string) {
|
2023-10-24 14:30:44 +00:00
|
|
|
secret, err := uuid.Parse(rawSecret)
|
|
|
|
if err != nil {
|
2023-12-08 18:17:17 +00:00
|
|
|
writeError(ctx, http.StatusBadRequest, fmt.Errorf("invalid secret"))
|
2023-10-24 14:30:44 +00:00
|
|
|
return
|
|
|
|
}
|
2023-05-16 13:59:37 +00:00
|
|
|
|
2023-10-24 14:30:44 +00:00
|
|
|
err = s.parent.deleteSession(webRTCDeleteSessionReq{
|
|
|
|
secret: secret,
|
|
|
|
})
|
|
|
|
if err != nil {
|
2023-12-08 18:17:17 +00:00
|
|
|
writeError(ctx, http.StatusInternalServerError, err)
|
2023-10-24 14:30:44 +00:00
|
|
|
return
|
|
|
|
}
|
2023-05-16 13:59:37 +00:00
|
|
|
|
2023-10-24 14:30:44 +00:00
|
|
|
ctx.Writer.WriteHeader(http.StatusOK)
|
|
|
|
}
|
2023-07-30 20:30:41 +00:00
|
|
|
|
2023-12-08 18:17:17 +00:00
|
|
|
func (s *httpServer) onPage(ctx *gin.Context, path string, publish bool) {
|
2023-10-24 14:30:44 +00:00
|
|
|
if !s.checkAuthOutsideSession(ctx, path, publish) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx.Writer.Header().Set("Cache-Control", "max-age=3600")
|
|
|
|
ctx.Writer.Header().Set("Content-Type", "text/html")
|
|
|
|
ctx.Writer.WriteHeader(http.StatusOK)
|
2023-05-16 13:59:37 +00:00
|
|
|
|
2023-10-24 14:30:44 +00:00
|
|
|
if publish {
|
2023-12-08 18:17:17 +00:00
|
|
|
ctx.Writer.Write(publishIndex)
|
2023-10-24 14:30:44 +00:00
|
|
|
} else {
|
2023-12-08 18:17:17 +00:00
|
|
|
ctx.Writer.Write(readIndex)
|
2023-10-24 14:30:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-08 18:17:17 +00:00
|
|
|
func (s *httpServer) onRequest(ctx *gin.Context) {
|
2023-10-24 14:30:44 +00:00
|
|
|
ctx.Writer.Header().Set("Access-Control-Allow-Origin", s.allowOrigin)
|
|
|
|
ctx.Writer.Header().Set("Access-Control-Allow-Credentials", "true")
|
|
|
|
|
|
|
|
// preflight requests
|
|
|
|
if ctx.Request.Method == http.MethodOptions &&
|
|
|
|
ctx.Request.Header.Get("Access-Control-Request-Method") != "" {
|
|
|
|
ctx.Writer.Header().Set("Access-Control-Allow-Methods", "OPTIONS, GET, POST, PATCH, DELETE")
|
|
|
|
ctx.Writer.Header().Set("Access-Control-Allow-Headers", "Authorization, Content-Type, If-Match")
|
|
|
|
ctx.Writer.WriteHeader(http.StatusNoContent)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-10-28 12:08:34 +00:00
|
|
|
// WHIP/WHEP, outside session
|
2023-10-24 14:30:44 +00:00
|
|
|
if m := reWHIPWHEPNoID.FindStringSubmatch(ctx.Request.URL.Path); m != nil {
|
|
|
|
switch ctx.Request.Method {
|
|
|
|
case http.MethodOptions:
|
|
|
|
s.onWHIPOptions(ctx, m[1], m[2] == "whip")
|
|
|
|
|
|
|
|
case http.MethodPost:
|
|
|
|
s.onWHIPPost(ctx, m[1], m[2] == "whip")
|
|
|
|
|
|
|
|
case http.MethodGet, http.MethodHead, http.MethodPut:
|
|
|
|
// RFC draft-ietf-whip-09
|
|
|
|
// The WHIP endpoints MUST return an "405 Method Not Allowed" response
|
|
|
|
// for any HTTP GET, HEAD or PUT requests
|
2023-12-08 18:17:17 +00:00
|
|
|
writeError(ctx, http.StatusMethodNotAllowed, fmt.Errorf("method not allowed"))
|
2023-10-24 14:30:44 +00:00
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-10-28 12:08:34 +00:00
|
|
|
// WHIP/WHEP, inside session
|
2023-10-24 14:30:44 +00:00
|
|
|
if m := reWHIPWHEPWithID.FindStringSubmatch(ctx.Request.URL.Path); m != nil {
|
|
|
|
switch ctx.Request.Method {
|
2023-05-16 13:59:37 +00:00
|
|
|
case http.MethodPatch:
|
2023-10-24 14:30:44 +00:00
|
|
|
s.onWHIPPatch(ctx, m[3])
|
2023-05-16 13:59:37 +00:00
|
|
|
|
2023-10-24 14:30:44 +00:00
|
|
|
case http.MethodDelete:
|
|
|
|
s.onWHIPDelete(ctx, m[3])
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
2023-05-16 13:59:37 +00:00
|
|
|
|
2023-10-24 14:30:44 +00:00
|
|
|
// static resources
|
|
|
|
if ctx.Request.Method == http.MethodGet {
|
|
|
|
switch {
|
|
|
|
case ctx.Request.URL.Path == "/favicon.ico":
|
2023-05-16 13:59:37 +00:00
|
|
|
|
2023-10-28 12:08:34 +00:00
|
|
|
case len(ctx.Request.URL.Path) >= 2:
|
2023-10-24 14:30:44 +00:00
|
|
|
switch {
|
2023-11-13 13:36:18 +00:00
|
|
|
case len(ctx.Request.URL.Path) > len("/publish") && strings.HasSuffix(ctx.Request.URL.Path, "/publish"):
|
2023-10-24 14:30:44 +00:00
|
|
|
s.onPage(ctx, ctx.Request.URL.Path[1:len(ctx.Request.URL.Path)-len("/publish")], true)
|
2023-05-16 13:59:37 +00:00
|
|
|
|
2023-10-24 14:30:44 +00:00
|
|
|
case ctx.Request.URL.Path[len(ctx.Request.URL.Path)-1] != '/':
|
2023-12-01 19:54:18 +00:00
|
|
|
ctx.Writer.Header().Set("Location", httpserv.LocationWithTrailingSlash(ctx.Request.URL))
|
2023-10-24 14:30:44 +00:00
|
|
|
ctx.Writer.WriteHeader(http.StatusMovedPermanently)
|
2023-05-16 13:59:37 +00:00
|
|
|
|
2023-10-24 14:30:44 +00:00
|
|
|
default:
|
|
|
|
s.onPage(ctx, ctx.Request.URL.Path[1:len(ctx.Request.URL.Path)-1], false)
|
|
|
|
}
|
2023-05-16 13:59:37 +00:00
|
|
|
}
|
2023-10-24 14:30:44 +00:00
|
|
|
return
|
2023-05-16 13:59:37 +00:00
|
|
|
}
|
|
|
|
}
|