@abraca/junis 2.82.0 → 2.83.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/README.md +19 -14
- package/dist/module.json +1 -1
- package/dist/module.mjs +7 -0
- package/dist/runtime/assets/css/jun.css +1 -1
- package/dist/runtime/components/JunCampfireChat.vue +1 -1
- package/dist/runtime/components/JunCampfirePanel.vue +12 -12
- package/dist/runtime/components/JunCampfirePresence.client.vue +8 -8
- package/dist/runtime/components/JunCampfireRoster.vue +13 -13
- package/dist/runtime/components/JunCampfireYou.vue +9 -9
- package/dist/runtime/components/JunGlobeEditor.client.vue +396 -183
- package/dist/runtime/components/JunGlobeMap.client.vue +1 -0
- package/dist/runtime/components/JunHorizontalTimeline.vue +41 -4
- package/dist/runtime/components/JunImagePopup.client.vue +1 -1
- package/dist/runtime/components/renderers/JunAppsRenderer.vue +5 -5
- package/dist/runtime/components/renderers/JunCvRenderer.vue +1 -1
- package/dist/runtime/components/renderers/JunEntryRenderer.vue +1 -1
- package/dist/runtime/components/renderers/JunGuestbookRenderer.vue +2 -0
- package/dist/runtime/components/renderers/JunHomeRenderer.vue +2 -2
- package/dist/runtime/components/renderers/JunJournalRenderer.vue +6 -6
- package/dist/runtime/components/renderers/JunLiveRenderer.vue +2 -1
- package/dist/runtime/components/renderers/JunMovieRenderer.vue +1 -1
- package/dist/runtime/components/renderers/JunNowRenderer.vue +39 -0
- package/dist/runtime/components/renderers/JunProjectRenderer.vue +2 -2
- package/dist/runtime/components/renderers/JunStatsRenderer.vue +15 -2
- package/dist/runtime/components/renderers/JunTrackRenderer.vue +44 -0
- package/dist/runtime/components/renderers/JunWallRenderer.vue +1 -0
- package/dist/runtime/composables/useJunChrome.js +11 -2
- package/dist/runtime/composables/useJunTheme.js +9 -0
- package/dist/runtime/plugins/jun-fresh-server.client.d.ts +2 -0
- package/dist/runtime/plugins/jun-fresh-server.client.js +42 -0
- package/dist/runtime/server/janitor/junJanitorChores.d.ts +23 -2
- package/dist/runtime/server/janitor/junJanitorChores.js +74 -8
- package/dist/runtime/server/janitor/junJanitorMachine.js +16 -2
- package/dist/runtime/server/janitor/junJanitorStore.d.ts +35 -1
- package/dist/runtime/server/janitor/junJanitorStore.js +62 -4
- package/dist/runtime/server/plugins/jun-bootstrap.js +88 -3
- package/dist/runtime/server/utils/junVisibility.js +2 -0
- package/dist/runtime/utils/junVisibility.js +2 -0
- package/package.json +4 -2
|
@@ -2,11 +2,35 @@ import { junDiffText, describeSize, editShape } from "./junJanitorDiff.js";
|
|
|
2
2
|
export const JUN_CHORE_POLICY_DEFAULT = {
|
|
3
3
|
backspaceLimit: 90,
|
|
4
4
|
wholesaleLimit: 4e3,
|
|
5
|
-
// Deliberately short
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
|
|
5
|
+
// Deliberately short, and every entry has to earn its place — anything left
|
|
6
|
+
// out here IS reverted, which is the point. Four kinds of thing belong:
|
|
7
|
+
//
|
|
8
|
+
// - VISITOR-CONTRIBUTED. `appreciatedBy` is the reaction list the RPC runner
|
|
9
|
+
// appends to. A janitor that reverted it would be un-hearting visitors'
|
|
10
|
+
// reactions, which is not tidying, it is vandalism with a mop.
|
|
11
|
+
// - DERIVED BOOKKEEPING. `slugAliases` is written by `useJunRename` to keep
|
|
12
|
+
// a vacated URL redirecting. Reverting it would break the 301 for a
|
|
13
|
+
// rename the janitor itself is about to undo, and the rename chore already
|
|
14
|
+
// restores the label the alias exists for.
|
|
15
|
+
// - IDENTITY AND TIMESTAMPS. Not content, and `order` has its own chore —
|
|
16
|
+
// comparing it here too would queue two chores for one displacement.
|
|
17
|
+
// - INFRASTRUCTURE FLAGS. The documents carrying these are already excluded
|
|
18
|
+
// wholesale by `isJunOwnerOnlyDoc`; the keys are named again so that a
|
|
19
|
+
// flag appearing on an ordinary page cannot be reverted into a site that
|
|
20
|
+
// hides it, or out of one.
|
|
21
|
+
metaIgnore: [
|
|
22
|
+
"appreciatedBy",
|
|
23
|
+
"slugAliases",
|
|
24
|
+
"createdAt",
|
|
25
|
+
"updatedAt",
|
|
26
|
+
"order",
|
|
27
|
+
"_metaInitialized",
|
|
28
|
+
"janitorBaseline",
|
|
29
|
+
"ownerOnly",
|
|
30
|
+
"siteConfig",
|
|
31
|
+
"campfire",
|
|
32
|
+
"junSite"
|
|
33
|
+
],
|
|
10
34
|
ignoreDocIds: [],
|
|
11
35
|
protectChildCount: 1
|
|
12
36
|
};
|
|
@@ -90,6 +114,7 @@ export function planTreeChores(baseline, live, options = {}) {
|
|
|
90
114
|
const policy = options.policy ?? JUN_CHORE_POLICY_DEFAULT;
|
|
91
115
|
const chores = [];
|
|
92
116
|
const ignored = new Set(policy.ignoreDocIds);
|
|
117
|
+
const ignoredKeys = new Set(policy.metaIgnore);
|
|
93
118
|
for (const [id, base] of Object.entries(baseline.docs)) {
|
|
94
119
|
if (ignored.has(id)) continue;
|
|
95
120
|
const now = live.docs[id];
|
|
@@ -126,7 +151,31 @@ export function planTreeChores(baseline, live, options = {}) {
|
|
|
126
151
|
severity: "minor"
|
|
127
152
|
});
|
|
128
153
|
}
|
|
129
|
-
|
|
154
|
+
if (now.parentId !== base.parentId) {
|
|
155
|
+
chores.push({
|
|
156
|
+
kind: "entry.move",
|
|
157
|
+
id: `move:${id}`,
|
|
158
|
+
docId: id,
|
|
159
|
+
parentId: base.parentId,
|
|
160
|
+
severity: "notable"
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
if (now.type !== base.type) {
|
|
164
|
+
chores.push({
|
|
165
|
+
kind: "entry.type",
|
|
166
|
+
id: `type:${id}`,
|
|
167
|
+
docId: id,
|
|
168
|
+
from: now.type,
|
|
169
|
+
to: base.type,
|
|
170
|
+
severity: "notable"
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
const keys = /* @__PURE__ */ new Set([
|
|
174
|
+
...Object.keys(base.meta ?? {}),
|
|
175
|
+
...Object.keys(now.meta ?? {})
|
|
176
|
+
]);
|
|
177
|
+
for (const key of keys) {
|
|
178
|
+
if (ignoredKeys.has(key)) continue;
|
|
130
179
|
const want = base.meta?.[key];
|
|
131
180
|
const have = now.meta?.[key];
|
|
132
181
|
if (stableEqual(want, have)) continue;
|
|
@@ -153,14 +202,27 @@ export function planTreeChores(baseline, live, options = {}) {
|
|
|
153
202
|
}
|
|
154
203
|
return chores;
|
|
155
204
|
}
|
|
205
|
+
function canonical(value) {
|
|
206
|
+
if (Array.isArray(value)) return value.map(canonical);
|
|
207
|
+
if (value && typeof value === "object") {
|
|
208
|
+
return Object.fromEntries(
|
|
209
|
+
Object.entries(value).map(([k, v]) => [k, canonical(v)]).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0)
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
return value;
|
|
213
|
+
}
|
|
156
214
|
function stableEqual(a, b) {
|
|
157
215
|
if (a === b) return true;
|
|
158
216
|
if (a == null || b == null) return a == null && b == null;
|
|
159
217
|
if (Array.isArray(a) && Array.isArray(b)) {
|
|
160
|
-
|
|
218
|
+
if (a.length !== b.length) return false;
|
|
219
|
+
const sortKey = (v) => JSON.stringify(canonical(v));
|
|
220
|
+
const left = a.map(sortKey).sort();
|
|
221
|
+
const right = b.map(sortKey).sort();
|
|
222
|
+
return left.every((v, i) => v === right[i]);
|
|
161
223
|
}
|
|
162
224
|
if (typeof a === "object" && typeof b === "object") {
|
|
163
|
-
return JSON.stringify(a) === JSON.stringify(b);
|
|
225
|
+
return JSON.stringify(canonical(a)) === JSON.stringify(canonical(b));
|
|
164
226
|
}
|
|
165
227
|
return false;
|
|
166
228
|
}
|
|
@@ -177,6 +239,10 @@ export function describeChore(chore) {
|
|
|
177
239
|
};
|
|
178
240
|
case "entry.rename":
|
|
179
241
|
return { what: `the name`, verb: "changed" };
|
|
242
|
+
case "entry.type":
|
|
243
|
+
return { what: "the kind of page", verb: "changed" };
|
|
244
|
+
case "entry.move":
|
|
245
|
+
return { what: "where this lives", verb: "moved" };
|
|
180
246
|
case "entry.reorder":
|
|
181
247
|
return { what: "the order", verb: "shuffled" };
|
|
182
248
|
case "entry.meta":
|
|
@@ -18,7 +18,8 @@ import {
|
|
|
18
18
|
import { createJunVoice } from "./junJanitorVoice.js";
|
|
19
19
|
import {
|
|
20
20
|
JUN_PATROL_POLICY_DEFAULT,
|
|
21
|
-
nextPatrolTarget
|
|
21
|
+
nextPatrolTarget,
|
|
22
|
+
scorePatrol
|
|
22
23
|
} from "./junJanitorPatrol.js";
|
|
23
24
|
import { junHear } from "./junJanitorListen.js";
|
|
24
25
|
import { junBlocks, displayToBody, displayToBodyPos, junCursorState, junFragmentText } from "./junJanitorYText.js";
|
|
@@ -244,6 +245,12 @@ export function createJunJanitorMachine(options, deps) {
|
|
|
244
245
|
case "entry.reorder":
|
|
245
246
|
await deps.tree.reorder(chore.docId, chore.order);
|
|
246
247
|
return true;
|
|
248
|
+
case "entry.type":
|
|
249
|
+
await deps.tree.setType(chore.docId, chore.to);
|
|
250
|
+
return true;
|
|
251
|
+
case "entry.move":
|
|
252
|
+
await deps.tree.move(chore.docId, chore.parentId);
|
|
253
|
+
return true;
|
|
247
254
|
case "entry.meta":
|
|
248
255
|
await deps.tree.setMeta(chore.docId, chore.key, chore.value);
|
|
249
256
|
return true;
|
|
@@ -456,8 +463,15 @@ export function createJunJanitorMachine(options, deps) {
|
|
|
456
463
|
pendingChores: 0
|
|
457
464
|
};
|
|
458
465
|
});
|
|
466
|
+
const ranked = scorePatrol(candidates, at, patrolPolicy);
|
|
459
467
|
const target = nextPatrolTarget(candidates, at, patrolPolicy);
|
|
460
|
-
|
|
468
|
+
const top = ranked.slice(0, 3).map((r) => {
|
|
469
|
+
const why = r.skipped ? r.skipped : r.score.toFixed(1);
|
|
470
|
+
return `${labelOf(live, r.candidate.docId)}=${why}`;
|
|
471
|
+
}).join(" ");
|
|
472
|
+
deps.log(
|
|
473
|
+
`patrol: ${candidates.length} candidates \u2192 ${target?.docId.slice(0, 8) ?? "nowhere"}${top ? ` [${top}]` : ""}`
|
|
474
|
+
);
|
|
461
475
|
if (!target) {
|
|
462
476
|
phase = "idle";
|
|
463
477
|
deps.actor.setStatus(null);
|
|
@@ -76,6 +76,24 @@ export declare function createJunTreeWriter(options: JunTreeWriterOptions): {
|
|
|
76
76
|
*/
|
|
77
77
|
rename(docId: string, label: string): Promise<void>;
|
|
78
78
|
reorder(docId: string, order: number): Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Put a page back where it belongs.
|
|
81
|
+
*
|
|
82
|
+
* Slugs are derived from the tree, so this MOVES the page's URL — the same
|
|
83
|
+
* consequence a rename has. The vacated path is not recorded as an alias:
|
|
84
|
+
* `meta.slugAliases` is keyed on labels by `useJunRename`, and inventing a
|
|
85
|
+
* second convention for parents would put two writers on one key.
|
|
86
|
+
*/
|
|
87
|
+
move(docId: string, parentId: string | null): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* Put a page's TYPE back.
|
|
90
|
+
*
|
|
91
|
+
* The type and the meta go in one `set`, the same rule the media importer
|
|
92
|
+
* follows: two writes leave a window in which the page is one kind of thing
|
|
93
|
+
* carrying another kind's fields, and that is what every peer renders until
|
|
94
|
+
* the second lands.
|
|
95
|
+
*/
|
|
96
|
+
setType(docId: string, type: string): Promise<void>;
|
|
79
97
|
setMeta(docId: string, key: string, value: unknown): Promise<void>;
|
|
80
98
|
/**
|
|
81
99
|
* Trash a page the canonical way: copy the entry into `doc-trash`, then
|
|
@@ -86,7 +104,23 @@ export declare function createJunTreeWriter(options: JunTreeWriterOptions): {
|
|
|
86
104
|
* appear to have failed. See CLAUDE.md, "Trash documents the canonical way".
|
|
87
105
|
*/
|
|
88
106
|
trash(docId: string): Promise<void>;
|
|
89
|
-
/**
|
|
107
|
+
/**
|
|
108
|
+
* Put a trashed page back where it was.
|
|
109
|
+
*
|
|
110
|
+
* A page can be gone in TWO shapes, and this used to handle only one. The
|
|
111
|
+
* canonical trash (`useChildTree.deleteEntry`, and this writer's own
|
|
112
|
+
* `trash`) copies the entry into `doc-trash` and DELETES it from
|
|
113
|
+
* `doc-tree`. But an entry can also be flagged `trashed: true` in place —
|
|
114
|
+
* `planTreeChores` raises a `doc.restore` for exactly that case, and
|
|
115
|
+
* `junReadTree` carries the flag for it.
|
|
116
|
+
*
|
|
117
|
+
* The old guard was `if (tree.get(docId)) return`, so the in-place shape
|
|
118
|
+
* fell straight through it and did nothing — while the confirmation
|
|
119
|
+
* (`!!shared().get(docId)`) found the entry still sitting there and
|
|
120
|
+
* reported the chore DONE. A restore that silently declines is the failure
|
|
121
|
+
* this module warns about everywhere else: a write that reports success
|
|
122
|
+
* and did not happen.
|
|
123
|
+
*/
|
|
90
124
|
restore(docId: string, entry: JunTreeEntry): Promise<void>;
|
|
91
125
|
};
|
|
92
126
|
export type JunTreeWriter = ReturnType<typeof createJunTreeWriter>;
|
|
@@ -120,6 +120,44 @@ export function createJunTreeWriter(options) {
|
|
|
120
120
|
).then(() => {
|
|
121
121
|
});
|
|
122
122
|
},
|
|
123
|
+
/**
|
|
124
|
+
* Put a page back where it belongs.
|
|
125
|
+
*
|
|
126
|
+
* Slugs are derived from the tree, so this MOVES the page's URL — the same
|
|
127
|
+
* consequence a rename has. The vacated path is not recorded as an alias:
|
|
128
|
+
* `meta.slugAliases` is keyed on labels by `useJunRename`, and inventing a
|
|
129
|
+
* second convention for parents would put two writers on one key.
|
|
130
|
+
*/
|
|
131
|
+
move(docId, parentId) {
|
|
132
|
+
return withTree(
|
|
133
|
+
(tree) => {
|
|
134
|
+
const entry = plain(tree.get(docId));
|
|
135
|
+
if (!entry || entry.parentId === parentId) return;
|
|
136
|
+
tree.set(docId, { ...entry, parentId, updatedAt: Date.now() });
|
|
137
|
+
},
|
|
138
|
+
() => plain(shared().get(docId))?.parentId === parentId
|
|
139
|
+
).then(() => {
|
|
140
|
+
});
|
|
141
|
+
},
|
|
142
|
+
/**
|
|
143
|
+
* Put a page's TYPE back.
|
|
144
|
+
*
|
|
145
|
+
* The type and the meta go in one `set`, the same rule the media importer
|
|
146
|
+
* follows: two writes leave a window in which the page is one kind of thing
|
|
147
|
+
* carrying another kind's fields, and that is what every peer renders until
|
|
148
|
+
* the second lands.
|
|
149
|
+
*/
|
|
150
|
+
setType(docId, type) {
|
|
151
|
+
return withTree(
|
|
152
|
+
(tree) => {
|
|
153
|
+
const entry = plain(tree.get(docId));
|
|
154
|
+
if (!entry || entry.type === type) return;
|
|
155
|
+
tree.set(docId, { ...entry, type, updatedAt: Date.now() });
|
|
156
|
+
},
|
|
157
|
+
() => plain(shared().get(docId))?.type === type
|
|
158
|
+
).then(() => {
|
|
159
|
+
});
|
|
160
|
+
},
|
|
123
161
|
setMeta(docId, key, value) {
|
|
124
162
|
return withTree(
|
|
125
163
|
(tree) => {
|
|
@@ -159,22 +197,42 @@ export function createJunTreeWriter(options) {
|
|
|
159
197
|
).then(() => {
|
|
160
198
|
});
|
|
161
199
|
},
|
|
162
|
-
/**
|
|
200
|
+
/**
|
|
201
|
+
* Put a trashed page back where it was.
|
|
202
|
+
*
|
|
203
|
+
* A page can be gone in TWO shapes, and this used to handle only one. The
|
|
204
|
+
* canonical trash (`useChildTree.deleteEntry`, and this writer's own
|
|
205
|
+
* `trash`) copies the entry into `doc-trash` and DELETES it from
|
|
206
|
+
* `doc-tree`. But an entry can also be flagged `trashed: true` in place —
|
|
207
|
+
* `planTreeChores` raises a `doc.restore` for exactly that case, and
|
|
208
|
+
* `junReadTree` carries the flag for it.
|
|
209
|
+
*
|
|
210
|
+
* The old guard was `if (tree.get(docId)) return`, so the in-place shape
|
|
211
|
+
* fell straight through it and did nothing — while the confirmation
|
|
212
|
+
* (`!!shared().get(docId)`) found the entry still sitting there and
|
|
213
|
+
* reported the chore DONE. A restore that silently declines is the failure
|
|
214
|
+
* this module warns about everywhere else: a write that reports success
|
|
215
|
+
* and did not happen.
|
|
216
|
+
*/
|
|
163
217
|
restore(docId, entry) {
|
|
164
218
|
return withTree(
|
|
165
219
|
(tree) => {
|
|
166
|
-
if (tree.get(docId)) return;
|
|
167
220
|
const trash = tree.doc.getMap("doc-trash");
|
|
221
|
+
const current = plain(tree.get(docId));
|
|
222
|
+
if (current && current.trashed !== true) return;
|
|
168
223
|
const stored = plain(trash.get(docId));
|
|
169
224
|
tree.set(docId, {
|
|
170
|
-
...stored ?? entry,
|
|
225
|
+
...stored ?? current ?? entry,
|
|
171
226
|
...entry,
|
|
172
227
|
trashed: false,
|
|
173
228
|
updatedAt: Date.now()
|
|
174
229
|
});
|
|
175
230
|
trash.delete(docId);
|
|
176
231
|
},
|
|
177
|
-
() =>
|
|
232
|
+
() => {
|
|
233
|
+
const back = plain(shared().get(docId));
|
|
234
|
+
return !!back && back.trashed !== true;
|
|
235
|
+
}
|
|
178
236
|
).then(() => {
|
|
179
237
|
});
|
|
180
238
|
}
|
|
@@ -245,9 +245,12 @@ function defaultTree(typeIds) {
|
|
|
245
245
|
label: "Wall",
|
|
246
246
|
type: typeIds.wall,
|
|
247
247
|
icon: "i-lucide-images",
|
|
248
|
-
// No children
|
|
249
|
-
//
|
|
250
|
-
//
|
|
248
|
+
// No children. A REAL deployment's wall starts empty on purpose — its
|
|
249
|
+
// items are the owner's photographs, and inventing two would put stock
|
|
250
|
+
// images on somebody's site. The playground seeds a pair (via
|
|
251
|
+
// `seedWallPhoto`, see `seedWallPhotos`) because a demo that cannot show
|
|
252
|
+
// the type is the thing that left the lightbox and this page's presence
|
|
253
|
+
// anchoring unverifiable for a release.
|
|
251
254
|
meta: { excerpt: "Drop images here to pin them." }
|
|
252
255
|
});
|
|
253
256
|
}
|
|
@@ -563,6 +566,7 @@ async function bootstrap(ctx, seed) {
|
|
|
563
566
|
}
|
|
564
567
|
}
|
|
565
568
|
await writeBodies(ctx, flat);
|
|
569
|
+
await seedWallPhotos(ctx, flat, tree);
|
|
566
570
|
console.log(`[jun:bootstrap] seeded ${flat.length} documents \u2014 site is live`);
|
|
567
571
|
} finally {
|
|
568
572
|
try {
|
|
@@ -571,6 +575,87 @@ async function bootstrap(ctx, seed) {
|
|
|
571
575
|
}
|
|
572
576
|
}
|
|
573
577
|
}
|
|
578
|
+
function crc32(buf) {
|
|
579
|
+
let c = ~0;
|
|
580
|
+
for (let i = 0; i < buf.length; i++) {
|
|
581
|
+
c ^= buf[i];
|
|
582
|
+
for (let k = 0; k < 8; k++) c = c >>> 1 ^ 3988292384 & -(c & 1);
|
|
583
|
+
}
|
|
584
|
+
return ~c >>> 0;
|
|
585
|
+
}
|
|
586
|
+
function pngChunk(type, data) {
|
|
587
|
+
const typeBytes = new TextEncoder().encode(type);
|
|
588
|
+
const body = new Uint8Array(typeBytes.length + data.length);
|
|
589
|
+
body.set(typeBytes);
|
|
590
|
+
body.set(data, typeBytes.length);
|
|
591
|
+
const out = new Uint8Array(8 + data.length + 4);
|
|
592
|
+
const view = new DataView(out.buffer);
|
|
593
|
+
view.setUint32(0, data.length);
|
|
594
|
+
out.set(body, 4);
|
|
595
|
+
view.setUint32(4 + body.length, crc32(body));
|
|
596
|
+
return out;
|
|
597
|
+
}
|
|
598
|
+
async function makePng(width, height, hue) {
|
|
599
|
+
const { deflateSync } = await import("node:zlib");
|
|
600
|
+
const raw = new Uint8Array(height * (1 + width * 3));
|
|
601
|
+
let p = 0;
|
|
602
|
+
for (let y = 0; y < height; y++) {
|
|
603
|
+
raw[p++] = 0;
|
|
604
|
+
for (let x = 0; x < width; x++) {
|
|
605
|
+
const t = (x / width + y / height) / 2;
|
|
606
|
+
raw[p++] = Math.round(40 + 180 * t * Math.abs(Math.cos(hue)));
|
|
607
|
+
raw[p++] = Math.round(60 + 150 * (1 - t) * Math.abs(Math.sin(hue * 1.7)));
|
|
608
|
+
raw[p++] = Math.round(90 + 140 * t);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
const ihdr = new Uint8Array(13);
|
|
612
|
+
const iv = new DataView(ihdr.buffer);
|
|
613
|
+
iv.setUint32(0, width);
|
|
614
|
+
iv.setUint32(4, height);
|
|
615
|
+
ihdr[8] = 8;
|
|
616
|
+
ihdr[9] = 2;
|
|
617
|
+
const idat = new Uint8Array(deflateSync(Buffer.from(raw)));
|
|
618
|
+
const parts = [
|
|
619
|
+
new Uint8Array([137, 80, 78, 71, 13, 10, 26, 10]),
|
|
620
|
+
pngChunk("IHDR", ihdr),
|
|
621
|
+
pngChunk("IDAT", idat),
|
|
622
|
+
pngChunk("IEND", new Uint8Array(0))
|
|
623
|
+
];
|
|
624
|
+
const total = parts.reduce((n, part) => n + part.length, 0);
|
|
625
|
+
const png = new Uint8Array(total);
|
|
626
|
+
let at = 0;
|
|
627
|
+
for (const part of parts) {
|
|
628
|
+
png.set(part, at);
|
|
629
|
+
at += part.length;
|
|
630
|
+
}
|
|
631
|
+
return png;
|
|
632
|
+
}
|
|
633
|
+
async function seedWallPhotos(ctx, flat, tree) {
|
|
634
|
+
const photos = flat.filter((n) => n.meta?.seedWallPhoto);
|
|
635
|
+
if (!photos.length) return;
|
|
636
|
+
let seeded = 0;
|
|
637
|
+
for (const [index, node] of photos.entries()) {
|
|
638
|
+
try {
|
|
639
|
+
const png = await makePng(1200, 800, 0.7 + index * 1.3);
|
|
640
|
+
const meta = await ctx.client.upload(node.id, new Blob([png], { type: "image/png" }), `${node.id}.png`);
|
|
641
|
+
const uploadId = meta?.id ?? meta?.upload_id;
|
|
642
|
+
if (!uploadId) throw new Error("upload returned no id");
|
|
643
|
+
const entry = tree.get(node.id);
|
|
644
|
+
if (!entry) throw new Error("tree entry vanished");
|
|
645
|
+
const entryMeta = { ...entry.meta ?? {} };
|
|
646
|
+
delete entryMeta.seedWallPhoto;
|
|
647
|
+
tree.set(node.id, {
|
|
648
|
+
...entry,
|
|
649
|
+
updatedAt: Date.now(),
|
|
650
|
+
meta: { ...entryMeta, coverUploadId: uploadId, coverMimeType: "image/png" }
|
|
651
|
+
});
|
|
652
|
+
seeded++;
|
|
653
|
+
} catch (err) {
|
|
654
|
+
console.warn(`[jun:bootstrap] wall photo "${node.label}" failed:`, err?.message ?? err);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
if (seeded) console.log(`[jun:bootstrap] uploaded ${seeded} wall photo(s)`);
|
|
658
|
+
}
|
|
574
659
|
function attachJsonNodes(target, nodes) {
|
|
575
660
|
for (const node of nodes) {
|
|
576
661
|
if (node.kind === "element") {
|
|
@@ -2,5 +2,7 @@ export function isJunOwnerOnlyDoc(entry) {
|
|
|
2
2
|
if (!entry) return false;
|
|
3
3
|
if (entry.type === "jun-config") return true;
|
|
4
4
|
if (entry.meta?.siteConfig === true) return true;
|
|
5
|
+
if (entry.meta?.ownerOnly === true) return true;
|
|
6
|
+
if (entry.meta?.janitorBaseline === true) return true;
|
|
5
7
|
return entry.meta?.campfire === true;
|
|
6
8
|
}
|
|
@@ -2,5 +2,7 @@ export function isJunOwnerOnlyDoc(entry) {
|
|
|
2
2
|
if (!entry) return false;
|
|
3
3
|
if (entry.type === "jun-config") return true;
|
|
4
4
|
if (entry.meta?.siteConfig === true) return true;
|
|
5
|
+
if (entry.meta?.ownerOnly === true) return true;
|
|
6
|
+
if (entry.meta?.janitorBaseline === true) return true;
|
|
5
7
|
return entry.meta?.campfire === true;
|
|
6
8
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abraca/junis",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.83.0",
|
|
4
4
|
"description": "Website-builder Nuxt module for the Abracadabra CRDT platform — page-type renderers, presence chrome, studio editing and SSR, all driven by documents",
|
|
5
5
|
"repository": "abracadabra/jun-is",
|
|
6
6
|
"license": "MIT",
|
|
@@ -99,6 +99,7 @@
|
|
|
99
99
|
"dev:clean": "node scripts/dev-clean.mjs",
|
|
100
100
|
"lint": "eslint .",
|
|
101
101
|
"janitor:watch": "node scripts/janitor-watch.mjs",
|
|
102
|
+
"janitor:verify": "node scripts/janitor-verify.mjs",
|
|
102
103
|
"test": "node scripts/test.mjs",
|
|
103
104
|
"parity": "node scripts/parity-ssr.mjs",
|
|
104
105
|
"parity:nav": "node scripts/parity-nav.mjs",
|
|
@@ -107,6 +108,7 @@
|
|
|
107
108
|
"docker:up": "docker compose up -d --build",
|
|
108
109
|
"docker:down": "docker compose down",
|
|
109
110
|
"docker:logs": "docker compose logs -f",
|
|
110
|
-
"docker:reset": "node scripts/docker-reset.mjs"
|
|
111
|
+
"docker:reset": "node scripts/docker-reset.mjs",
|
|
112
|
+
"janitor:inspect": "node scripts/janitor-inspect.mjs"
|
|
111
113
|
}
|
|
112
114
|
}
|