Skip to content

Commit

Permalink
Hook more C2S ActivityPub together
Browse files Browse the repository at this point in the history
  • Loading branch information
cjslep committed Jun 15, 2019
1 parent cf180b3 commit 2f2fbc3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
12 changes: 9 additions & 3 deletions ap_c2s.go
Expand Up @@ -18,6 +18,7 @@ package apcore

import (
"context"
"fmt"
"net/http"

"github.com/go-fed/activity/pub"
Expand All @@ -41,11 +42,16 @@ func (s *socialBehavior) AuthenticatePostOutbox(c context.Context, w http.Respon
}

func (s *socialBehavior) Callbacks(c context.Context) (wrapped pub.SocialWrappedCallbacks, other []interface{}, err error) {
// TODO
wrapped = pub.SocialWrappedCallbacks{}
// TODO: Others from Application
return
}

func (s *socialBehavior) DefaultCallback(c context.Context, activity pub.Activity) error {
// TODO
return nil
ctx := ctx{c}
t, err := ctx.ActivityType()
if err != nil {
return err
}
return fmt.Errorf("Unhandled client Activity of type: %s", t)
}
7 changes: 6 additions & 1 deletion ap_common.go
Expand Up @@ -48,7 +48,12 @@ func (a *commonBehavior) AuthenticateGetOutbox(c context.Context, w http.Respons
}

func (a *commonBehavior) GetOutbox(c context.Context, r *http.Request) (ocp vocab.ActivityStreamsOrderedCollectionPage, err error) {
// TODO
ctx := ctx{c}
var outboxIRI *url.URL
if outboxIRI, err = ctx.CompleteRequestURL(); err != nil {
return
}
ocp, err = a.db.GetOutbox(c, outboxIRI)
return
}

Expand Down
1 change: 1 addition & 0 deletions ap_s2s.go
Expand Up @@ -84,6 +84,7 @@ func (f *federatingBehavior) Callbacks(c context.Context) (wrapped pub.Federatin
wrapped = pub.FederatingWrappedCallbacks{
OnFollow: u.OnFollow(),
}
// TODO: Others from Application.
return
}

Expand Down

0 comments on commit 2f2fbc3

Please sign in to comment.