fix(rpubs): allow public PDF generation + fix zine auto-spawn
- Add publicWrite to rpubs module (PDF gen is computational, not a write) - Fix zine auto-spawn: wait for community-sync-ready event instead of fragile 800ms timeout Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
d39c24c61b
commit
77f2e9ae56
|
|
@ -350,6 +350,7 @@ export const pubsModule: RSpaceModule = {
|
||||||
description: "Drop in a document, get a pocket book",
|
description: "Drop in a document, get a pocket book",
|
||||||
scoping: { defaultScope: 'global', userConfigurable: true },
|
scoping: { defaultScope: 'global', userConfigurable: true },
|
||||||
routes,
|
routes,
|
||||||
|
publicWrite: true,
|
||||||
standaloneDomain: "rpubs.online",
|
standaloneDomain: "rpubs.online",
|
||||||
landingPage: renderLanding,
|
landingPage: renderLanding,
|
||||||
feeds: [
|
feeds: [
|
||||||
|
|
|
||||||
|
|
@ -4425,14 +4425,21 @@
|
||||||
// Auto-spawn shape from ?tool= URL param (e.g. ?tool=folk-zine-gen)
|
// Auto-spawn shape from ?tool= URL param (e.g. ?tool=folk-zine-gen)
|
||||||
const toolParam = urlParams.get("tool");
|
const toolParam = urlParams.get("tool");
|
||||||
if (toolParam && shapeRegistry.has(toolParam)) {
|
if (toolParam && shapeRegistry.has(toolParam)) {
|
||||||
// Wait for sync to initialize, then auto-place the shape
|
const spawnToolShape = () => {
|
||||||
setTimeout(() => {
|
|
||||||
newShape(toolParam);
|
newShape(toolParam);
|
||||||
// Clean up URL param without reload
|
|
||||||
const cleanUrl = new URL(window.location.href);
|
const cleanUrl = new URL(window.location.href);
|
||||||
cleanUrl.searchParams.delete("tool");
|
cleanUrl.searchParams.delete("tool");
|
||||||
history.replaceState(null, "", cleanUrl.pathname + cleanUrl.search);
|
history.replaceState(null, "", cleanUrl.pathname + cleanUrl.search);
|
||||||
}, 800);
|
};
|
||||||
|
// Wait for sync to be ready, or fallback after 2s
|
||||||
|
if (sync._connected) {
|
||||||
|
setTimeout(spawnToolShape, 100);
|
||||||
|
} else {
|
||||||
|
let spawned = false;
|
||||||
|
const onReady = () => { if (!spawned) { spawned = true; setTimeout(spawnToolShape, 100); } };
|
||||||
|
document.addEventListener("community-sync-ready", onReady, { once: true });
|
||||||
|
setTimeout(onReady, 2000); // fallback if sync never fires
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Feed shape — pull live data from another layer/module
|
// Feed shape — pull live data from another layer/module
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue