- commit
- 2c02fb4
- parent
- 190b37f
- author
- Eric Bower
- date
- 2026-01-08 10:23:53 -0500 EST
chore(feeds): add deprecation notice for free pico users
4 files changed,
+41,
-6
+10,
-1
1@@ -159,7 +159,16 @@ func Middleware(dbpool db.DB, cfg *shared.ConfigSite) pssh.SSHServerMiddleware {
2 _, _ = fmt.Fprintf(sesh, "running feed post: %s\r\n", filename)
3 logger.Info("run cmd", "filename", filename)
4 fetcher := NewFetcher(dbpool, cfg)
5- err = fetcher.RunPost(logger, user, post, true, time.Now().UTC())
6+
7+ isPicoPlus := false
8+ ff, _ := dbpool.FindFeature(user.ID, "plus")
9+ if ff != nil {
10+ if ff.IsValid() {
11+ isPicoPlus = true
12+ }
13+ }
14+
15+ err = fetcher.RunPost(logger, user, isPicoPlus, post, true, time.Now().UTC())
16 if err != nil {
17 _, _ = fmt.Fprintln(sesh.Stderr(), err)
18 }
+13,
-4
1@@ -70,6 +70,7 @@ type DigestFeed struct {
2 DaysLeft string
3 ShowBanner bool
4 SizeWarning bool
5+ IsPicoPlus bool
6 }
7
8 type DigestOptions struct {
9@@ -195,7 +196,7 @@ func (f *Fetcher) Validate(logger *slog.Logger, post *db.Post, parsed *shared.Li
10 return nil
11 }
12
13-func (f *Fetcher) RunPost(logger *slog.Logger, user *db.User, post *db.Post, skipValidation bool, now time.Time) error {
14+func (f *Fetcher) RunPost(logger *slog.Logger, user *db.User, isPicoPlus bool, post *db.Post, skipValidation bool, now time.Time) error {
15 logger = logger.With("filename", post.Filename)
16 logger.Info("running feed post")
17
18@@ -260,7 +261,7 @@ func (f *Fetcher) RunPost(logger *slog.Logger, user *db.User, post *db.Post, ski
19 subject := fmt.Sprintf("%s feed digest", post.Filename)
20 unsubURL := getUnsubURL(post)
21
22- msgBody, err := f.FetchAll(logger, urls, parsed.InlineContent, user.Name, post)
23+ msgBody, err := f.FetchAll(logger, urls, parsed.InlineContent, user.Name, isPicoPlus, post)
24 if err != nil {
25 errForUser := err
26
27@@ -336,13 +337,20 @@ func (f *Fetcher) RunUser(user *db.User, now time.Time) error {
28 if err != nil {
29 return err
30 }
31+ isPicoPlus := false
32+ ff, _ := f.db.FindFeature(user.ID, "plus")
33+ if ff != nil {
34+ if ff.IsValid() {
35+ isPicoPlus = true
36+ }
37+ }
38
39 if len(posts.Data) > 0 {
40 logger.Info("found feed posts", "len", len(posts.Data))
41 }
42
43 for _, post := range posts.Data {
44- err = f.RunPost(logger, user, post, false, now)
45+ err = f.RunPost(logger, user, isPicoPlus, post, false, now)
46 if err != nil {
47 logger.Error("run post failed", "err", err)
48 }
49@@ -471,7 +479,7 @@ func getUnsubURL(post *db.Post) string {
50 return fmt.Sprintf("https://feeds.pico.sh/unsub/%s", post.ID)
51 }
52
53-func (f *Fetcher) FetchAll(logger *slog.Logger, urls []string, inlineContent bool, username string, post *db.Post) (*MsgBody, error) {
54+func (f *Fetcher) FetchAll(logger *slog.Logger, urls []string, inlineContent bool, username string, isPicoPlus bool, post *db.Post) (*MsgBody, error) {
55 logger.Info("fetching feeds", "inlineContent", inlineContent)
56 fp := gofeed.NewParser()
57 daysLeft := ""
58@@ -490,6 +498,7 @@ func (f *Fetcher) FetchAll(logger *slog.Logger, urls []string, inlineContent boo
59 DaysLeft: daysLeft,
60 ShowBanner: showBanner,
61 Options: DigestOptions{InlineContent: inlineContent},
62+ IsPicoPlus: isPicoPlus,
63 }
64 feedItems, err := f.db.FindFeedItemsByPostID(post.ID)
65 if err != nil {
+12,
-1
1@@ -9,11 +9,21 @@ img {
2 }
3 </style>
4
5+{{if .IsPicoPlus}}
6+{{else}}
7+<blockquote>
8+ <strong>NOTICE:</strong> Our email digest service is moving to our paid <strong>pico+</strong> plan on <strong>2026-01-22</strong> at which point we will stop sending you email digests.
9+ <a href="https://blog.pico.sh/ann-033-moving-rss-to-email-pico-plus">read out annoucement</a>.
10+</blockquote>
11+<br />
12+{{end}}
13+
14 {{if .SizeWarning}}
15 <blockquote>
16- <strong>NOTICE:</strong> This email is over the size limit (5MB). Inline content has been enabled to avoid email delivery issues.
17+ <strong>NOTICE:</strong> This email is over the size limit (5MB). Inline content has been disabled to avoid email delivery issues.
18 We recommend splitting your RSS feeds into multiple digests.
19 </blockquote>
20+<br />
21 {{end}}
22
23 {{if .ShowBanner}}
24@@ -21,6 +31,7 @@ img {
25 <strong>NOTICE:</strong> In order to keep this digest email active you must <a href="{{.KeepAliveURL}}">click this link</a>.
26 You have {{.DaysLeft}} days left.
27 </blockquote>
28+</br />
29 {{end}}
30
31 <div class="feeds">
1@@ -1,3 +1,9 @@
2+{{if .IsPicoPlus}}
3+{{else}}
4+ > Our email digest service is moving to our paid **pico+** plan on **2026-01-22** at which point we will stop sending you email digests.
5+ > read our announcement: https://blog.pico.sh/ann-033-moving-rss-to-email-pico-plus
6+{{end}}
7+
8 {{if .ShowBanner}}
9 > In order to keep this digest email active you must click the link below. You have {{.DaysLeft}} days left.
10 > {{.KeepAliveURL}}