mirror of
https://github.com/sipeed/NanoKVM.git
synced 2026-09-11 00:22:56 -05:00
- H.264 WebRTC: Refactored to significantly reduce video latency - H.264 Direct: Optimized data transmission; data parsing now continues correctly even when the tab is in the background - MJPEG: Refactored to ensure the correct data length is sent Bug Fixes - Fixed an issue where certain keyboard modifier keys were not recognized - Fixed vertical mouse cursor drift when the page is zoomed in or out Optimizations - Optimized HID write logic and updated the HID reset mechanism - Added support for deleting images - Added a Swap Memory option to the Tailscale page - Added a confirmation dialog when uninstalling Tailscale to prevent accidental removal - Improved the logic for updating the web page title - Improved the UI for the Clipboard, Settings, Image Mounting, and App Update pages Security - Added a mandatory delay after failed login attempts to prevent brute-force attacks - Updated dependencies to patch known security vulnerabilities
50 lines
905 B
Go
50 lines
905 B
Go
package vm
|
|
|
|
import (
|
|
"NanoKVM-Server/proto"
|
|
"NanoKVM-Server/service/vm/jiggler"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
log "github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func (s *Service) GetMouseJiggler(c *gin.Context) {
|
|
var rsp proto.Response
|
|
|
|
mouseJiggler := jiggler.GetJiggler()
|
|
|
|
data := &proto.GetMouseJigglerRsp{
|
|
Enabled: mouseJiggler.IsEnabled(),
|
|
Mode: mouseJiggler.GetMode(),
|
|
}
|
|
|
|
rsp.OkRspWithData(c, data)
|
|
}
|
|
|
|
func (s *Service) SetMouseJiggler(c *gin.Context) {
|
|
var req proto.SetMouseJigglerReq
|
|
var rsp proto.Response
|
|
|
|
err := proto.ParseFormRequest(c, &req)
|
|
if err != nil {
|
|
rsp.ErrRsp(c, -1, "invalid arguments")
|
|
return
|
|
}
|
|
|
|
mouseJiggler := jiggler.GetJiggler()
|
|
|
|
if req.Enabled {
|
|
err = mouseJiggler.Enable(req.Mode)
|
|
} else {
|
|
err = mouseJiggler.Disable()
|
|
}
|
|
|
|
if err != nil {
|
|
rsp.ErrRsp(c, -2, "operation failed")
|
|
return
|
|
}
|
|
|
|
rsp.OkRsp(c)
|
|
log.Debugf("set mouse jiggler: %t", req.Enabled)
|
|
}
|