Problem: memorybackend is a hubbackend
All checks were successful
continuous-integration/drone/push Build is passing

Solution: memorybackend has a hubbackend
This commit is contained in:
Peter Stuifzand 2021-11-10 23:15:45 +01:00
parent 531f6b31d9
commit 892a9cec72
Signed by: peter
GPG Key ID: 374322D56E5209E8
3 changed files with 4 additions and 12 deletions

View File

@ -52,20 +52,13 @@ func NewApp(options AppOptions) (*App, error) {
app.backend.Me = "https://p83.nl/"
app.backend.AuthEnabled = options.AuthEnabled
app.backend.baseURL = options.BaseURL
// FIXME: circular
app.backend.hubIncomingBackend.pool = options.pool
app.backend.hubIncomingBackend.baseURL = options.BaseURL
app.backend.hubIncomingBackend.backend = app.backend
app.hubBackend = &hubIncomingBackend{
backend: app.backend,
baseURL: options.BaseURL,
pool: options.pool,
database: options.database,
}
app.backend.hubIncomingBackend = *app.hubBackend
app.backend.hubBackend = app.hubBackend
http.Handle("/micropub", &micropubHandler{
Backend: app.backend,

View File

@ -29,7 +29,6 @@ type HubBackend interface {
}
type hubIncomingBackend struct {
backend *memoryBackend
baseURL string
pool *redis.Pool
database *sql.DB

View File

@ -40,8 +40,6 @@ func init() {
const DefaultPrio = 9999999
type memoryBackend struct {
hubIncomingBackend
lock sync.RWMutex
Channels map[string]microsub.Channel
Feeds map[string][]microsub.Feed
@ -57,6 +55,8 @@ type memoryBackend struct {
broker *sse.Broker
hubBackend HubBackend
pool *redis.Pool
database *sql.DB
@ -377,7 +377,7 @@ func (b *memoryBackend) FollowURL(uid string, url string) (microsub.Feed, error)
_ = b.ProcessContent(uid, fmt.Sprintf("%d", feedID), feed.URL, resp.Header.Get("Content-Type"), resp.Body)
_, _ = b.CreateFeed(url)
_, _ = b.hubBackend.CreateFeed(url)
return feed, nil
}