Skip to content

Commit

Permalink
fix /get-uptime
Browse files Browse the repository at this point in the history
  • Loading branch information
scottfeldman committed Jan 13, 2025
1 parent bb21b77 commit f3dce69
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 0 additions & 1 deletion pkg/device/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ func (d *device) installAPIs() {

d.HandleFunc("GET /edit-name", d.editName)
d.HandleFunc("GET /rename", d.rename)
d.HandleFunc("GET /get-uptime", d.apiRouteDown)

d.HandleFunc("GET /model", d.showModel)

Expand Down
10 changes: 10 additions & 0 deletions pkg/device/device-linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ type deviceOS struct {
viewsMu rwMutex
}

func (d *device) Handle(pattern string, handler http.Handler) {
//LogDebug("Handle", "pattern", pattern)
d.ServeMux.Handle(pattern, handler)
}

func (d *device) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request)) {
//LogDebug("HandleFunc", "pattern", pattern)
d.ServeMux.HandleFunc(pattern, handler)
}

func (d *device) _buildOS() error {
var err error

Expand Down
2 changes: 1 addition & 1 deletion pkg/device/template/device-info-body.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
</div>
<div class="">
<span id="{{uniq `uptime`}}"
hx-get="/device/{{id}}/get-uptime"
hx-post="/device/{{id}}/get-uptime"
hx-trigger="load"
hx-swap="none"></span>
</div>
Expand Down

0 comments on commit f3dce69

Please sign in to comment.