aim_stub.go 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. package handlers
  2. import (
  3. "log/slog"
  4. "net/http"
  5. )
  6. // AimStubHandler serves unimplemented Web AIM /aim/* endpoints the client
  7. // calls during normal startup (client-side storage, forward-domain config).
  8. type AimStubHandler struct {
  9. Logger *slog.Logger
  10. }
  11. // SetForwardDomain acknowledges the client's forward-domain registration.
  12. // The Web AIM client fires this once when the session goes online; name may be
  13. // the literal string "null" for local/dev servers.
  14. func (h *AimStubHandler) SetForwardDomain(w http.ResponseWriter, r *http.Request) {
  15. resp := BaseResponse{}
  16. resp.Response.StatusCode = 200
  17. resp.Response.StatusText = "OK"
  18. SendResponse(w, r, resp, h.Logger)
  19. }
  20. // GetData returns empty client-side data blobs (buddy list favorites, etc.).
  21. func (h *AimStubHandler) GetData(w http.ResponseWriter, r *http.Request) {
  22. resp := BaseResponse{}
  23. resp.Response.StatusCode = 200
  24. resp.Response.StatusText = "OK"
  25. resp.Response.Data = map[string]interface{}{
  26. "items": []interface{}{},
  27. }
  28. SendResponse(w, r, resp, h.Logger)
  29. }