Skip to content

Commit

Permalink
Merge pull request #143 from anywherelan/tray-open-ui-fix
Browse files Browse the repository at this point in the history
cmd/awl-tray: improve checking for working `admin.awl` address in `Open Web UI` button
  • Loading branch information
pymq authored Oct 19, 2024
2 parents 39a37c5 + 40e4e08 commit 7f644ea
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cmd/awl-tray/main.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package main

import (
"bytes"
"context"
"fmt"
"io"
"net/http"
"os"
"os/signal"
Expand Down Expand Up @@ -166,7 +168,13 @@ func checkURL(url string) bool {
}
defer resp.Body.Close()

if resp.StatusCode >= 400 {
if resp.StatusCode != 200 {
return false
}

buf := make([]byte, 8192)
_, _ = io.ReadFull(resp.Body, buf)
if !bytes.Contains(buf, []byte("Anywherelan")) {
return false
}

Expand Down

0 comments on commit 7f644ea

Please sign in to comment.