From da7663c2e6dd99eb86f3ea90d3950a4abd598ce2 Mon Sep 17 00:00:00 2001 From: Michael Demetriou Date: Sat, 14 Sep 2019 11:25:52 +0300 Subject: [PATCH] Make activityserve a free-standing library ready to "go get" it --- activityserve/actor.go => actor.go | 2 +- config.ini | 5 -- activityserve/http.go => http.go | 0 main.go | 65 ------------------- .../remoteActor.go => remoteActor.go | 0 activityserve/setup.go => setup.go | 0 activityserve/snips.md => snips.md | 0 activityserve/util.go => util.go | 0 8 files changed, 1 insertion(+), 71 deletions(-) rename activityserve/actor.go => actor.go (99%) delete mode 100644 config.ini rename activityserve/http.go => http.go (100%) delete mode 100644 main.go rename activityserve/remoteActor.go => remoteActor.go (100%) rename activityserve/setup.go => setup.go (100%) rename activityserve/snips.md => snips.md (100%) rename activityserve/util.go => util.go (100%) diff --git a/activityserve/actor.go b/actor.go similarity index 99% rename from activityserve/actor.go rename to actor.go index d7191b4..196f52a 100644 --- a/activityserve/actor.go +++ b/actor.go @@ -624,7 +624,7 @@ func (a *Actor) Unfollow(user string){ if _, ok := a.following[user]; ok { PrettyPrint(undo) go func() { - err := a.signedHTTPPost(remoteUser.inbox, undo) + err := a.signedHTTPPost(undo, remoteUser.inbox) if err != nil { log.Info("Couldn't unfollow " + user) log.Info(err) diff --git a/config.ini b/config.ini deleted file mode 100644 index 377292d..0000000 --- a/config.ini +++ /dev/null @@ -1,5 +0,0 @@ -[general] - -baseURL = https://floorb.qwazix.com -storage = storage ; can be relative or absolute path -userAgent = "pherephone" \ No newline at end of file diff --git a/activityserve/http.go b/http.go similarity index 100% rename from activityserve/http.go rename to http.go diff --git a/main.go b/main.go deleted file mode 100644 index 9580a62..0000000 --- a/main.go +++ /dev/null @@ -1,65 +0,0 @@ -package main - -import ( - "flag" - "fmt" - - // "os" - // "strings" - - // "errors" - - // "encoding/json" - // "io/ioutil" - // "net/http" - - // "net/url" - // "context" - // "html" - - "github.com/gologme/log" - - // "github.com/go-fed/activity/streams" - // "github.com/gorilla/mux" - // "gopkg.in/ini.v1" - // "github.com/davecgh/go-spew/spew" - - "./activityserve" -) - -var err error - -func main() { - - // This is here for debugging purposes. I want to be able to easily spot in the terminal - // when a single execution starts - fmt.Println() - fmt.Println("======================= PHeRePHoNe ==========================") - - // introduce ourselves - fmt.Println() - fmt.Println("Pherephone follows some accounts and boosts") - fmt.Println("whatever they post to our followers. See config.ini ") - fmt.Println("for more information and how to set up. ") - - debugFlag := flag.Bool("debug", false, "set to true to get debugging information in the console") - flag.Parse() - - if *debugFlag == true { - log.EnableLevel("info") - log.EnableLevel("error") - } - - activityserve.Setup("config.ini", *debugFlag) - - // actor, _ := activityserve.MakeActor("activityserve_test_actor_2", "This is an activityserve test actor", "Service") - // actor, _ := activityserve.LoadActor("activityserve_test_actor_2") - // actor.Follow("https://cybre.space/users/tzo") - // actor.CreateNote("Hello World!") - - actor, _ := - activityserve.LoadActor("activityserve_test_actor_2") - actor.CreateNote("I'm building #ActivityPub stuff") - - activityserve.Serve() -} diff --git a/activityserve/remoteActor.go b/remoteActor.go similarity index 100% rename from activityserve/remoteActor.go rename to remoteActor.go diff --git a/activityserve/setup.go b/setup.go similarity index 100% rename from activityserve/setup.go rename to setup.go diff --git a/activityserve/snips.md b/snips.md similarity index 100% rename from activityserve/snips.md rename to snips.md diff --git a/activityserve/util.go b/util.go similarity index 100% rename from activityserve/util.go rename to util.go