@vibes.diy/prompts 14.3.243 → 14.3.244

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.
@@ -75,9 +75,10 @@ _started_, never one that already works.
75
75
  **A picture is a public https URL that every network can fetch.** Use a JPEG to
76
76
  post the same picture everywhere: Instagram takes JPEG only, Threads takes JPEG
77
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
78
+ picks is saved as a file on a record every visitor can read (its own
79
+ `grant.public` channel in `access.js`), holding the picture alone (the post's
80
+ words stay off it until a network has them); wait for that save's `synced`
81
+ receipt to read `"accepted"`, then read the record back and its
81
82
  `_files.photo.shareUrl` is the `imageUrl`. (`url` is a `blob:` address only this
82
83
  page can open until then; `shareUrl` is the public one.) Threads and Instagram
83
84
  fetch it themselves; for LinkedIn the platform uploads it for the member, so the
@@ -166,6 +167,23 @@ export async function fetch(request, ctx) {
166
167
  }
167
168
  ```
168
169
 
170
+ ### `access.js`
171
+ ```js app=post-as-you
172
+ // The picture record is the one thing the networks read: Threads and Instagram fetch
173
+ // its file themselves, and the platform fetches it for LinkedIn. So it goes on its own
174
+ // channel that anyone can read, and it holds the picture alone.
175
+ export default function (doc, oldDoc, user) {
176
+ if (doc.type === "picture") {
177
+ if (!user) throw { forbidden: "Sign in to add a picture." };
178
+ // Create-only: everyone can read it, so nobody may swap another visitor's picture.
179
+ if (oldDoc) throw { forbidden: "A saved picture stays as it is." };
180
+ const ch = `picture:${doc._id}`;
181
+ return { channels: [ch], grant: { public: [ch] } };
182
+ }
183
+ throw { forbidden: "unknown record type" };
184
+ }
185
+ ```
186
+
169
187
  ### `App.jsx`
170
188
  ```jsx app=post-as-you
171
189
  import React, { useRef, useState } from "react";
@@ -322,7 +340,9 @@ export default function App() {
322
340
  - Keep the post's text exactly as written. Hashtags work everywhere; an
323
341
  @-mention is plain text on LinkedIn.
324
342
  - 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.
343
+ posted, as a record the visitor reads, so they can see their history. Give it
344
+ its own arm in `access.js` on the visitor's own channel, apart from the
345
+ public picture.
326
346
  - A visitor's account is never a pasted token or a `ctx.secrets` value, and the
327
347
  app never builds an `Authorization` header: the platform attaches the
328
348
  credential.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibes.diy/prompts",
3
- "version": "14.3.243",
3
+ "version": "14.3.244",
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.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",
42
+ "@vibes.diy/api-types": "14.3.244",
43
+ "@vibes.diy/call-ai-v2": "14.3.244",
44
+ "@vibes.diy/identity": "14.3.244",
45
+ "@vibes.diy/use-vibes-types": "14.3.244",
46
46
  "arktype": "~2.2.8",
47
47
  "json-schema-faker": "~0.6.3"
48
48
  },