Removing cruft
This commit is contained in:
parent
2b1b57ac4d
commit
0ac955bed2
@ -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)
|
||||
*/
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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"`
|
||||
|
Loading…
x
Reference in New Issue
Block a user