Skip to content

Commit 0a37c05

Browse files
committed
fix(feeds): remove references to digest_interval
1 parent d32eeb3 commit 0a37c05

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Create a blogs.txt file:
9595

9696
```
9797
98-
=: digest_interval 1day
98+
=: cron 0 13 * * *
9999
=> https://pico.prose.sh/rss
100100
=> https://erock.prose.sh/rss
101101
```

pkg/apps/auth/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ func AddPlusFeedForUser(dbpool db.DB, userID, email string) error {
542542

543543
href := fmt.Sprintf("https://auth.pico.sh/rss/%s", token)
544544
text := fmt.Sprintf(`=: email %s
545-
=: digest_interval 10min
545+
=: cron */10 * * * *
546546
=: inline_content true
547547
=> %s
548548
=> https://blog.pico.sh/rss`, email, href)

pkg/apps/auth/api_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func TestPaymentWebhook(t *testing.T) {
6262
continue
6363
}
6464
expectedText := `=: email [email protected]
65-
=: digest_interval 10min
65+
=: cron */10 * * * *
6666
=: inline_content true
6767
=> https://auth.pico.sh/rss/123
6868
=> https://blog.pico.sh/rss`

pkg/apps/feeds/cron.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func DateToMin(now time.Time) time.Time {
154154
)
155155
}
156156

157-
func (f *Fetcher) Validate(post *db.Post, parsed *shared.ListParsedText, now time.Time) error {
157+
func (f *Fetcher) Validate(logger *slog.Logger, post *db.Post, parsed *shared.ListParsedText, now time.Time) error {
158158
expiresAt := post.ExpiresAt
159159
if expiresAt != nil {
160160
if post.ExpiresAt.Before(now) {
@@ -167,6 +167,7 @@ func (f *Fetcher) Validate(post *db.Post, parsed *shared.ListParsedText, now tim
167167
if parsed.DigestInterval != "" {
168168
cron = DigestIntervalToCron(parsed.DigestInterval)
169169
}
170+
logger.Info("found cron", "cron", cron)
170171

171172
if !f.gron.IsValid(cron) {
172173
return fmt.Errorf("(%s) is invalid `cron`, skipping", cron)
@@ -202,8 +203,8 @@ func (f *Fetcher) RunPost(logger *slog.Logger, user *db.User, post *db.Post, ski
202203
}
203204
}
204205

205-
logger.Info("last digest", "timestamp", post.Data.LastDigest.Format(time.RFC3339))
206-
err := f.Validate(post, parsed, now)
206+
logger.Info("last digest", "at", post.Data.LastDigest.Format(time.RFC3339))
207+
err := f.Validate(logger, post, parsed, now)
207208
if err != nil {
208209
logger.Info("validation failed", "err", err)
209210
if skipValidation {

0 commit comments

Comments
 (0)