@stacksjs/defaults 0.75.691 → 0.75.692

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -49,7 +49,7 @@ form field never joins an internal list. Outcomes: `subscribed`, `pending`
49
49
  already on the list gets the same answer a new one would (`pending` on a double
50
50
  opt-in list, `subscribed` elsewhere) and no email, so the form cannot be used to
51
51
  find out who signed up; `already` is no longer sent. A hidden `website` field is
52
- a honeypot: filled in, the request is answered as success and stores nothing. Scripts get JSON; a browser form post gets a 303 back to `return`
52
+ a honeypot: filled in, the request is answered as success and stores nothing. `email.newsletter.signup: false` leaves the signup and confirm routes unmounted (unsubscribe always stays), for a deployment that takes no signups. Scripts get JSON; a browser form post gets a 303 back to `return`
53
53
  or the Referer. The welcome email carries the membership's own token, so its
54
54
  unsubscribe link and RFC 8058 headers leave that list only.
55
55
 
@@ -2,7 +2,7 @@
2
2
  "publisher": "Stacks",
3
3
  "name": "vscode-stacks",
4
4
  "displayName": "Stacks",
5
- "version": "0.75.691",
5
+ "version": "0.75.692",
6
6
  "description": "Stacks, built into VS Code: stx templates, pickier linting and formatting, encrypted env files, the dev server preview and every buddy command. No other extensions required.",
7
7
  "license": "MIT",
8
8
  "funding": "https://github.com/sponsors/chrisbbreuer",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/defaults",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.75.691",
5
+ "version": "0.75.692",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/stacksjs/stacks.git",
@@ -46,14 +46,14 @@
46
46
  "@iconify-json/f7": "^1.2.2",
47
47
  "@iconify-json/hugeicons": "^1.2.35",
48
48
  "@stacksjs/desktop": "^0.2.938",
49
- "@stacksjs/mobile": "0.75.691",
49
+ "@stacksjs/mobile": "0.75.692",
50
50
  "@stacksjs/sanitizer": "^0.2.938",
51
51
  "@stacksjs/stx": "^0.2.938",
52
- "@stacksjs/strings": "0.75.691",
52
+ "@stacksjs/strings": "0.75.692",
53
53
  "@xterm/addon-fit": "^0.11.0",
54
54
  "@xterm/xterm": "^6.0.0",
55
55
  "ts-qr-codes": "^0.1.8",
56
- "@stacksjs/support": "0.75.691",
57
- "@stacksjs/browser": "0.75.691"
56
+ "@stacksjs/support": "0.75.692",
57
+ "@stacksjs/browser": "0.75.692"
58
58
  }
59
59
  }
package/routes/email.ts CHANGED
@@ -46,6 +46,7 @@ interface EmailConfigShape {
46
46
  ses?: { autoConfirmSubscriptions?: boolean }
47
47
  sendgrid?: { publicKeyPem?: string }
48
48
  }
49
+ newsletter?: { signup?: boolean }
49
50
  }
50
51
 
51
52
  function emailConfig(): EmailConfigShape {
@@ -155,9 +156,16 @@ route.post('/webhooks/email/sendgrid', async (req) => {
155
156
  // without a CSRF token round-trip, and the abuse case (bots inflating
156
157
  // the subscriber list) is better handled with the rate limiter — at
157
158
  // the action layer — than with a token check the form can't satisfy.
158
- route.post('/api/email/subscribe', 'Actions/SubscriberEmailAction').name('email.subscribe').skipCsrf()
159
- // The button in the double opt-in email (lists with `double_opt_in` on).
160
- route.get('/api/email/confirm', 'Actions/ConfirmSubscriptionAction').name('email.confirm')
159
+ //
160
+ // `email.newsletter.signup: false` leaves out the signup and its confirmation
161
+ // link, for a deployment that takes no signups (an app's self-hosted install,
162
+ // say, when only its public site runs the list). The unsubscribe routes stay
163
+ // whatever it says: anyone ever emailed must still be able to leave.
164
+ if (emailConfig().newsletter?.signup !== false) {
165
+ route.post('/api/email/subscribe', 'Actions/SubscriberEmailAction').name('email.subscribe').skipCsrf()
166
+ // The button in the double opt-in email (lists with `double_opt_in` on).
167
+ route.get('/api/email/confirm', 'Actions/ConfirmSubscriptionAction').name('email.confirm')
168
+ }
161
169
  route.get('/api/email/unsubscribe', 'Actions/UnsubscribeAction').name('email.unsubscribe')
162
170
  // RFC 8058 one-click endpoint. Mailbox providers (Gmail, Yahoo, Outlook)
163
171
  // POST here with body `List-Unsubscribe=One-Click` when the user clicks