From 0ac955bed2874b64ca2447f3b297750724a3c019 Mon Sep 17 00:00:00 2001 From: Farhan Khan Date: Wed, 2 Mar 2022 00:32:50 +0000 Subject: [PATCH] Removing cruft --- fedilogue/follow.go | 56 --------------------------------------------- fedilogue/poll.go | 3 --- fedilogue/web.go | 8 ------- 3 files changed, 67 deletions(-) diff --git a/fedilogue/follow.go b/fedilogue/follow.go index 9593fa9..f3a462a 100644 --- a/fedilogue/follow.go +++ b/fedilogue/follow.go @@ -82,60 +82,4 @@ func followInbox(inboxurl string) { } defer res.Body.Close() - // body, err := ioutil.ReadAll(res.Body) - // fmt.Printf("Body : %s", body) - - /* - matchset := re.FindStringSubmatch(targetInbox) - if matchset == nil { - return - } - inboxHost := matchset[1] - keyBytes, err := ioutil.ReadFile("keys/private.pem") - if err != nil { - log.Fatal(err) - } - - pemBlock, _ := pem.Decode(keyBytes) - if pemBlock == nil { - log.Fatal("Invalid PEM format") - } - - privateKey, err := x509.ParsePKCS1PrivateKey(pemBlock.Bytes) - if err != nil { - log.Fatal(err) - } - - //var jsonBytes []byte - jsonRequest := "{}" - jsonBytes := []byte(jsonRequest) - payload := bytes.NewReader(jsonBytes) - - prefs := []httpsig.Algorithm{httpsig.RSA_SHA256} - digestAlgorithm := httpsig.DigestSha256 - headers := []string{httpsig.RequestTarget, "date", "host"} - signer, _, err := httpsig.NewSigner(prefs, digestAlgorithm, headers, httpsig.Signature, 0) - if err != nil { - log.Fatal(err.Error()) - } - - req, err := http.NewRequest("POST", targetInbox, payload) - if err != nil { - log.Fatal(err.Error()) - } - if payload != nil { - req.Header.Add("content-type", "application/json") - } - req.Header.Add("date", time.Now().UTC().Format(http.TimeFormat)) - req.Header.Add("host", inboxHost) - - keyID := "https://" + settings.Hostname + "/relay#mainkey" - - err = signer.SignRequest(privateKey, keyID, req, jsonBytes) - if err != nil { - log.Fatal(err.Error()) - } - - fmt.Println(req) - */ } diff --git a/fedilogue/poll.go b/fedilogue/poll.go index 57a7750..446dd31 100644 --- a/fedilogue/poll.go +++ b/fedilogue/poll.go @@ -35,9 +35,6 @@ type UserInfo struct { Url string `"json:Url"` Icon ImageData `"json:icon"` Image ImageData `"json:image"` - - // ManuallyApprovesFollowers string `"json:manuallyApprovesFollowers"` - // Discoverable bool `"json:discoverable"` } type PostInfo struct { diff --git a/fedilogue/web.go b/fedilogue/web.go index 6b374bb..cf2d028 100644 --- a/fedilogue/web.go +++ b/fedilogue/web.go @@ -1,17 +1,13 @@ package main import ( - // "crypto/sha1" "encoding/json" "fmt" - - // "html" "io/ioutil" "log" "net/http" "os" "strings" - // "time" ) // CreateObject - Used by post web receiver @@ -33,10 +29,6 @@ type AnnounceObject struct { Object string `json:"object"` } -/* -{"@context": "https://www.w3.org/ns/activitystreams", "type": "Announce", "to": ["https://relay.101010.pl/followers"], "actor": "https://relay.101010.pl/actor", "object": "https://social.tchncs.de/users/keara/statuses/107594176486878867", "id": "https://relay.101010.pl/activities/7666bbe3-4448-4d99-919c-a618e0a912e9"} -*/ - // RelayBase - The base object used by web receiver type RelayBase struct { Actor string `json:"actor"`