Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

Merge remote-tracking branch 'origin/main' into claude/suno-hook-fill-fix-ljrc56

Claudef90b0b6d58c1
diff --cc client/src/components/musicVideo/PublishPostingPanel.jsx
index c80c9c9f7b,59652857e2..5039b67fa7
--- a/client/src/components/musicVideo/PublishPostingPanel.jsx
+++ b/client/src/components/musicVideo/PublishPostingPanel.jsx
@@@ -129,7 -88,7 +134,7 @@@ function StoryImagePicker({ idFor, thum
);
}
- function TargetOptions({ target, kit, project, options, setOption, flairs, idFor, account, excerpts }) {
-function TargetOptions({ target, kit, project, options, setOption, commitOption, flairs, idFor, account }) {
++function TargetOptions({ target, kit, project, options, setOption, commitOption, flairs, idFor, account, excerpts }) {
const field = (key, label, input) => (
<div key={key} className="space-y-0.5 min-w-0">
<label htmlFor={idFor(key)} className="block text-[11px] text-port-text-muted">{label}</label>
@@@ -338,9 -296,64 +345,64 @@@ function UndoDone({ label, onUndo })
);
}
+ /** The DistroKid answers kept in settings, else (older installs) the ones this device remembered. */
+ function rememberedDistrokid(platform) {
+ const kept = platform?.defaults || {};
+ return Object.keys(kept).length ? { ...kept } : legacyDistrokid();
+ }
+ function legacyDistrokid() {
+ const saved = safeReadJsonStorage(SONGWRITER_KEY, {}) || {};
+ return Object.fromEntries(Object.entries(LEGACY_REMEMBERED).filter(([, k]) => typeof saved[k] === 'string' && saved[k].trim()).map(([opt, k]) => [opt, saved[k].trim()]));
+ }
+
+ // The kit fields a post is built from: a change to any of them refreshes the preview.
+ const kitStamp = (project) => {
+ const kit = project?.publishKit || {};
+ return JSON.stringify([project?.name, project?.renderHistoryId, kit.copy, kit.links, kit.posts, kit.thumbnail, kit.coverArt?.filename, kit.master, kit.exports, kit.chapters, project?.excerpts?.length]);
+ };
+
+ /** What Fill draft would post for this row, re-read (briefly debounced) when its options or the kit change. */
+ function usePostPreview({ open, target, options, project, publishing }) {
+ const [preview, setPreview] = useState(null);
+ const optionsKey = JSON.stringify(options);
+ const stamp = kitStamp(project);
+ useEffect(() => {
+ if (!open || !publishing.preview) return undefined;
+ let active = true;
+ const timer = setTimeout(() => {
+ publishing.preview(target, options).then((res) => { if (active) setPreview(res); });
+ }, 400);
+ return () => { active = false; clearTimeout(timer); };
+ // `options` is keyed by its JSON; the hook's functions are stable enough per project.
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [open, target, optionsKey, stamp, project?.id]);
+ return preview;
+ }
+
+ /** "What gets posted": every word and file Fill draft will put in the post, or what is still missing. */
+ function PostPreview({ label, preview }) {
+ if (!preview) return null;
+ if (!preview.ready) {
+ return <p role="status" className="text-[11px] text-port-warning">Not ready to fill: {preview.problem}</p>;
+ }
+ return (
+ <details className="rounded border border-port-border bg-port-bg/50 p-2 text-[11px]" open>
+ <summary className="cursor-pointer font-medium min-h-[44px] sm:min-h-0 flex items-center">What gets posted to {label}</summary>
+ <dl className="mt-1 space-y-1">
+ {(preview.parts || []).map(({ label: rowLabel, text }, i) => (
+ <div key={`${rowLabel}-${i}`}>
+ <dt className="text-port-text-muted">{rowLabel}</dt>
+ <dd className="min-w-0 break-words whitespace-pre-wrap">{text}</dd>
+ </div>
+ ))}
+ </dl>
+ </details>
+ );
+ }
+
const STATUS = { posted: ['Done', 'text-port-success border-port-success/40'], draft: ['Draft open', 'text-port-warning border-port-warning/40'], none: ['To do', 'text-port-text-muted border-port-border'] };
-function TargetRow({ project, kit, entry, publishing }) {
+function TargetRow({ project, kit, entry, publishing, excerpts }) {
const { target, label, note, linkPlaceholder } = entry;
const idFor = (key) => `mv-post-${project.id}-${target}-${key}`;
const [options, setOptions] = useState(() => {
@@@ -433,16 -463,16 +512,16 @@@
)}
</div>
{open && <div id={idFor('body')} className="space-y-2">
- {posted
- ? (
- <>
- <PostFeedback key={posted.url || 'post'} idFor={idFor} label={label} post={posted} onSave={(body) => publishing.recordPost(target, body)} />
- {!posted.url && <ManualLink idFor={idFor} label={label} placeholder={linkPlaceholder} onSave={(body) => publishing.recordPost(target, body)} hideMarkDone />}
- <UndoDone label={label} onUndo={() => publishing.removePost?.(target)} />
- </>
- )
- : <ManualLink idFor={idFor} label={label} placeholder={linkPlaceholder} onSave={(body) => publishing.recordPost(target, body)} />}
- <TargetOptions target={target} kit={kit} project={project} options={options} setOption={setOption} flairs={flairs} idFor={idFor} account={account} excerpts={excerpts} />
+ {posted && (
+ <>
+ <PostFeedback key={posted.url || 'post'} idFor={idFor} label={label} post={posted} onSave={(body) => publishing.recordPost(target, body)} />
+ {!posted.url && <ManualLink idFor={idFor} label={label} placeholder={linkPlaceholder} onSave={(body) => publishing.recordPost(target, body)} hideMarkDone />}
+ <UndoDone label={label} onUndo={() => publishing.removePost?.(target)} />
+ </>
+ )}
- <TargetOptions target={target} kit={kit} project={project} options={options} setOption={setOption} commitOption={commitOption} flairs={flairs} idFor={idFor} account={account} />
++ <TargetOptions target={target} kit={kit} project={project} options={options} setOption={setOption} commitOption={commitOption} flairs={flairs} idFor={idFor} account={account} excerpts={excerpts} />
+ <PostPreview label={label} preview={preview} />
+ {!posted && <ManualLink idFor={idFor} label={label} placeholder={linkPlaceholder} onSave={(body) => publishing.recordPost(target, body)} />}
{error && (
<div role="alert" className="text-[11px] text-port-error space-y-0.5">
<div className="flex items-center gap-1">{error.code === 'PUBLISH_LOGIN_REQUIRED' && <LogIn size={11} />}{error.message}</div>
@@@ -496,10 -526,10 +575,10 @@@ export default function PublishPostingP
return (
<PublishCard projectId={project.id} cardId="posting" label="Publish manually" icon={ExternalLink}
summary={targets.length ? `${done} of ${targets.length} done` : ''} defaultOpen={!targets.length || done < targets.length}>
- <p className="text-port-text-muted">Sign in to each platform in the PortOS Browser first. Fill draft opens a new tab there and fills the post from the kit and copy above; review and publish yourself on the platform. PortOS cannot submit posts.</p>
+ <p className="text-port-text-muted">Each platform shows what gets posted. Fill draft opens a tab in the PortOS Browser on the computer running PortOS (sign in there first), fills the post and shows a screenshot here. You press Post there. Then paste the post&apos;s link and press Record, or press Mark done when there is no link yet.</p>
{!targets.length && <p className="text-port-text-muted">Turn on the platforms you use under Where you post to prepare drafts. Final publication happens on each platform.</p>}
<ul className="space-y-2">
- {targets.map((entry) => <TargetRow key={`${project.id}-${entry.target}`} project={project} kit={kit} entry={entry} publishing={publishing} />)}
+ {targets.map((entry) => <TargetRow key={`${project.id}-${entry.target}`} project={project} kit={kit} entry={entry} publishing={publishing} excerpts={excerpts} />)}
</ul>
</PublishCard>
);