expose federated event cursor transport
This commit is contained in:
@@ -362,6 +362,14 @@ func main() {
|
|||||||
w.WriteHeader(http.StatusCreated)
|
w.WriteHeader(http.StatusCreated)
|
||||||
json.NewEncoder(w).Encode(worker)
|
json.NewEncoder(w).Encode(worker)
|
||||||
})
|
})
|
||||||
|
mux.HandleFunc("/v1/federation/events", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
if r.Method != http.MethodGet {
|
||||||
|
http.Error(w, "method not allowed", 405)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
cursor, _ := strconv.ParseUint(r.URL.Query().Get("since"), 10, 64)
|
||||||
|
json.NewEncoder(w).Encode(s.Events(cursor))
|
||||||
|
})
|
||||||
mux.HandleFunc("/v1/federation/workers/", func(w http.ResponseWriter, r *http.Request) {
|
mux.HandleFunc("/v1/federation/workers/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
if r.Method != http.MethodPost || !strings.HasSuffix(r.URL.Path, "/heartbeat") {
|
if r.Method != http.MethodPost || !strings.HasSuffix(r.URL.Path, "/heartbeat") {
|
||||||
http.Error(w, "not found", 404)
|
http.Error(w, "not found", 404)
|
||||||
|
|||||||
Reference in New Issue
Block a user