Report hotspot config
This commit is contained in:
parent
17d665e21a
commit
c443fce24f
8 changed files with 244 additions and 160 deletions
|
|
@ -82,11 +82,11 @@ func ConfigureHotspot(c *gin.Context) {
|
|||
|
||||
// ToggleHotspot handles hotspot enable/disable
|
||||
func ToggleHotspot(c *gin.Context, status *models.SystemStatus) {
|
||||
status.HotspotEnabled = !status.HotspotEnabled
|
||||
enabled := status.HotspotEnabled
|
||||
// Determine current state
|
||||
isEnabled := status.HotspotStatus != nil && status.HotspotStatus.State == "ENABLED"
|
||||
|
||||
var err error
|
||||
if enabled {
|
||||
if !isEnabled {
|
||||
err = hotspot.Start()
|
||||
logging.AddLog("Hotspot", "Hotspot activé")
|
||||
} else {
|
||||
|
|
@ -100,7 +100,10 @@ func ToggleHotspot(c *gin.Context, status *models.SystemStatus) {
|
|||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{"enabled": enabled})
|
||||
// Update status immediately
|
||||
status.HotspotStatus = hotspot.GetDetailedStatus()
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{"enabled": !isEnabled})
|
||||
}
|
||||
|
||||
// GetDevices returns connected devices
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue