Files
NanoKVM-MIRROR/server/router/router.go
wj-xiao 6eb4a4ea62 update version to 2.1.6
feat: support downloading image from online URL
feat: add keyboard shortcut Ctrl+Alt+Del
fix: fix the CSRF issue
perf: add an option to configure custom ICE servers
perf: removed unnecessary modifications to DNS configuration
perf: add an SSH enable/disable toggle in the web UI
perf: add a Tailscale enable/disable toggle in the web UI
perf: download Tailscale installation package from the official source
perf: automatic enable/disable GOMEMLIMIT on tailscale start/stop
perf: add JWT configuration
perf: implement secure password storage using bcrypt hashing
perf: implement integrity checks for online updates
refactor: refactor HDMI module and remove the dependency libmaixcam_lib.so
refactor: web terminal use pty instead of SSH
refactor: move Tailscale APIs from the network module to the extensions module
2025-02-14 14:18:13 +08:00

43 lines
699 B
Go

package router
import (
"fmt"
"os"
"path/filepath"
"github.com/gin-gonic/contrib/static"
"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
)
func Init(r *gin.Engine) {
web(r)
server(r)
log.Debugf("router init done")
}
func web(r *gin.Engine) {
execPath, err := os.Executable()
if err != nil {
panic("invalid executable path")
}
execDir := filepath.Dir(execPath)
webPath := fmt.Sprintf("%s/web", execDir)
r.Use(static.Serve("/", static.LocalFile(webPath, true)))
}
func server(r *gin.Engine) {
authRouter(r)
applicationRouter(r)
vmRouter(r)
streamRouter(r)
storageRouter(r)
networkRouter(r)
hidRouter(r)
wsRouter(r)
downloadRouter(r)
extensionsRouter(r)
}