Compare commits
No commits in common. "bdc625b57e44431196f10ee6e76c571a4e3a5974" and "33f140595cc78c631ed7d4d906a4c7ad485627d0" have entirely different histories.
bdc625b57e
...
33f140595c
8 changed files with 6 additions and 130 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1 +0,0 @@
|
||||||
.task/
|
|
||||||
|
|
@ -19,8 +19,6 @@ tasks:
|
||||||
|
|
||||||
build:
|
build:
|
||||||
desc: Build server binary
|
desc: Build server binary
|
||||||
sources:
|
|
||||||
- '**/*.go'
|
|
||||||
generates:
|
generates:
|
||||||
- build/lenore
|
- build/lenore
|
||||||
cmds:
|
cmds:
|
||||||
|
|
|
||||||
8
app.go
8
app.go
|
|
@ -5,10 +5,10 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"codeberg.org/danjones000/lenore/config"
|
"codeberg.org/danjones000/lenore/config"
|
||||||
"codeberg.org/danjones000/lenore/store"
|
|
||||||
vocab "github.com/go-ap/activitypub"
|
vocab "github.com/go-ap/activitypub"
|
||||||
"github.com/go-ap/client"
|
"github.com/go-ap/client"
|
||||||
boxap "github.com/go-ap/fedbox/activitypub"
|
boxap "github.com/go-ap/fedbox/activitypub"
|
||||||
|
proc "github.com/go-ap/processing"
|
||||||
)
|
)
|
||||||
|
|
||||||
type App struct {
|
type App struct {
|
||||||
|
|
@ -16,11 +16,11 @@ type App struct {
|
||||||
self vocab.Service
|
self vocab.Service
|
||||||
user vocab.Person
|
user vocab.Person
|
||||||
version string
|
version string
|
||||||
storage store.Store
|
storage proc.Store
|
||||||
client client.C
|
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 == "" {
|
if conf.BaseURL == "" {
|
||||||
return nil, errors.New("Missing BaseURL")
|
return nil, errors.New("Missing BaseURL")
|
||||||
}
|
}
|
||||||
|
|
@ -49,7 +49,7 @@ func (l *App) Environment() config.Env {
|
||||||
return l.conf.Environment()
|
return l.conf.Environment()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *App) Storage() store.Store {
|
func (l *App) Storage() proc.Store {
|
||||||
return l.storage
|
return l.storage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
package testmocks
|
package testmocks
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"codeberg.org/danjones000/lenore/store"
|
|
||||||
vocab "github.com/go-ap/activitypub"
|
vocab "github.com/go-ap/activitypub"
|
||||||
"github.com/go-ap/filters"
|
"github.com/go-ap/filters"
|
||||||
|
proc "github.com/go-ap/processing"
|
||||||
)
|
)
|
||||||
|
|
||||||
type st struct{}
|
type st struct{}
|
||||||
|
|
@ -33,9 +33,6 @@ func (s *st) RemoveFrom(col vocab.IRI, it vocab.Item) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *st) Close() {
|
func GetStore() proc.Store {
|
||||||
}
|
|
||||||
|
|
||||||
func GetStore() store.Store {
|
|
||||||
return &st{}
|
return &st{}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
|
||||||
}
|
|
||||||
|
|
@ -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
|
|
||||||
}
|
|
||||||
|
|
@ -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
|
|
||||||
}
|
|
||||||
|
|
@ -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
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue