Re-enable CreateFeed for WebSub
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Peter Stuifzand 2021-10-31 15:04:26 +01:00
parent 3a43844e93
commit 21c226ce56
Signed by: peter
GPG Key ID: 374322D56E5209E8
2 changed files with 5 additions and 2 deletions

View File

@ -66,6 +66,7 @@ func (h *hubIncomingBackend) GetSecret(id int64) string {
}
func (h *hubIncomingBackend) CreateFeed(topic string) (int64, error) {
log.Println("CreateFeed", topic)
db := h.backend.database
secret := util.RandStringBytes(32)
@ -112,6 +113,8 @@ VALUES ($1, $2, $3, $4, DEFAULT) RETURNING "id"`, topic, secret, urlSecret, 60*6
}
func (h *hubIncomingBackend) UpdateFeed(subscriptionID int64, contentType string, body io.Reader) error {
log.Println("UpdateFeed", subscriptionID)
db := h.backend.database
var (
topic string
@ -186,6 +189,7 @@ func (h *hubIncomingBackend) Feeds() ([]Feed, error) {
}
func (h *hubIncomingBackend) Subscribe(feed *Feed) error {
log.Println("Subscribe", feed.URL)
client := http.Client{}
return websub.Subscribe(&client, feed.Hub, feed.URL, feed.Callback, feed.Secret, LeaseSeconds)
}

View File

@ -341,8 +341,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)
// FIXME: re-enable CreateFeed
// _, _ = b.CreateFeed(url, uid)
_, _ = b.CreateFeed(url)
return feed, nil
}