|
|
|
|
@ -2,7 +2,6 @@ package controllers
@@ -2,7 +2,6 @@ package controllers
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
|
"net/http" |
|
|
|
|
"strings" |
|
|
|
|
|
|
|
|
|
log "github.com/sirupsen/logrus" |
|
|
|
|
|
|
|
|
|
@ -10,6 +9,7 @@ import (
@@ -10,6 +9,7 @@ import (
|
|
|
|
|
"github.com/owncast/owncast/activitypub/crypto" |
|
|
|
|
"github.com/owncast/owncast/activitypub/requests" |
|
|
|
|
"github.com/owncast/owncast/core/data" |
|
|
|
|
"github.com/owncast/owncast/utils" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
// ActorHandler handles requests for a single actor.
|
|
|
|
|
@ -19,8 +19,12 @@ func ActorHandler(w http.ResponseWriter, r *http.Request) {
@@ -19,8 +19,12 @@ func ActorHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pathComponents := strings.Split(r.URL.Path, "/") |
|
|
|
|
accountName := pathComponents[3] |
|
|
|
|
accountName, err := utils.ReadRestURLParameter(r, "user") |
|
|
|
|
if err != nil || accountName == "" { |
|
|
|
|
w.WriteHeader(http.StatusBadRequest) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
resource, _ := utils.ReadRestURLParameter(r, "resource") |
|
|
|
|
|
|
|
|
|
if _, valid := data.GetFederatedInboxMap()[accountName]; !valid { |
|
|
|
|
// User is not valid
|
|
|
|
|
@ -30,20 +34,17 @@ func ActorHandler(w http.ResponseWriter, r *http.Request) {
@@ -30,20 +34,17 @@ func ActorHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
|
|
|
|
|
// If this request is for an actor's inbox then pass
|
|
|
|
|
// the request to the inbox controller.
|
|
|
|
|
if len(pathComponents) == 5 && pathComponents[4] == "inbox" { |
|
|
|
|
if resource == "inbox" { |
|
|
|
|
InboxHandler(w, r) |
|
|
|
|
return |
|
|
|
|
} else if len(pathComponents) == 5 && pathComponents[4] == "outbox" { |
|
|
|
|
} else if resource == "outbox" { |
|
|
|
|
OutboxHandler(w, r) |
|
|
|
|
return |
|
|
|
|
// } else if len(pathComponents) == 5 {
|
|
|
|
|
// ActorObjectHandler(w, r)
|
|
|
|
|
// return
|
|
|
|
|
} else if len(pathComponents) == 5 && pathComponents[4] == "followers" { |
|
|
|
|
} else if resource == "followers" { |
|
|
|
|
// followers list
|
|
|
|
|
FollowersHandler(w, r) |
|
|
|
|
return |
|
|
|
|
} else if len(pathComponents) == 5 && pathComponents[4] == "following" { |
|
|
|
|
} else if resource == "following" { |
|
|
|
|
// following list (none)
|
|
|
|
|
w.WriteHeader(http.StatusNotFound) |
|
|
|
|
return |
|
|
|
|
|