Terminal: Ctrl+C copies a selection (else ^C), Ctrl+V pastes, over http too; drop Log out everywhere
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
d7ed4d8549
commit
d3f2a83249
@@ -107,7 +107,6 @@ func New(cfg *config.Config, sessions *auth.Sessions, mgr *term.Manager, col *me
|
||||
m.HandleFunc("POST /api/machines/{name}/update", s.auth(s.updateMachine))
|
||||
m.HandleFunc("POST /api/machines-update-all", s.auth(s.updateAllMachines))
|
||||
m.HandleFunc("POST /api/logout", s.auth(s.logout))
|
||||
m.HandleFunc("POST /api/logout/all", s.auth(s.logoutAll))
|
||||
m.HandleFunc("GET /api/me", s.auth(s.me))
|
||||
m.HandleFunc("GET /api/terminals", s.auth(s.listTerminals))
|
||||
m.HandleFunc("POST /api/terminals", s.auth(s.createTerminal))
|
||||
@@ -709,15 +708,6 @@ func (s *Server) logout(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(204)
|
||||
}
|
||||
|
||||
// logoutAll ends every session, this one included: a lost phone, a borrowed laptop.
|
||||
// Tokens are not sessions and are untouched; revoke those by name.
|
||||
func (s *Server) logoutAll(w http.ResponseWriter, r *http.Request) {
|
||||
n := s.sessions.DeleteAll()
|
||||
log.Printf("all %d session(s) ended (from %s)", n, clientIP(r))
|
||||
s.setCookie(w, r, "", -1)
|
||||
jsonOK(w, 200, map[string]int{"ended": n})
|
||||
}
|
||||
|
||||
// clientKey is the address the limiter buckets by: the first X-Forwarded-For hop when a
|
||||
// reverse proxy set it, else the socket peer.
|
||||
func clientKey(r *http.Request) string {
|
||||
|
||||
@@ -146,15 +146,6 @@ func (s *Sessions) Valid(tok string) bool {
|
||||
return ok
|
||||
}
|
||||
|
||||
// DeleteAll ends every session on every device and says how many there were.
|
||||
func (s *Sessions) DeleteAll() (n int) {
|
||||
_ = s.st.Update(func(state *store.State) {
|
||||
n = len(state.Sessions)
|
||||
state.Sessions = map[string]time.Time{}
|
||||
})
|
||||
return n
|
||||
}
|
||||
|
||||
func (s *Sessions) Delete(tok string) {
|
||||
_ = s.st.Update(func(state *store.State) { delete(state.Sessions, tok) })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user