astro-atmosphere-comments 0.2.0 → 0.4.0
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.
- package/CHANGELOG.md +17 -0
- package/README.md +59 -3
- package/components/AtmosphereComments.astro +120 -1087
- package/components/AtmosphereReactions.astro +785 -0
- package/components/Composer.astro +80 -0
- package/components/SignInForm.astro +218 -0
- package/components/atmosphere.css +603 -0
- package/index.d.ts +11 -0
- package/index.mjs +3 -0
- package/lib/client/composer.ts +232 -0
- package/lib/client/handle-suggestions.ts +112 -0
- package/lib/i18n.ts +32 -0
- package/lib/oauth.ts +5 -1
- package/lib/settings.ts +2 -0
- package/lib/translate.ts +36 -0
- package/locales/de.json +95 -0
- package/locales/en.json +95 -0
- package/locales/es.json +98 -0
- package/locales/fr.json +98 -0
- package/locales/it.json +98 -0
- package/locales/ja.json +92 -0
- package/locales/nl.json +95 -0
- package/locales/pt.json +98 -0
- package/package.json +8 -3
- package/routes/follow.ts +71 -0
- package/routes/login.ts +31 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.0 (4 November 2026)
|
|
4
|
+
|
|
5
|
+
- **`AtmosphereReactions`:** likes and reposts on your other Bluesky posts (a feed of your latest posts, say). Mark each post with `data-atmosphere-post` (and its bsky.app address and counts) and put the component once in your layout: each post gets Reply and Quote (opening it on Bluesky), and Repost and Like with counts. Readers who aren't signed in get the sign-in form in an overlay, and their like or repost is done once they're back. Only posts by `allowedAuthors` can be liked or reposted.
|
|
6
|
+
- **Which account you're using:** `AtmosphereReactions` fills any element marked `data-atmosphere-account` with the signed-in reader's avatar, opening a menu with "Signed in as @handle" and Sign out.
|
|
7
|
+
- **Reply and Quote in an overlay:** for signed-in readers, Reply and Quote under those posts open the comment box (with the quote preview) in an overlay; once posted it says it's on Bluesky, not on this page, with a link. Signed out (or with ⌘-click), they open the post on Bluesky.
|
|
8
|
+
- **Follow:** a link marked `data-atmosphere-follow` (an account's DID) becomes a Follow / Following button for signed-in readers (a second press unfollows, as on Bluesky, without inviting it: no "Unfollow" on hover). Permission to follow is asked for only on the first follow, and only `allowedAuthors` can be followed. Asking for a new permission keeps the ones a reader already gave.
|
|
9
|
+
- "Post reply" in reply boxes under comments is now translated (it was always English).
|
|
10
|
+
- The Like and Repost buttons say whose account they use ("Like as @handle") when the reader is signed in.
|
|
11
|
+
- The sign-in form (`SignInForm.astro`) and the comment box (`Composer.astro`, with `lib/client/composer.ts`) are now components of their own, shared by the comments and the overlays, and the comment box's styles are a shared stylesheet (`atmosphere.css`, global, every class starting `atmo`). Nothing changes for sites, unless they relied on those styles being scoped.
|
|
12
|
+
- New wording keys for the overlay and the post actions, in all eight languages.
|
|
13
|
+
|
|
14
|
+
## 0.3.0 (4 November 2026)
|
|
15
|
+
|
|
16
|
+
- **Languages:** the wording now comes from language files (`locales/*.json`, i18next JSON) in English, French, German, Spanish, Portuguese, Italian, Dutch and Japanese, picked from the component's `locale` prop, the integration's `locale` option or Astro's locale for the page, then English. Dates and plurals ("1 like", "2 likes") follow the language. The translations are drafts for native speakers to check; translation is being set up on Weblate.
|
|
17
|
+
- **Your own wording:** a `messages` option (and prop) changes any line, by its key in `locales/en.json`.
|
|
18
|
+
- The `label` and `authorLabel` props still work, and win over `messages`.
|
|
19
|
+
|
|
3
20
|
## 0.2.0 (4 November 2026)
|
|
4
21
|
|
|
5
22
|
- The sign-in form is shown straight away under each post: a handle box and a **Sign in with Atmosphere** button, both with the Atmosphere logo. The "Respond with your Atmosphere Account" button that opened it is gone.
|
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ See it on [saltedlolly.com](https://saltedlolly.com/2005/07/13/summer-jam-party-
|
|
|
20
20
|
|
|
21
21
|
1. You announce each post on Bluesky (a post linking to it). That post's thread is the comment section.
|
|
22
22
|
2. A reader signs in with **AT Protocol OAuth, straight to their own account host** (Bluesky's, for most people), which asks them to approve your site, named by its address (example.com). There is no third-party login service in between, and your site never sees a password.
|
|
23
|
-
3. Your site asks only for what commenting needs: to create posts, to create and delete likes and reposts, and to see which posts the reader has already liked or reposted. Permission to delete posts is asked for separately, only the first time a reader deletes one of their comments on your site, and the site only ever uses it on their own comments under your posts. Readers can revoke it all at any time in their Bluesky settings.
|
|
23
|
+
3. Your site asks only for what commenting needs: to create posts, to create and delete likes and reposts, and to see which posts the reader has already liked or reposted. Permission to delete posts is asked for separately, only the first time a reader deletes one of their comments on your site, and the site only ever uses it on their own comments under your posts. Permission to follow is asked for the same way, the first time a reader presses Follow, and only your own accounts can be followed through it. Readers can revoke it all at any time in their Bluesky settings.
|
|
24
24
|
4. Your server keeps each reader's sign-in (a random cookie in their browser; their tokens on your server), and posts on their behalf when they press a button.
|
|
25
25
|
|
|
26
26
|
Readers who'd rather not sign in can use the **Reply on Bluesky instead** link under the form.
|
|
@@ -86,6 +86,42 @@ import AtmosphereComments from "astro-atmosphere-comments/AtmosphereComments.ast
|
|
|
86
86
|
|
|
87
87
|
`post` can be the announcement's **bsky.app address** or its **AT URI**. Leave it out and the component uses the page's **Standard.site** record instead: if your page has `<link rel="site.standard.document" href="at://…">` and that record's `bskyPostRef` points to the announcement (as Standard.site publishers do), it just works. With no announcement to respond to, the component shows nothing (apart from your slot content).
|
|
88
88
|
|
|
89
|
+
### 4. Optional: likes and reposts on your other Bluesky posts
|
|
90
|
+
|
|
91
|
+
If your pages show your Bluesky posts elsewhere (a "latest posts" feed on your homepage, say), readers can like and repost them there too. Put `AtmosphereReactions` once in your layout, and mark each post's element:
|
|
92
|
+
|
|
93
|
+
```astro
|
|
94
|
+
---
|
|
95
|
+
import AtmosphereReactions from "astro-atmosphere-comments/AtmosphereReactions.astro";
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
<article
|
|
99
|
+
data-atmosphere-post="at://did:plc:…/app.bsky.feed.post/…"
|
|
100
|
+
data-atmosphere-url="https://bsky.app/profile/you.bsky.social/post/…"
|
|
101
|
+
data-atmosphere-likes="3"
|
|
102
|
+
data-atmosphere-reposts="1"
|
|
103
|
+
>
|
|
104
|
+
…the post…
|
|
105
|
+
</article>
|
|
106
|
+
|
|
107
|
+
<AtmosphereReactions />
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Each marked post gets a row of icons: Reply, Repost, Quote and Like, with counts for Repost and Like. Readers already signed in on your site like and repost straight away, and Reply and Quote open the comment box in an overlay (with the quote preview); what they post goes to Bluesky, not your page, and the overlay says so with a link to it. Anyone else is offered the sign-in form in an overlay when they press Like or Repost (their like or repost is done when they come back), and Reply and Quote open the post on Bluesky. It works with posts from loaders such as [`@ascorbic/bluesky-loader`](https://www.npmjs.com/package/@ascorbic/bluesky-loader) or embeds such as [`@astro-community/astro-embed-bluesky`](https://www.npmjs.com/package/@astro-community/astro-embed-bluesky) (wrap the embed in the marked element). Only posts by your `allowedAuthors` can be liked or reposted through your site.
|
|
111
|
+
|
|
112
|
+
A "follow me" link can become a **Follow** button for signed-in readers: mark it with the account's DID and handle. It shows "Following" once they do (a second press unfollows, as on Bluesky). The first follow asks the reader's account host for one more permission. Only your `allowedAuthors` can be followed through your site, and the account's owner (who can't follow themselves) keeps the plain link.
|
|
113
|
+
|
|
114
|
+
```astro
|
|
115
|
+
<a href="https://bsky.app/profile/you.bsky.social"
|
|
116
|
+
data-atmosphere-follow="did:plc:…" data-atmosphere-follow-handle="you.bsky.social">Follow me on Bluesky</a>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
So readers can see which account they're using, `AtmosphereReactions` also fills any element marked `data-atmosphere-account` (in your header, say) with the signed-in reader's avatar. Clicking it opens a small menu: "Signed in as @handle" and Sign out. When nobody's signed in it stays empty, so give it `hidden`:
|
|
120
|
+
|
|
121
|
+
```astro
|
|
122
|
+
<span data-atmosphere-account hidden></span>
|
|
123
|
+
```
|
|
124
|
+
|
|
89
125
|
### Trying it on your own computer
|
|
90
126
|
|
|
91
127
|
Run the dev server on `127.0.0.1` and open the site there, not at `localhost`:
|
|
@@ -106,6 +142,8 @@ Locally the integration uses the protocol's development mode, so no key is neede
|
|
|
106
142
|
| `policyUri`, `tosUri` | | Your privacy policy and terms, shown on the sign-in screen. |
|
|
107
143
|
| `hidden` | | Comments never to show: bsky.app post or profile addresses, AT URIs, handles or DIDs. Replies you hide in the Bluesky app, and posts with Bluesky's moderation labels (spam and so on), are left out anyway. |
|
|
108
144
|
| `base` | | Where the integration's routes live. Default `/atmosphere`. |
|
|
145
|
+
| `locale` | | The language of the wording, such as `"fr"` or `"pt-BR"` (see Languages). |
|
|
146
|
+
| `messages` | | Your own wording for any line, by its key in [`locales/en.json`](locales/en.json). |
|
|
109
147
|
|
|
110
148
|
## The component
|
|
111
149
|
|
|
@@ -115,12 +153,30 @@ Locally the integration uses the protocol's development mode, so no key is neede
|
|
|
115
153
|
| `label` | The sign-in form's heading. Default "Sign in to leave a comment, like or repost". |
|
|
116
154
|
| `authorLabel` | The badge on your own comments. Default "Author". |
|
|
117
155
|
| `blueskyLink` | "Rather not sign in here? Reply on Bluesky instead →" under the sign-in form, linking to the announcement (with `u-syndication`, so microformats readers learn it's the post's copy on Bluesky). Default `true`; `blueskyLink={false}` hides it. |
|
|
156
|
+
| `locale`, `messages` | The same as the integration's options, for this one component. |
|
|
157
|
+
| `locale`, `messages` (also on `AtmosphereReactions`) | See Languages. |
|
|
118
158
|
| `credit` | A small "Powered by Atmosphere Comments for Astro" link at the end. Default `true`; set `credit={false}` to hide it. |
|
|
119
159
|
|
|
120
160
|
**Slots:** `after-box` goes between the comment box and the comments (a note about other ways to respond, say); the default slot goes after the comments (other responses, older comments).
|
|
121
161
|
|
|
122
162
|
**Layout, top to bottom:** likes and reposts, the sign-in form and the "Reply on Bluesky instead" line (or, signed in, Like, Repost, Quote and the comment box), your `after-box` content, the comments, your default slot content.
|
|
123
163
|
|
|
164
|
+
## Languages
|
|
165
|
+
|
|
166
|
+
The wording comes in English, French, German, Spanish, Portuguese, Italian, Dutch and Japanese. The component uses, in order: its `locale` prop, the integration's `locale` option, Astro's own locale for the page (if you use [Astro's i18n routing](https://docs.astro.build/en/guides/internationalization/)), then English. A regional code falls back to its language (`pt-BR` uses `pt`), and any line a language lacks is shown in English. Dates follow the same language.
|
|
167
|
+
|
|
168
|
+
To change any line, give its key from [`locales/en.json`](locales/en.json):
|
|
169
|
+
|
|
170
|
+
```js
|
|
171
|
+
atmosphereComments({
|
|
172
|
+
// …
|
|
173
|
+
locale: "fr",
|
|
174
|
+
messages: { "signIn.heading": "Connecte-toi pour rejoindre la conversation" },
|
|
175
|
+
}),
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
The translations other than English started as drafts and need checking by native speakers. Translation is being set up on [Weblate](https://weblate.org), the open-source translation platform; until then, corrections and new languages are very welcome as [GitHub issues or pull requests](https://github.com/saltedlolly/astro-atmosphere-comments/issues). (Bluesky's own approval page is in the reader's language already.)
|
|
179
|
+
|
|
124
180
|
## Styling
|
|
125
181
|
|
|
126
182
|
It has a plain default look and takes your text colour. Colours come from CSS custom properties, set on `.atmo`:
|
|
@@ -137,11 +193,12 @@ It has a plain default look and takes your text colour. Colours come from CSS cu
|
|
|
137
193
|
--atmo-menu-bg: #fff; /* account and @mention suggestions */
|
|
138
194
|
--atmo-ring: #fff; /* the outline round faces */
|
|
139
195
|
--atmo-danger: #c0392b; /* Delete, when confirming */
|
|
196
|
+
--atmo-dialog-bg: #fff; /* the sign-in overlay (defaults to --atmo-menu-bg) */
|
|
140
197
|
--atmo-radius: 10px;
|
|
141
198
|
}
|
|
142
199
|
```
|
|
143
200
|
|
|
144
|
-
The likes and comments are drawn with classes you can style directly (`.atmo-reactions`, `.atmo-facepile`, `.atmo-comments`, `.atmo-comment`, `.atmo-comment--nested`, `.atmo-comment--author`, `.atmo-comment__header`, `__avatar`, `__author`, `__badge`, `__date`, `__body`, and `.atmo-comment-actions` for Reply, Like and Repost). Their defaults carry no CSS weight, so your rules always win.
|
|
201
|
+
The likes and comments are drawn with classes you can style directly (`.atmo-reactions`, `.atmo-facepile`, `.atmo-comments`, `.atmo-comment`, `.atmo-comment--nested`, `.atmo-comment--author`, `.atmo-comment__header`, `__avatar`, `__author`, `__badge`, `__date`, `__body`, and `.atmo-comment-actions` for Reply, Like and Repost, and `.atmo-post-actions` / `.atmo-post-action` for the row `AtmosphereReactions` adds). Their defaults carry no CSS weight, so your rules always win.
|
|
145
202
|
|
|
146
203
|
## Events
|
|
147
204
|
|
|
@@ -162,7 +219,6 @@ The component fires (bubbling):
|
|
|
162
219
|
|
|
163
220
|
- Needs a Node server with a lasting disk (no serverless or edge hosts yet).
|
|
164
221
|
- Rate limits are kept in memory, so they apply per server process.
|
|
165
|
-
- The wording is English only.
|
|
166
222
|
- Quoting individual comments isn't supported.
|
|
167
223
|
|
|
168
224
|
If you only want readers to sign in with their Atmosphere account, without comments, see [AuthProto](https://www.npmjs.com/package/@fujocoded/authproto).
|