Make activityserve a free-standing library ready to "go get" it

This commit is contained in:
Michael Demetriou 2019-09-14 11:25:52 +03:00
parent 0979f847e9
commit da7663c2e6
8 changed files with 1 additions and 71 deletions

View file

@ -624,7 +624,7 @@ func (a *Actor) Unfollow(user string){
if _, ok := a.following[user]; ok { if _, ok := a.following[user]; ok {
PrettyPrint(undo) PrettyPrint(undo)
go func() { go func() {
err := a.signedHTTPPost(remoteUser.inbox, undo) err := a.signedHTTPPost(undo, remoteUser.inbox)
if err != nil { if err != nil {
log.Info("Couldn't unfollow " + user) log.Info("Couldn't unfollow " + user)
log.Info(err) log.Info(err)

View file

@ -1,5 +0,0 @@
[general]
baseURL = https://floorb.qwazix.com
storage = storage ; can be relative or absolute path
userAgent = "pherephone"

65
main.go
View file

@ -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()
}