mirror of
https://github.com/sipeed/NanoKVM.git
synced 2026-09-11 00:22:56 -05:00
* fix: stop HDMI capture when logged out * feat: stop HDMI capture when viewers are idle * fix: keep HDMI capture active for consumers
32 lines
762 B
Go
32 lines
762 B
Go
package picoclaw
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/gorilla/websocket"
|
|
)
|
|
|
|
func (s *Service) ReleaseRuntimeSession(c *gin.Context) {
|
|
s.ensureDependencies()
|
|
sessionID := strings.TrimSpace(c.GetHeader(sessionIDHeader))
|
|
if sessionID == "" {
|
|
writePicoclawError(c, newPicoclawError(CodeSessionIDMissing, "missing X-PicoClaw-Session-ID"))
|
|
return
|
|
}
|
|
|
|
if session, ok := GetSessionManager().Get(sessionID); ok {
|
|
s.closeGatewaySession(session, websocket.CloseNormalClosure, "session released")
|
|
}
|
|
s.releaseCaptureLeasesForSession(sessionID)
|
|
|
|
status := s.runtime.Get()
|
|
status.CurrentSession = s.lock.Owner()
|
|
s.runtime.Set(status)
|
|
|
|
writeSuccess(c, gin.H{
|
|
"released": true,
|
|
"current_session": status.CurrentSession,
|
|
})
|
|
}
|