Skip to content

Commit

Permalink
Update to use latset rpi-net-manager
Browse files Browse the repository at this point in the history
  • Loading branch information
CameronRP committed Feb 16, 2024
1 parent 52448df commit be0bd5e
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions cmd/managementd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"fmt"
"log"
"net/http"
"os/exec"
"sync"
"sync/atomic"
"time"
Expand Down Expand Up @@ -166,6 +167,10 @@ func main() {
apiRouter.Use(func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
netmanagerclient.KeepHotspotOnFor(60 * 5)
out, err := exec.Command("stay-on-for", "300").CombinedOutput() // Stops camera from going to sleep for 300 seconds
if err != nil {
log.Printf("error running stay-on-for: %s, error: %s", string(out), err)
}
next.ServeHTTP(w, r)
})
})
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
)

require (
github.com/TheCacophonyProject/rpi-net-manager v0.2.3-deb12
github.com/TheCacophonyProject/rpi-net-manager v0.3.1-deb12
github.com/TheCacophonyProject/trap-controller v0.0.0-20230227002937-262a1adfaa47
golang.org/x/text v0.3.7
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ github.com/TheCacophonyProject/modemd v0.0.0-20190605010435-ae5b0f2eb760/go.mod
github.com/TheCacophonyProject/modemd v0.0.0-20190708011609-1940f5b6677b/go.mod h1:txGgnRinv6H0/jB4n71MpuS+2qtu8tAlntIjY5udXDU=
github.com/TheCacophonyProject/periph v2.1.1-0.20200615222341-6834cd5be8c1+incompatible h1:0pEn1FoMTgOZR3EkqOTiqd0++jOS/jWlGrbvOHK0/KM=
github.com/TheCacophonyProject/periph v2.1.1-0.20200615222341-6834cd5be8c1+incompatible/go.mod h1:K1wa07sGXKzV0G9p+4R069mZk4GOpqKW8GU6/k+BrIo=
github.com/TheCacophonyProject/rpi-net-manager v0.2.3-deb12 h1:wm/90HB7zFF+Kz7bBugGyFXkYTS8fxGO2EWa6sTk6po=
github.com/TheCacophonyProject/rpi-net-manager v0.2.3-deb12/go.mod h1:6Xl1Dp7F8IyvufOv0O5EfoXQjqoA/qNLeoWh3Rv1Y0c=
github.com/TheCacophonyProject/rpi-net-manager v0.3.1-deb12 h1:8NgFktwniMrgvUruPjJpyj9Wjro/0/MpXN5/HehFpYY=
github.com/TheCacophonyProject/rpi-net-manager v0.3.1-deb12/go.mod h1:6Xl1Dp7F8IyvufOv0O5EfoXQjqoA/qNLeoWh3Rv1Y0c=
github.com/TheCacophonyProject/rtc-utils v1.2.0 h1:570sPJE/s0b21NrP9VVeSI/gBh/dLK+G5Ne/ZFwkNv0=
github.com/TheCacophonyProject/rtc-utils v1.2.0/go.mod h1:uV1SIy93TLZrrBcqDczUNFUz2G/Pk6pZNUdTRglmANU=
github.com/TheCacophonyProject/salt-updater v0.4.0 h1:2RCgdI4wr/ZoeWOvfGlZ/Epgz3GTC+Vc7/wS6EI90c0=
Expand Down
4 changes: 2 additions & 2 deletions html/wifi-networks.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ <h4 class="pt-5"><strong>Current Networks</strong></h4>
<div class="col-md-5 wifi-item" >
<div class="card mb-3">
<div class="card-body">
<h5 class="card-title"><strong>{{.SSID}}</strong></h5>
<h5 class="card-title"><strong>{{.ID}}</strong></h5>
<div class="text-right">
<button type="button" class="btn btn-primary" onclick="removeNetwork({{.SSID}})">Remove</button>
<button type="button" class="btn btn-primary" onclick="removeNetwork({{.ID}})">Remove</button>
</div>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions management-interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ func NetworkHandler(w http.ResponseWriter, r *http.Request) {
}

type wifiNetwork struct {
SSID string
ID string
NetworkID int
}

Expand All @@ -337,10 +337,10 @@ func WifiNetworkHandler(w http.ResponseWriter, r *http.Request) {
}
wifiProps.Networks = []wifiNetwork{}
for _, network := range wifiNetworks {
if network.SSID == "" || network.SSID == "bushnet" || network.SSID == "Bushnet" {
if network.ID == "" || network.ID == "bushnet" || network.ID == "Bushnet" || network.ID == "BushnetHotspot" {
continue
}
wifiProps.Networks = append(wifiProps.Networks, wifiNetwork{SSID: network.SSID})
wifiProps.Networks = append(wifiProps.Networks, wifiNetwork{ID: network.ID})
}

availableWifiNetworks, err := netmanagerclient.ScanWiFiNetworks()
Expand Down

0 comments on commit be0bd5e

Please sign in to comment.