api.go 1.1 KB

123456789101112131415161718192021222324252627282930
  1. package main
  2. import "net/http"
  3. // Aux APIs for USB KVM mode
  4. func registerLocalAuxRoutes() {
  5. http.HandleFunc("/aux/switchusbkvm", auxMCU.HandleSwitchUSBToKVM)
  6. http.HandleFunc("/aux/switchusbremote", auxMCU.HandleSwitchUSBToRemote)
  7. http.HandleFunc("/aux/presspower", auxMCU.HandlePressPowerButton)
  8. http.HandleFunc("/aux/releasepower", auxMCU.HandleReleasePowerButton)
  9. http.HandleFunc("/aux/pressreset", auxMCU.HandlePressResetButton)
  10. http.HandleFunc("/aux/releasereset", auxMCU.HandleReleaseResetButton)
  11. http.HandleFunc("/aux/getuuid", auxMCU.HandleGetUUID)
  12. }
  13. // Dummy Aux APIs for setups that do not have an aux MCU
  14. func registerDummyLocalAuxRoutes() {
  15. dummyHandler := func(w http.ResponseWriter, r *http.Request) {
  16. w.WriteHeader(http.StatusNotImplemented)
  17. w.Write([]byte("Not implemented"))
  18. }
  19. http.HandleFunc("/aux/switchusbkvm", dummyHandler)
  20. http.HandleFunc("/aux/switchusbremote", dummyHandler)
  21. http.HandleFunc("/aux/presspower", dummyHandler)
  22. http.HandleFunc("/aux/releasepower", dummyHandler)
  23. http.HandleFunc("/aux/pressreset", dummyHandler)
  24. http.HandleFunc("/aux/releasereset", dummyHandler)
  25. http.HandleFunc("/aux/getuuid", dummyHandler)
  26. }