diff --git a/.gitignore b/.gitignore deleted file mode 100644 index f1c37ad..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.task/ diff --git a/Taskfile.yml b/Taskfile.yml index 6b8852f..2b381c7 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -19,8 +19,6 @@ tasks: build: desc: Build server binary - sources: - - '**/*.go' generates: - build/lenore cmds: diff --git a/app.go b/app.go index 6390de9..c4b89ce 100644 --- a/app.go +++ b/app.go @@ -5,10 +5,10 @@ import ( "fmt" "codeberg.org/danjones000/lenore/config" - "codeberg.org/danjones000/lenore/store" vocab "github.com/go-ap/activitypub" "github.com/go-ap/client" boxap "github.com/go-ap/fedbox/activitypub" + proc "github.com/go-ap/processing" ) type App struct { @@ -16,11 +16,11 @@ type App struct { self vocab.Service user vocab.Person version string - storage store.Store + storage proc.Store client client.C } -func NewApp(ver string, conf config.Config, db store.Store) (*App, error) { +func NewApp(ver string, conf config.Config, db proc.Store) (*App, error) { if conf.BaseURL == "" { return nil, errors.New("Missing BaseURL") } @@ -49,7 +49,7 @@ func (l *App) Environment() config.Env { return l.conf.Environment() } -func (l *App) Storage() store.Store { +func (l *App) Storage() proc.Store { return l.storage } diff --git a/internal/testmocks/store.go b/internal/testmocks/store.go index a7ae185..9cdccb7 100644 --- a/internal/testmocks/store.go +++ b/internal/testmocks/store.go @@ -1,9 +1,9 @@ package testmocks import ( - "codeberg.org/danjones000/lenore/store" vocab "github.com/go-ap/activitypub" "github.com/go-ap/filters" + proc "github.com/go-ap/processing" ) type st struct{} @@ -33,9 +33,6 @@ func (s *st) RemoveFrom(col vocab.IRI, it vocab.Item) error { return nil } -func (s *st) Close() { -} - -func GetStore() store.Store { +func GetStore() proc.Store { return &st{} } diff --git a/internal/testmocks/store_meta.go b/internal/testmocks/store_meta.go deleted file mode 100644 index 316ace0..0000000 --- a/internal/testmocks/store_meta.go +++ /dev/null @@ -1,20 +0,0 @@ -package testmocks - -import ( - "crypto" - - vocab "github.com/go-ap/activitypub" - proc "github.com/go-ap/processing" -) - -func (s *st) LoadKey(vocab.IRI) (crypto.PrivateKey, error) { - return nil, nil -} - -func (s *st) LoadMetadata(vocab.IRI) (*proc.Metadata, error) { - return nil, nil -} - -func (s *st) SaveMetadata(proc.Metadata, vocab.IRI) error { - return nil -} diff --git a/internal/testmocks/store_osin_auth.go b/internal/testmocks/store_osin_auth.go deleted file mode 100644 index a266cb1..0000000 --- a/internal/testmocks/store_osin_auth.go +++ /dev/null @@ -1,37 +0,0 @@ -package testmocks - -import ( - "github.com/openshift/osin" -) - -func (s *st) LoadAccess(string) (*osin.AccessData, error) { - return nil, nil -} - -func (s *st) SaveAccess(*osin.AccessData) error { - return nil -} - -func (s *st) RemoveAccess(string) error { - return nil -} - -func (s *st) LoadAuthorize(string) (*osin.AuthorizeData, error) { - return nil, nil -} - -func (s *st) SaveAuthorize(*osin.AuthorizeData) error { - return nil -} - -func (s *st) RemoveAuthorize(string) error { - return nil -} - -func (s *st) LoadRefresh(string) (*osin.AccessData, error) { - return nil, nil -} - -func (s *st) RemoveRefresh(string) error { - return nil -} diff --git a/internal/testmocks/store_osin_client.go b/internal/testmocks/store_osin_client.go deleted file mode 100644 index 980379d..0000000 --- a/internal/testmocks/store_osin_client.go +++ /dev/null @@ -1,30 +0,0 @@ -package testmocks - -import ( - "github.com/openshift/osin" -) - -func (s *st) Clone() osin.Storage { - n := *s - return &n -} - -func (s *st) GetClient(string) (osin.Client, error) { - return &osin.DefaultClient{}, nil -} - -func (s *st) CreateClient(osin.Client) error { - return nil -} - -func (s *st) UpdateClient(osin.Client) error { - return nil -} - -func (s *st) RemoveClient(string) error { - return nil -} - -func (s *st) ListClients() (cl []osin.Client, er error) { - return -} diff --git a/store/store.go b/store/store.go deleted file mode 100644 index 6b5336b..0000000 --- a/store/store.go +++ /dev/null @@ -1,31 +0,0 @@ -package store - -import ( - st "github.com/go-ap/fedbox/storage" - proc "github.com/go-ap/processing" - "github.com/openshift/osin" -) - -type ClientSaver interface { - // UpdateClient updates the client (identified by it's id) and replaces the values with the values of client. - UpdateClient(c osin.Client) error - // CreateClient stores the client in the database and returns an error, if something went wrong. - CreateClient(c osin.Client) error - // RemoveClient removes a client (identified by id) from the database. Returns an error if something went wrong. - RemoveClient(id string) error -} - -type ClientLister interface { - // ListClients lists existing clients - ListClients() ([]osin.Client, error) - GetClient(id string) (osin.Client, error) -} - -type Store interface { - ClientSaver - ClientLister - proc.Store - proc.KeyLoader - osin.Storage - st.MetadataTyper -}