Reconnect the app's command channel after sleep; list clients from it
This commit is contained in:
@@ -10,17 +10,15 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/coder/websocket"
|
||||
|
||||
"g.fc.run/misc/byre/internal/clients"
|
||||
)
|
||||
|
||||
func (s *Server) ConnectClient(w http.ResponseWriter, r *http.Request) {
|
||||
id := r.Header.Get("Byre-Client")
|
||||
host := r.Header.Get("Byre-Host")
|
||||
if host == "" {
|
||||
writeError(w, http.StatusBadRequest, errors.New("missing Byre-Host"))
|
||||
if id == "" || host == "" {
|
||||
writeError(w, http.StatusBadRequest, errors.New("missing Byre-Client or Byre-Host"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -31,12 +29,7 @@ func (s *Server) ConnectClient(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
defer ws.CloseNow()
|
||||
|
||||
s.clients.Serve(r.Context(), ws, clients.Client{
|
||||
Login: actor(r),
|
||||
Host: host,
|
||||
Commit: r.Header.Get("Byre-Commit"),
|
||||
ConnectedAt: time.Now().UTC(),
|
||||
})
|
||||
s.clients.Serve(r.Context(), ws, id, actor(r), host, r.Header.Get("Byre-Commit"))
|
||||
}
|
||||
|
||||
func (s *Server) GetClientTransfer(w http.ResponseWriter, r *http.Request, transferID string) {
|
||||
|
||||
Reference in New Issue
Block a user