2023-05-16 13:59:37 +00:00
|
|
|
package core
|
|
|
|
|
|
|
|
import (
|
|
|
|
_ "embed"
|
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
"net"
|
|
|
|
"net/http"
|
2023-10-24 14:30:44 +00:00
|
|
|
"net/url"
|
|
|
|
"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-10-25 09:48:57 +00:00
|
|
|
pwebrtc "github.com/pion/webrtc/v3"
|
2023-05-16 13:59:37 +00:00
|
|
|
|
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
|
|
|
)
|
|
|
|
|
|
|
|
//go:embed webrtc_publish_index.html
|
|
|
|
var webrtcPublishIndex []byte
|
|
|
|
|
|
|
|
//go:embed webrtc_read_index.html
|
|
|
|
var webrtcReadIndex []byte
|
|
|
|
|
2023-10-24 14:30:44 +00:00
|
|
|
var (
|
|
|
|
reWHIPWHEPNoID = regexp.MustCompile("^/(.+?)/(whip|whep)$")
|
|
|
|
reWHIPWHEPWithID = regexp.MustCompile("^/(.+?)/(whip|whep)/(.+?)$")
|
|
|
|
)
|
|
|
|
|
|
|
|
func relativeLocation(u *url.URL) string {
|
|
|
|
p := u.Path
|
|
|
|
if u.RawQuery != "" {
|
|
|
|
p += "?" + u.RawQuery
|
|
|
|
}
|
|
|
|
return p
|
|
|
|
}
|
|
|
|
|
2023-10-28 12:08:34 +00:00
|
|
|
func webrtcWriteError(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-05-16 13:59:37 +00:00
|
|
|
type webRTCHTTPServerParent interface {
|
|
|
|
logger.Writer
|
2023-10-25 09:48:57 +00:00
|
|
|
generateICEServers() ([]pwebrtc.ICEServer, error)
|
2023-07-30 21:53:39 +00:00
|
|
|
newSession(req webRTCNewSessionReq) webRTCNewSessionRes
|
|
|
|
addSessionCandidates(req webRTCAddSessionCandidatesReq) webRTCAddSessionCandidatesRes
|
2023-10-24 14:30:44 +00:00
|
|
|
deleteSession(req webRTCDeleteSessionReq) error
|
2023-05-16 13:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type webRTCHTTPServer struct {
|
|
|
|
allowOrigin string
|
|
|
|
pathManager *pathManager
|
|
|
|
parent webRTCHTTPServerParent
|
|
|
|
|
2023-07-30 21:03:00 +00:00
|
|
|
inner *httpserv.WrappedServer
|
2023-05-16 13:59:37 +00:00
|
|
|
}
|
|
|
|
|
2023-05-16 17:23:02 +00:00
|
|
|
func newWebRTCHTTPServer( //nolint:dupl
|
2023-05-16 13:59:37 +00:00
|
|
|
address string,
|
|
|
|
encryption bool,
|
|
|
|
serverKey string,
|
|
|
|
serverCert string,
|
|
|
|
allowOrigin string,
|
|
|
|
trustedProxies conf.IPsOrCIDRs,
|
|
|
|
readTimeout conf.StringDuration,
|
|
|
|
pathManager *pathManager,
|
|
|
|
parent webRTCHTTPServerParent,
|
|
|
|
) (*webRTCHTTPServer, error) {
|
|
|
|
if encryption {
|
2023-05-16 18:12:45 +00:00
|
|
|
if serverCert == "" {
|
|
|
|
return nil, fmt.Errorf("server cert is missing")
|
2023-05-16 13:59:37 +00:00
|
|
|
}
|
2023-05-16 18:12:45 +00:00
|
|
|
} else {
|
|
|
|
serverKey = ""
|
|
|
|
serverCert = ""
|
2023-05-16 13:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
s := &webRTCHTTPServer{
|
|
|
|
allowOrigin: allowOrigin,
|
|
|
|
pathManager: pathManager,
|
|
|
|
parent: parent,
|
|
|
|
}
|
|
|
|
|
|
|
|
router := gin.New()
|
2023-08-13 14:38:23 +00:00
|
|
|
router.SetTrustedProxies(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-10-31 13:19:04 +00:00
|
|
|
network, address := restrictnetwork.Restrict("tcp", 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-08-07 15:16:33 +00:00
|
|
|
time.Duration(readTimeout),
|
2023-05-16 18:12:45 +00:00
|
|
|
serverCert,
|
|
|
|
serverKey,
|
|
|
|
router,
|
2023-08-07 15:16:33 +00:00
|
|
|
s,
|
2023-05-16 18:12:45 +00:00
|
|
|
)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
2023-05-16 13:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return s, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *webRTCHTTPServer) Log(level logger.Level, format string, args ...interface{}) {
|
|
|
|
s.parent.Log(level, format, args...)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *webRTCHTTPServer) close() {
|
2023-07-30 21:03:00 +00:00
|
|
|
s.inner.Close()
|
2023-05-16 13:59:37 +00:00
|
|
|
}
|
|
|
|
|
2023-10-24 14:30:44 +00:00
|
|
|
func (s *webRTCHTTPServer) checkAuthOutsideSession(ctx *gin.Context, path string, publish bool) bool {
|
|
|
|
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-10-24 14:30:44 +00:00
|
|
|
res := s.pathManager.getConfForPath(pathGetConfForPathReq{
|
|
|
|
accessRequest: pathAccessRequest{
|
|
|
|
name: path,
|
|
|
|
query: ctx.Request.URL.RawQuery,
|
|
|
|
publish: publish,
|
|
|
|
ip: net.ParseIP(ip),
|
|
|
|
user: user,
|
|
|
|
pass: pass,
|
|
|
|
proto: authProtocolWebRTC,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
if res.err != nil {
|
|
|
|
if terr, ok := res.err.(*errAuthentication); ok {
|
|
|
|
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-10-24 14:30:44 +00:00
|
|
|
s.Log(logger.Info, "connection %v failed to authenticate: %v", remoteAddr, terr.message)
|
2023-05-16 13:59:37 +00:00
|
|
|
|
2023-10-24 14:30:44 +00:00
|
|
|
// wait some seconds to stop brute force attacks
|
|
|
|
<-time.After(webrtcPauseAfterAuthError)
|
2023-06-21 11:53:58 +00:00
|
|
|
|
2023-10-28 12:08:34 +00:00
|
|
|
webrtcWriteError(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-10-28 12:08:34 +00:00
|
|
|
webrtcWriteError(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-10-24 14:30:44 +00:00
|
|
|
func (s *webRTCHTTPServer) onWHIPOptions(ctx *gin.Context, path string, publish bool) {
|
|
|
|
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-10-28 12:08:34 +00:00
|
|
|
webrtcWriteError(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-10-24 14:30:44 +00:00
|
|
|
func (s *webRTCHTTPServer) onWHIPPost(ctx *gin.Context, path string, publish bool) {
|
|
|
|
if ctx.Request.Header.Get("Content-Type") != "application/sdp" {
|
2023-10-28 12:08:34 +00:00
|
|
|
webrtcWriteError(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-10-28 12:08:34 +00:00
|
|
|
webrtcWriteError(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-10-28 12:08:34 +00:00
|
|
|
webrtcWriteError(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-10-24 14:30:44 +00:00
|
|
|
ctx.Request.URL.Path += "/" + res.sx.secret.String()
|
|
|
|
ctx.Writer.Header().Set("Location", relativeLocation(ctx.Request.URL))
|
|
|
|
ctx.Writer.WriteHeader(http.StatusCreated)
|
|
|
|
ctx.Writer.Write(res.answer)
|
|
|
|
}
|
2023-05-16 13:59:37 +00:00
|
|
|
|
2023-10-24 14:30:44 +00:00
|
|
|
func (s *webRTCHTTPServer) onWHIPPatch(ctx *gin.Context, rawSecret string) {
|
|
|
|
secret, err := uuid.Parse(rawSecret)
|
|
|
|
if err != nil {
|
2023-10-28 12:08:34 +00:00
|
|
|
webrtcWriteError(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-10-28 12:08:34 +00:00
|
|
|
webrtcWriteError(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-10-28 12:08:34 +00:00
|
|
|
webrtcWriteError(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-10-30 18:53:03 +00:00
|
|
|
webrtcWriteError(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-10-24 14:30:44 +00:00
|
|
|
func (s *webRTCHTTPServer) onWHIPDelete(ctx *gin.Context, rawSecret string) {
|
|
|
|
secret, err := uuid.Parse(rawSecret)
|
|
|
|
if err != nil {
|
2023-10-28 12:08:34 +00:00
|
|
|
webrtcWriteError(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-10-28 12:08:34 +00:00
|
|
|
webrtcWriteError(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-10-24 14:30:44 +00:00
|
|
|
func (s *webRTCHTTPServer) onPage(ctx *gin.Context, path string, publish bool) {
|
|
|
|
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 {
|
|
|
|
ctx.Writer.Write(webrtcPublishIndex)
|
|
|
|
} else {
|
|
|
|
ctx.Writer.Write(webrtcReadIndex)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *webRTCHTTPServer) onRequest(ctx *gin.Context) {
|
|
|
|
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-10-28 12:08:34 +00:00
|
|
|
webrtcWriteError(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 {
|
|
|
|
case strings.HasSuffix(ctx.Request.URL.Path, "/publish"):
|
|
|
|
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] != '/':
|
|
|
|
ctx.Request.URL.Path += "/"
|
|
|
|
ctx.Writer.Header().Set("Location", relativeLocation(ctx.Request.URL))
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|