Skip to content

Commit

Permalink
checkout to main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
PichuChen committed Jul 30, 2024
1 parent fc923a6 commit 3359750
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions datastore/object/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ import (
"log/slog"
"math/big"
"os"
"strings"
"sync"
"time"

"github.com/pichuchen/hatsuaki/datastore/config"
)

type Object map[string]interface{}
Expand Down Expand Up @@ -67,9 +70,13 @@ func SaveObject(filepath string) error {
}

func FindObjectByID(id string) (*Object, error) {
domainPrefix := "https://" + config.GetDomain() + "/.activitypub/object/"
id = strings.TrimPrefix(id, domainPrefix)

if v, ok := datastore.Load(id); ok {
return v.(*Object), nil
}

return nil, fmt.Errorf("object not found")
}

Expand Down

0 comments on commit 3359750

Please sign in to comment.