From d80afd8a49f552c5dc51d8346d40809298fef11f Mon Sep 17 00:00:00 2001 From: KushBlazingJudah <59340248+KushBlazingJudah@users.noreply.github.com> Date: Tue, 2 Nov 2021 15:06:42 -0300 Subject: db package now compiles without error for now --- main.go | 96 ----------------------------------------------------------------- 1 file changed, 96 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index c056f38..b659fd4 100644 --- a/main.go +++ b/main.go @@ -525,81 +525,6 @@ func ParseCommentForReplies(db *sql.DB, comment string, op string) []ObjectBase return validLinks } -func CheckValidActivity(id string) (Collection, bool) { - var respCollection Collection - - re := regexp.MustCompile(`.+\.onion(.+)?`) - if re.MatchString(id) { - id = strings.Replace(id, "https", "http", 1) - } - - req, err := http.NewRequest("GET", id, nil) - - if err != nil { - fmt.Println("error with request") - } - - req.Header.Set("Accept", activitystreams) - - resp, err := RouteProxy(req) - - if err != nil { - fmt.Println("error with response") - return respCollection, false - } - - defer resp.Body.Close() - - body, _ := ioutil.ReadAll(resp.Body) - - err = json.Unmarshal(body, &respCollection) - - if err != nil { - panic(err) - } - - if respCollection.AtContext.Context == "https://www.w3.org/ns/activitystreams" && respCollection.OrderedItems[0].Id != "" { - return respCollection, true - } - - return respCollection, false -} - -func GetActorCollection(collection string) activitypub.Collection { - var nCollection activitypub.Collection - - if collection == "" { - return nCollection - } - - req, err := http.NewRequest("GET", collection, nil) - - CheckError(err, "error with getting actor collection req "+collection) - - req.Header.Set("Accept", activitystreams) - - resp, err := RouteProxy(req) - - if err != nil { - fmt.Println("error with getting actor collection resp " + collection) - return nCollection - } - - defer resp.Body.Close() - - if resp.StatusCode == 200 { - body, _ := ioutil.ReadAll(resp.Body) - - if len(body) > 0 { - err = json.Unmarshal(body, &nCollection) - - CheckError(err, "error getting actor collection from body "+collection) - } - } - - return nCollection -} - func IsValidActor(id string) (Actor, bool) { actor := FingerActor(id) @@ -1100,27 +1025,6 @@ func AddInstanceToIndexDB(db *sql.DB, actor string) { } } -func GetCollectionFromReq(path string) Collection { - req, err := http.NewRequest("GET", path, nil) - CheckError(err, "error with getting collection from req") - - req.Header.Set("Accept", activitystreams) - - resp, err := RouteProxy(req) - - CheckError(err, "error getting resp from collection req") - - defer resp.Body.Close() - - body, _ := ioutil.ReadAll(resp.Body) - - var respCollection Collection - - _ = json.Unmarshal(body, &respCollection) - - return respCollection -} - func HashMedia(media string) string { h := sha256.New() h.Write([]byte(media)) -- cgit v1.2.3