mirror of
https://github.com/luckfox-eng29/kvm.git
synced 2026-05-27 16:45:08 +02:00
feat(webrtc): add configurable STUN and TURN servers
Add backend config, RPC handlers, and an HTTP endpoint for WebRTC ICE servers. Replace hardcoded frontend STUN usage with server-provided ICE server configuration, and add access settings UI for STUN and TURN entries.
This commit is contained in:
11
web.go
11
web.go
@@ -168,6 +168,7 @@ func setupRouter() *gin.Engine {
|
||||
protected.GET("/storage/download", handleDownloadHttp)
|
||||
protected.GET("/storage/sd-download", handleSDDownloadHttp)
|
||||
protected.POST("/api/rpc", handleRpcRequest)
|
||||
protected.GET("/api/ice-servers", handleGetIceServers)
|
||||
protected.GET("/terminal/ws", handleTerminalWS)
|
||||
protected.GET("/serial/ws", handleSerialWS)
|
||||
protected.GET("/video/stream", handleVideoStream)
|
||||
@@ -907,6 +908,16 @@ func handleRpcRequest(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, response)
|
||||
}
|
||||
|
||||
func handleGetIceServers(c *gin.Context) {
|
||||
LoadConfig()
|
||||
servers, err := rpcGetIceServers()
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"iceServers": servers})
|
||||
}
|
||||
|
||||
func handleVideoStream(c *gin.Context) {
|
||||
logger.Info().Msg("HTTP video stream request received")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user