@vibes.diy/prompts 14.3.241 → 14.3.243
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/llms/connections.md +24 -10
- package/llms/index.d.ts +2 -1
- package/llms/index.js +3 -0
- package/llms/index.js.map +1 -1
- package/llms/social-post.d.ts +2 -0
- package/llms/social-post.js +24 -0
- package/llms/social-post.js.map +1 -0
- package/llms/social-post.md +328 -0
- package/package.json +5 -5
package/llms/connections.md
CHANGED
|
@@ -89,15 +89,25 @@ function ConnectInstagram() {
|
|
|
89
89
|
if (state === "pending") return null; // still resolving — never flash a Connect button
|
|
90
90
|
// A connection that already works keeps working, whatever `available` says.
|
|
91
91
|
if (consented && (state === "live" || state === "expiring"))
|
|
92
|
-
return
|
|
92
|
+
return (
|
|
93
|
+
<Text>
|
|
94
|
+
Connected as {accountLabel}
|
|
95
|
+
{state === "expiring" && <Button type="button" variant="quiet" onClick={link}>Renew</Button>}
|
|
96
|
+
</Text>
|
|
97
|
+
);
|
|
93
98
|
// Everything below asks the visitor to start or redo a connection, which is
|
|
94
99
|
// the only thing `available` can stop.
|
|
95
|
-
if (!available) return <Text muted>Connecting Instagram
|
|
96
|
-
|
|
97
|
-
return <Button type="button" onClick={link}>Connect Instagram</Button>;
|
|
100
|
+
if (!available) return <Text muted>Connecting Instagram opens up again soon.</Text>;
|
|
101
|
+
return <Button type="button" onClick={link}>{state === "dead" ? "Reconnect Instagram" : "Connect Instagram"}</Button>;
|
|
98
102
|
}
|
|
99
103
|
```
|
|
100
104
|
|
|
105
|
+
**An `expiring` connection gets a Renew button that calls `link()`**, and a
|
|
106
|
+
`dead` one a Reconnect button that does the same: signing in again is how a
|
|
107
|
+
connection renews (LinkedIn's lasts 60 days and renews no other way), and the
|
|
108
|
+
platform's expiry notice tells the person to press Renew in the app. Show it
|
|
109
|
+
beside "Connected as …" while `state === "expiring"`.
|
|
110
|
+
|
|
101
111
|
`useConnection(provider)` returns `state` (`pending` | `absent` | `live` |
|
|
102
112
|
`expiring` | `dead`), `consented` (whether _this_ app has been approved — a
|
|
103
113
|
`live` account with `consented: false` is a one-click ask, not a full
|
|
@@ -147,29 +157,30 @@ provider call as a typed request with a typed response, so there is no
|
|
|
147
157
|
|
|
148
158
|
- `connectionState(ctx, provider)` → `{ state: "live" | "needs_consent" | "dead" | "error" }`.
|
|
149
159
|
Spends nothing. `needs_consent` means render the Connect button; `dead` means
|
|
150
|
-
|
|
160
|
+
render the Reconnect button (it calls `link()`); `error` carries a `reason`.
|
|
151
161
|
- `github(ctx).me()` → `{ id, login, name, bio, avatarUrl, htmlUrl }`.
|
|
152
162
|
- `threads(ctx).me()` → `{ id, username }`; `threads(ctx).posts({ limit, cursor })` →
|
|
153
163
|
`{ items: [{ id, text, permalink, timestamp, mediaType }], cursor? }`.
|
|
154
164
|
- `instagram(ctx).me()` → `{ id, username }`; `instagram(ctx).media({ limit, cursor })` →
|
|
155
165
|
`{ items: [{ id, caption, mediaType, permalink, timestamp, likeCount, commentsCount }], cursor? }`
|
|
156
166
|
(`likeCount` is `null` when the person hides likes, never `0`).
|
|
157
|
-
- `threads(ctx).publish({ text, imageUrl?, replyToId? })` → `{ id }`. Needs
|
|
167
|
+
- `threads(ctx).publish({ text, imageUrl?, replyToId? })` → `{ id, permalink? }`. Needs
|
|
158
168
|
`threads_content_publish`. A text post needs `text`; an image post needs a
|
|
159
169
|
publicly reachable `imageUrl` the provider fetches itself.
|
|
160
|
-
- `instagram(ctx).publish({ imageUrl, caption? })` → `{ id }`. Needs
|
|
170
|
+
- `instagram(ctx).publish({ imageUrl, caption? })` → `{ id, permalink? }`. Needs
|
|
161
171
|
`instagram_business_content_publish`. Instagram has no text-only post, so
|
|
162
172
|
`imageUrl` is required.
|
|
163
173
|
- `linkedin(ctx).me()` → `{ id, name, givenName, familyName, picture, personUrn }`.
|
|
164
174
|
Needs `profile`.
|
|
165
|
-
- `linkedin(ctx).post({ text, visibility?, link? })` → `{ id }`. Needs
|
|
175
|
+
- `linkedin(ctx).post({ text, visibility?, link?, imageUrl?, altText? })` → `{ id, permalink }`. Needs
|
|
166
176
|
`w_member_social` and `profile` (a post is authored as the member, and
|
|
167
177
|
`profile` is where their id comes from). `text` is plain prose: the library
|
|
168
178
|
escapes LinkedIn's formatting characters and keeps `#hashtags` live.
|
|
169
179
|
`visibility` is `"PUBLIC"` (default) or `"CONNECTIONS"`. `link` is
|
|
170
180
|
`{ url, title?, description? }` and becomes the post's card exactly as given,
|
|
171
|
-
since LinkedIn shows what the request carries.
|
|
172
|
-
|
|
181
|
+
since LinkedIn shows what the request carries. `imageUrl` is a public https
|
|
182
|
+
JPEG, PNG or GIF up to 8 MB, which the platform uploads to LinkedIn for the
|
|
183
|
+
member; a post carries a picture or a link card.
|
|
173
184
|
|
|
174
185
|
**Video posting is not available on any provider yet** — the provider hands
|
|
175
186
|
back a container while the video is still processing, and the platform cannot
|
|
@@ -177,6 +188,9 @@ yet read that container's status, so a video post would intermittently fail
|
|
|
177
188
|
rather than land. Build on text and images; do not work around it with a raw
|
|
178
189
|
`ctx.connections` call, which hits the same race.
|
|
179
190
|
|
|
191
|
+
A composer that posts one update to several networks is the `social-post`
|
|
192
|
+
skill.
|
|
193
|
+
|
|
180
194
|
Posting on someone's behalf is a real act, so **let the person press the
|
|
181
195
|
button** — post from a `fetch` route the app calls on the person's own action, and
|
|
182
196
|
never from a `scheduled` tick that posts for a visitor who is not there. A post
|
package/llms/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export { createVibeConfig } from "./create-vibe.js";
|
|
|
18
18
|
export { accessConfig } from "./access.js";
|
|
19
19
|
export { connectionsConfig } from "./connections.js";
|
|
20
20
|
export { githubConfig } from "./github.js";
|
|
21
|
+
export { socialPostConfig } from "./social-post.js";
|
|
21
22
|
export { youtubeConfig } from "./youtube.js";
|
|
22
23
|
export { blueskyConfig } from "./bluesky.js";
|
|
23
24
|
export { spotifyConfig } from "./spotify.js";
|
|
@@ -61,7 +62,7 @@ export { uiCalendarConfig } from "./ui-calendar.js";
|
|
|
61
62
|
export { uiTestimonialsConfig } from "./ui-testimonials.js";
|
|
62
63
|
export type { LlmConfig } from "./types.js";
|
|
63
64
|
export { cueMatches, cueMatchedSkills, type CueCatalogEntry } from "./cues.js";
|
|
64
|
-
export declare const allConfigs: readonly [LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig];
|
|
65
|
+
export declare const allConfigs: readonly [LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig];
|
|
65
66
|
export { mapsConfig } from "./maps.js";
|
|
66
67
|
export declare const SKILL_ALIASES: ReadonlyMap<string, string>;
|
|
67
68
|
export declare function canonicalSkillName(name: string): string;
|
package/llms/index.js
CHANGED
|
@@ -18,6 +18,7 @@ import { createVibeConfig } from "./create-vibe.js";
|
|
|
18
18
|
import { accessConfig } from "./access.js";
|
|
19
19
|
import { connectionsConfig } from "./connections.js";
|
|
20
20
|
import { githubConfig } from "./github.js";
|
|
21
|
+
import { socialPostConfig } from "./social-post.js";
|
|
21
22
|
import { youtubeConfig } from "./youtube.js";
|
|
22
23
|
import { blueskyConfig } from "./bluesky.js";
|
|
23
24
|
import { spotifyConfig } from "./spotify.js";
|
|
@@ -78,6 +79,7 @@ export { createVibeConfig } from "./create-vibe.js";
|
|
|
78
79
|
export { accessConfig } from "./access.js";
|
|
79
80
|
export { connectionsConfig } from "./connections.js";
|
|
80
81
|
export { githubConfig } from "./github.js";
|
|
82
|
+
export { socialPostConfig } from "./social-post.js";
|
|
81
83
|
export { youtubeConfig } from "./youtube.js";
|
|
82
84
|
export { blueskyConfig } from "./bluesky.js";
|
|
83
85
|
export { spotifyConfig } from "./spotify.js";
|
|
@@ -140,6 +142,7 @@ export const allConfigs = [
|
|
|
140
142
|
boardGamesConfig,
|
|
141
143
|
accessConfig,
|
|
142
144
|
connectionsConfig,
|
|
145
|
+
socialPostConfig,
|
|
143
146
|
githubConfig,
|
|
144
147
|
youtubeConfig,
|
|
145
148
|
blueskyConfig,
|
package/llms/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../jsr/llms/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAA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C,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const socialPostConfig = {
|
|
2
|
+
name: "social-post",
|
|
3
|
+
label: "Post as you",
|
|
4
|
+
description: "Post as the visitor to their own Threads, LinkedIn and Instagram — a composer that cross-posts one update with an optional photo, a Connect and Renew button per network, one result and link per network — config.connections posting scopes, useConnection, apiFetch, threads/linkedin/instagram from @vibes.diy/social",
|
|
5
|
+
cues: [
|
|
6
|
+
"post to my linkedin",
|
|
7
|
+
"post to linkedin",
|
|
8
|
+
"share on linkedin",
|
|
9
|
+
"post to threads",
|
|
10
|
+
"post to my threads",
|
|
11
|
+
"post to instagram",
|
|
12
|
+
"post to my instagram",
|
|
13
|
+
"cross-post",
|
|
14
|
+
"crosspost",
|
|
15
|
+
"post it everywhere",
|
|
16
|
+
"all my socials",
|
|
17
|
+
"social media post",
|
|
18
|
+
"social composer",
|
|
19
|
+
"post as me",
|
|
20
|
+
],
|
|
21
|
+
importModule: "use-vibes",
|
|
22
|
+
importName: "useConnection",
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=social-post.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"social-post.js","sourceRoot":"","sources":["../../jsr/llms/social-post.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,gBAAgB,GAAc;IACzC,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE,aAAa;IACpB,WAAW,EACT,2TAA2T;IAC7T,IAAI,EAAE;QACJ,qBAAqB;QACrB,kBAAkB;QAClB,mBAAmB;QACnB,iBAAiB;QACjB,oBAAoB;QACpB,mBAAmB;QACnB,sBAAsB;QACtB,YAAY;QACZ,WAAW;QACX,oBAAoB;QACpB,gBAAgB;QAChB,mBAAmB;QACnB,iBAAiB;QACjB,YAAY;KACb;IACD,YAAY,EAAE,WAAW;IACzB,UAAU,EAAE,eAAe;CAC5B,CAAC"}
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
# Post as you — one draft, out to Threads, LinkedIn and Instagram
|
|
2
|
+
|
|
3
|
+
A **post-as-you** app lets each visitor connect their own Threads, LinkedIn and
|
|
4
|
+
Instagram accounts, write one update, and send it to the networks they pick with
|
|
5
|
+
one press. The post lands on **their** feed, under their own name. The platform
|
|
6
|
+
shows the consent screen, signs them in, holds the credential, and uploads
|
|
7
|
+
pictures where a network needs it, so the app contains no client id, secret,
|
|
8
|
+
token field or upload code.
|
|
9
|
+
|
|
10
|
+
Signal words: "post to my LinkedIn", "share on Threads and Instagram",
|
|
11
|
+
"cross-post", "one update to all my socials", "a composer for my social
|
|
12
|
+
accounts", "share my sketch to Instagram".
|
|
13
|
+
|
|
14
|
+
## The four parts, every time
|
|
15
|
+
|
|
16
|
+
**Declare each network with its posting scope in `config.connections`, give
|
|
17
|
+
each one its own Connect button from `useConnection`, post from a `fetch` route
|
|
18
|
+
through `@vibes.diy/social`, and call that route from the page with `apiFetch`.**
|
|
19
|
+
Leave out any one and the app breaks: an undeclared network has no consent
|
|
20
|
+
card, a missing button can never be approved, and a plain `fetch("/_api/…")`
|
|
21
|
+
reaches the backend as nobody, so every post is refused.
|
|
22
|
+
|
|
23
|
+
## Declare — `backend.js`
|
|
24
|
+
|
|
25
|
+
| network | scopes to declare | what the post can carry |
|
|
26
|
+
| ----------- | ------------------------------------------------------------------- | -------------------------------------------------------------- |
|
|
27
|
+
| `threads` | `threads_basic`, `threads_content_publish` | text up to 500 characters, optionally one picture |
|
|
28
|
+
| `linkedin` | `profile`, `w_member_social` | text up to 3,000 characters, plus one picture **or** one link card |
|
|
29
|
+
| `instagram` | `instagram_business_basic`, `instagram_business_content_publish` | **a picture is required**, caption up to 2,200 characters |
|
|
30
|
+
|
|
31
|
+
**A scope that posts is a separate scope, and asking for it is the whole
|
|
32
|
+
authorization.** The visitor sees "Post to your LinkedIn feed as you" beside
|
|
33
|
+
your `why` and decides; an app that declared only the read scope cannot post.
|
|
34
|
+
Declare the read scope beside it as the table shows: LinkedIn needs `profile`
|
|
35
|
+
to know who the author is, and the Threads and Instagram read scopes are how a
|
|
36
|
+
post comes back with its link.
|
|
37
|
+
|
|
38
|
+
`why` is quoted to the visitor as the app's own words. Say what is posted and
|
|
39
|
+
when: "Post your update to your Threads feed when you press Post."
|
|
40
|
+
|
|
41
|
+
Instagram connects **Creator and Business accounts**. A visitor with a personal
|
|
42
|
+
account is shown how to switch (it is free, keeps their posts and followers, and
|
|
43
|
+
can be switched back), so the app needs no extra step for it.
|
|
44
|
+
|
|
45
|
+
## Connect and renew — `App.jsx`
|
|
46
|
+
|
|
47
|
+
**Each network gets its own button, and each button follows the connection's
|
|
48
|
+
state.** `useConnection(network)` gives `state` (`pending` | `absent` | `live` |
|
|
49
|
+
`expiring` | `dead`), `consented`, `available`, `accountLabel` and `link()`.
|
|
50
|
+
|
|
51
|
+
**Offer a Renew button while a connection is `expiring`.** LinkedIn's sign-in
|
|
52
|
+
lasts 60 days and cannot renew by itself: the person renews it by signing in
|
|
53
|
+
again, and while they are still signed in to LinkedIn that takes one tap with
|
|
54
|
+
no new consent screen. So `expiring` shows "Connected as … · Renew", and Renew
|
|
55
|
+
calls the same `link()` as Connect. A `dead` connection gets a Reconnect button
|
|
56
|
+
that calls `link()` too. `link()` resolves when the sign-in starts, not when it
|
|
57
|
+
finishes, so after it the button re-reads with `refresh()` every few seconds,
|
|
58
|
+
a handful of times, while the page is in view.
|
|
59
|
+
|
|
60
|
+
Render the connected branch first: `available` only stops a connection being
|
|
61
|
+
_started_, never one that already works.
|
|
62
|
+
|
|
63
|
+
## Post — `backend.js`
|
|
64
|
+
|
|
65
|
+
- `threads(ctx).publish({ text, imageUrl? })` → `{ id, permalink? }`
|
|
66
|
+
- `linkedin(ctx).post({ text, imageUrl?, altText?, link?, visibility? })` → `{ id, permalink }`.
|
|
67
|
+
`text` is plain prose (the library escapes LinkedIn's formatting characters
|
|
68
|
+
and keeps `#hashtags` live). `visibility` is `"PUBLIC"` (default) or
|
|
69
|
+
`"CONNECTIONS"`. A post carries `imageUrl` **or** `link`, never both.
|
|
70
|
+
- `instagram(ctx).publish({ imageUrl, caption? })` → `{ id, permalink? }`
|
|
71
|
+
- `connectionState(ctx, network)` → `{ state: "live" | "needs_consent" | "dead" | "error" }`,
|
|
72
|
+
spending nothing. Check it before posting so an unconnected network comes back
|
|
73
|
+
as a sentence, not a thrown error.
|
|
74
|
+
|
|
75
|
+
**A picture is a public https URL that every network can fetch.** Use a JPEG to
|
|
76
|
+
post the same picture everywhere: Instagram takes JPEG only, Threads takes JPEG
|
|
77
|
+
or PNG, and LinkedIn takes JPEG, PNG or GIF up to 8 MB. A picture the visitor
|
|
78
|
+
picks is saved as a file on a record every visitor can read, holding the
|
|
79
|
+
picture alone (the post's words stay off it until a network has them); wait for that
|
|
80
|
+
save's `synced` receipt to read `"accepted"`, then read the record back and its
|
|
81
|
+
`_files.photo.shareUrl` is the `imageUrl`. (`url` is a `blob:` address only this
|
|
82
|
+
page can open until then; `shareUrl` is the public one.) Threads and Instagram
|
|
83
|
+
fetch it themselves; for LinkedIn the platform uploads it for the member, so the
|
|
84
|
+
same URL works on all three.
|
|
85
|
+
|
|
86
|
+
**Post one network at a time and answer for each.** A post that fails on one
|
|
87
|
+
network still lands on the others, so the route returns one result per network
|
|
88
|
+
— `{ ok: true, permalink }` or `{ ok: false, error }` — and the page shows each
|
|
89
|
+
beside its network, with the link to the live post. A thrown error carries
|
|
90
|
+
`detail` (a plain sentence, from the picture step), `reason` (a connection
|
|
91
|
+
word such as `needs_consent`) or `message`; show the first one present.
|
|
92
|
+
|
|
93
|
+
**Post only when the person presses the button.** Posting is an act done in
|
|
94
|
+
someone's name, so it happens in a `fetch` route the page calls on their press,
|
|
95
|
+
never in a `scheduled` tick and never on page load. A visitor's connection can
|
|
96
|
+
only be spent while they are there: `scheduled` runs as the app's owner.
|
|
97
|
+
|
|
98
|
+
Build posts from text and pictures.
|
|
99
|
+
|
|
100
|
+
## A complete composer
|
|
101
|
+
|
|
102
|
+
### `backend.js`
|
|
103
|
+
```js app=post-as-you
|
|
104
|
+
import { threads, linkedin, instagram, connectionState } from "@vibes.diy/social";
|
|
105
|
+
|
|
106
|
+
export const config = {
|
|
107
|
+
connections: [
|
|
108
|
+
{
|
|
109
|
+
provider: "threads",
|
|
110
|
+
scopes: ["threads_basic", "threads_content_publish"],
|
|
111
|
+
why: "Post your update to your Threads feed when you press Post.",
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
provider: "linkedin",
|
|
115
|
+
scopes: ["profile", "w_member_social"],
|
|
116
|
+
why: "Post your update to your LinkedIn feed when you press Post.",
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
provider: "instagram",
|
|
120
|
+
scopes: ["instagram_business_basic", "instagram_business_content_publish"],
|
|
121
|
+
why: "Post your photo and caption to your Instagram when you press Post.",
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const LIMITS = { threads: 500, linkedin: 3000, instagram: 2200 };
|
|
127
|
+
|
|
128
|
+
function postTo(ctx, network, text, imageUrl) {
|
|
129
|
+
if (network === "threads") return threads(ctx).publish({ text, imageUrl });
|
|
130
|
+
if (network === "linkedin") return linkedin(ctx).post({ text, imageUrl });
|
|
131
|
+
return instagram(ctx).publish({ imageUrl, caption: text });
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
async function postEverywhere(ctx, { text, imageUrl, networks }) {
|
|
135
|
+
const results = {};
|
|
136
|
+
for (const network of new Set(networks)) {
|
|
137
|
+
if (!(network in LIMITS)) continue;
|
|
138
|
+
const conn = await connectionState(ctx, network);
|
|
139
|
+
if (conn.state !== "live") {
|
|
140
|
+
results[network] = { ok: false, error: conn.state === "dead" ? "Reconnect to post here." : "Connect to post here." };
|
|
141
|
+
} else if (text.length > LIMITS[network]) {
|
|
142
|
+
results[network] = { ok: false, error: `Keep it under ${LIMITS[network]} characters here.` };
|
|
143
|
+
} else if (network === "instagram" && !imageUrl) {
|
|
144
|
+
results[network] = { ok: false, error: "Add a photo to post to Instagram." };
|
|
145
|
+
} else {
|
|
146
|
+
try {
|
|
147
|
+
const { permalink } = await postTo(ctx, network, text, imageUrl);
|
|
148
|
+
results[network] = { ok: true, permalink: permalink ?? null };
|
|
149
|
+
} catch (err) {
|
|
150
|
+
ctx.log(`post to ${network} failed: ${err.message}`);
|
|
151
|
+
results[network] = { ok: false, error: err.detail ?? err.reason ?? err.message };
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return results;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export async function fetch(request, ctx) {
|
|
159
|
+
const url = new URL(request.url);
|
|
160
|
+
if (url.pathname.endsWith("/post") && request.method === "POST") {
|
|
161
|
+
const { text = "", imageUrl, networks = [] } = await request.json();
|
|
162
|
+
const results = await postEverywhere(ctx, { text, imageUrl: imageUrl || undefined, networks });
|
|
163
|
+
return Response.json({ results });
|
|
164
|
+
}
|
|
165
|
+
return new Response("not found", { status: 404 });
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### `App.jsx`
|
|
170
|
+
```jsx app=post-as-you
|
|
171
|
+
import React, { useRef, useState } from "react";
|
|
172
|
+
import { useFireproof } from "use-fireproof";
|
|
173
|
+
import { useConnection, apiFetch } from "use-vibes";
|
|
174
|
+
import { Badge, Button, Card, ErrorNote, Field, Heading, Row, Stack, Text, Textarea } from "@vibes.diy/ui";
|
|
175
|
+
|
|
176
|
+
const NETWORKS = [
|
|
177
|
+
{ id: "threads", name: "Threads", limit: 500 },
|
|
178
|
+
{ id: "linkedin", name: "LinkedIn", limit: 3000 },
|
|
179
|
+
{ id: "instagram", name: "Instagram", limit: 2200 },
|
|
180
|
+
];
|
|
181
|
+
|
|
182
|
+
// Resolves when the server has answered for this save: "accepted", "refused" or "held".
|
|
183
|
+
function whenSettled(synced) {
|
|
184
|
+
return new Promise((resolve) => synced.on((s) => s.status !== "pending" && resolve(s)));
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function NetworkRow({ network, picked, onPick, result }) {
|
|
188
|
+
const { state, consented, available, accountLabel, link, refresh } = useConnection(network.id);
|
|
189
|
+
// link() resolves when sign-in STARTS, so re-read a few times while the page is in view.
|
|
190
|
+
async function connect() {
|
|
191
|
+
await link();
|
|
192
|
+
for (let i = 0; i < 6; i++) {
|
|
193
|
+
await new Promise((r) => setTimeout(r, 3000));
|
|
194
|
+
if (document.visibilityState === "visible") await refresh();
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (state === "pending") return null;
|
|
198
|
+
const connected = consented && (state === "live" || state === "expiring");
|
|
199
|
+
return (
|
|
200
|
+
<Row gap={2} align="center" wrap>
|
|
201
|
+
<Text>{network.name}</Text>
|
|
202
|
+
{connected ? (
|
|
203
|
+
<>
|
|
204
|
+
<Button type="button" variant={picked ? "primary" : "quiet"} onClick={() => onPick(!picked)}>
|
|
205
|
+
{picked ? "Posting here" : `Post as ${accountLabel}`}
|
|
206
|
+
</Button>
|
|
207
|
+
{state === "expiring" && (
|
|
208
|
+
<Button type="button" variant="quiet" onClick={connect}>
|
|
209
|
+
Renew
|
|
210
|
+
</Button>
|
|
211
|
+
)}
|
|
212
|
+
</>
|
|
213
|
+
) : !available ? (
|
|
214
|
+
<Text muted>Connecting {network.name} opens up again soon.</Text>
|
|
215
|
+
) : (
|
|
216
|
+
<Button type="button" onClick={connect}>
|
|
217
|
+
{state === "dead" ? `Reconnect ${network.name}` : `Connect ${network.name}`}
|
|
218
|
+
</Button>
|
|
219
|
+
)}
|
|
220
|
+
{result?.ok && (result.permalink ? <a href={result.permalink} target="_blank" rel="noreferrer">See the post</a> : <Badge tone="up">Posted</Badge>)}
|
|
221
|
+
{result && !result.ok && <Text muted>{result.error}</Text>}
|
|
222
|
+
</Row>
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export default function App() {
|
|
227
|
+
const { database } = useFireproof("posts");
|
|
228
|
+
const [text, setText] = useState("");
|
|
229
|
+
const [photo, setPhoto] = useState(null);
|
|
230
|
+
const [picked, setPicked] = useState({});
|
|
231
|
+
const [results, setResults] = useState({});
|
|
232
|
+
const [busy, setBusy] = useState(false);
|
|
233
|
+
const [problem, setProblem] = useState("");
|
|
234
|
+
const fileRef = useRef(null);
|
|
235
|
+
|
|
236
|
+
const networks = NETWORKS.filter((n) => picked[n.id]).map((n) => n.id);
|
|
237
|
+
// Instagram takes a photo with no caption; every other network needs words.
|
|
238
|
+
const ready = text.trim() !== "" || (photo !== null && networks.every((n) => n === "instagram"));
|
|
239
|
+
const editDraft = (next) => {
|
|
240
|
+
setText(next);
|
|
241
|
+
setResults({});
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
async function post() {
|
|
245
|
+
setBusy(true);
|
|
246
|
+
setProblem("");
|
|
247
|
+
setResults({});
|
|
248
|
+
try {
|
|
249
|
+
let imageUrl;
|
|
250
|
+
if (photo) {
|
|
251
|
+
// The picture alone lives on a record every visitor can read, so each network can fetch it.
|
|
252
|
+
const saved = await database.put({ type: "picture", createdAt: Date.now(), _files: { photo } });
|
|
253
|
+
const receipt = await whenSettled(saved.synced);
|
|
254
|
+
if (receipt.status !== "accepted") {
|
|
255
|
+
setProblem(receipt.message || "Sign in to post your photo.");
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
const doc = await database.get(saved.id);
|
|
259
|
+
imageUrl = doc._files.photo.shareUrl;
|
|
260
|
+
}
|
|
261
|
+
const res = await apiFetch("/post", {
|
|
262
|
+
method: "POST",
|
|
263
|
+
headers: { "content-type": "application/json" },
|
|
264
|
+
body: JSON.stringify({ text, imageUrl, networks }),
|
|
265
|
+
});
|
|
266
|
+
const data = await res.json();
|
|
267
|
+
if (res.ok) setResults(data.results);
|
|
268
|
+
else setProblem("The post did not go out. Try again in a moment.");
|
|
269
|
+
} catch (err) {
|
|
270
|
+
setProblem(err.message);
|
|
271
|
+
} finally {
|
|
272
|
+
setBusy(false);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
return (
|
|
277
|
+
<div className="min-h-screen p-6 max-w-xl mx-auto bg-background text-foreground font-sans">
|
|
278
|
+
<Stack gap={4}>
|
|
279
|
+
<Heading level={1}>Post as you</Heading>
|
|
280
|
+
<Card>
|
|
281
|
+
<Stack gap={3}>
|
|
282
|
+
<Field label="Your update">
|
|
283
|
+
{(id, describedBy) => <Textarea id={id} describedBy={describedBy} rows={5} value={text} onChange={editDraft} />}
|
|
284
|
+
</Field>
|
|
285
|
+
<Text muted size="sm">{text.length} characters</Text>
|
|
286
|
+
<Row gap={3} align="center">
|
|
287
|
+
<Button type="button" variant="quiet" onClick={() => fileRef.current?.click()}>
|
|
288
|
+
{photo ? "Pick a different photo" : "Add a photo"}
|
|
289
|
+
</Button>
|
|
290
|
+
{photo && <Text muted size="sm">{photo.name}</Text>}
|
|
291
|
+
</Row>
|
|
292
|
+
<input ref={fileRef} type="file" accept="image/jpeg" hidden onChange={(e) => setPhoto(e.target.files?.[0] ?? null)} />
|
|
293
|
+
</Stack>
|
|
294
|
+
</Card>
|
|
295
|
+
<Stack gap={2}>
|
|
296
|
+
{NETWORKS.map((n) => (
|
|
297
|
+
<NetworkRow
|
|
298
|
+
key={n.id}
|
|
299
|
+
network={n}
|
|
300
|
+
picked={!!picked[n.id]}
|
|
301
|
+
onPick={(on) => setPicked((p) => ({ ...p, [n.id]: on }))}
|
|
302
|
+
result={results[n.id]}
|
|
303
|
+
/>
|
|
304
|
+
))}
|
|
305
|
+
</Stack>
|
|
306
|
+
<Button type="button" size="lg" disabled={busy || networks.length === 0 || !ready} onClick={post}>
|
|
307
|
+
{busy ? "Posting…" : `Post to ${networks.length || "your"} ${networks.length === 1 ? "network" : "networks"}`}
|
|
308
|
+
</Button>
|
|
309
|
+
{problem && <ErrorNote>{problem}</ErrorNote>}
|
|
310
|
+
</Stack>
|
|
311
|
+
</div>
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
## Building it well
|
|
317
|
+
|
|
318
|
+
- One draft, many networks: show each network's character count against its
|
|
319
|
+
own limit, and say before the press that Instagram needs a photo.
|
|
320
|
+
- A network the visitor has not connected shows its Connect button in place;
|
|
321
|
+
the rest of the composer keeps working.
|
|
322
|
+
- Keep the post's text exactly as written. Hashtags work everywhere; an
|
|
323
|
+
@-mention is plain text on LinkedIn.
|
|
324
|
+
- Save what was posted (text, picture, the per-network links) once it has
|
|
325
|
+
posted, as a record the visitor reads, so they can see their history.
|
|
326
|
+
- A visitor's account is never a pasted token or a `ctx.secrets` value, and the
|
|
327
|
+
app never builds an `Authorization` header: the platform attaches the
|
|
328
|
+
credential.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibes.diy/prompts",
|
|
3
|
-
"version": "14.3.
|
|
3
|
+
"version": "14.3.243",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"exports": {
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"license": "Apache-2.0",
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@adviser/cement": "~0.5.34",
|
|
42
|
-
"@vibes.diy/api-types": "14.3.
|
|
43
|
-
"@vibes.diy/call-ai-v2": "14.3.
|
|
44
|
-
"@vibes.diy/identity": "14.3.
|
|
45
|
-
"@vibes.diy/use-vibes-types": "14.3.
|
|
42
|
+
"@vibes.diy/api-types": "14.3.243",
|
|
43
|
+
"@vibes.diy/call-ai-v2": "14.3.243",
|
|
44
|
+
"@vibes.diy/identity": "14.3.243",
|
|
45
|
+
"@vibes.diy/use-vibes-types": "14.3.243",
|
|
46
46
|
"arktype": "~2.2.8",
|
|
47
47
|
"json-schema-faker": "~0.6.3"
|
|
48
48
|
},
|