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 main into the publish form review branch

Claude588d19987e47
diff --cc client/src/components/musicVideo/PublishPostingPanel.jsx
index 2e140a3ee1,9c1e22ed07..59652857e2
--- a/client/src/components/musicVideo/PublishPostingPanel.jsx
+++ b/client/src/components/musicVideo/PublishPostingPanel.jsx
@@@ -1,9 -1,9 +1,9 @@@
import { useEffect, useState } from 'react';
import ConfirmButtonPair from '../ui/ConfirmButtonPair.jsx';
-import { safeReadJsonStorage, safeWriteJsonStorage } from '../../lib/safeStorage.js';
+import { safeReadJsonStorage, safeRemoveStorage } from '../../lib/safeStorage.js';
- import { ExternalLink, X as XIcon, LogIn, Link as LinkIcon, Check, ChevronDown, ChevronRight, Undo2 } from 'lucide-react';
+ import { ExternalLink, X as XIcon, LogIn, Link as LinkIcon, Check, ChevronDown, ChevronRight, ImageOff, Undo2 } from 'lucide-react';
import PublishCard from './PublishCard.jsx';
-import { DISTROKID_GENRES, suggestDistrokidGenres } from '../../../../server/lib/distrokidGenres.js';
+import { DISTROKID_GENRES, DISTROKID_REMEMBERED_OPTIONS, suggestDistrokidGenres } from '../../../../server/lib/distrokidGenres.js';
import { publishRowAnchor } from '../../lib/musicVideoStages.js';
// Where the release goes, in posting order: the full video first so every
@@@ -63,7 -58,32 +63,32 @@@ function verticalCutChoices(project)
return cuts;
}
+ /** The story reply's image, picked by sight: a tile per video frame plus "No image". */
+ function StoryImagePicker({ idFor, thumbnails, value, onChange }) {
+ const tile = (selected) => `relative rounded overflow-hidden border-2 aspect-video min-h-[44px] ${selected ? 'border-port-accent ring-2 ring-port-accent/40' : 'border-port-border'}`;
+ const mark = <span className="absolute top-1 right-1 rounded-full bg-port-accent text-white p-0.5" aria-hidden="true"><Check size={12} /></span>;
+ return (
+ <div className="space-y-0.5 min-w-0">
+ <span id={idFor('storyImage')} className="block text-[11px] text-port-text-muted">Image on the story reply (optional)</span>
+ <div role="radiogroup" aria-labelledby={idFor('storyImage')} className="grid grid-cols-3 sm:grid-cols-4 gap-2">
+ <button type="button" role="radio" aria-checked={!value} onClick={() => onChange('')}
+ className={`${tile(!value)} flex items-center justify-center gap-1 bg-port-bg text-xs text-port-text-muted`}>
+ <ImageOff size={14} aria-hidden="true" /> No image
+ {!value && mark}
+ </button>
+ {thumbnails.map((name, i) => (
+ <button key={name} type="button" role="radio" aria-checked={value === name} aria-label={`Video frame ${i + 1}`} title={name}
+ onClick={() => onChange(name)} className={tile(value === name)}>
+ <img src={`/data/video-thumbnails/${encodeURIComponent(name)}`} alt="" loading="lazy" className="w-full h-full object-cover" />
+ {value === name && mark}
+ </button>
+ ))}
+ </div>
+ </div>
+ );
+ }
+
-function TargetOptions({ target, kit, project, options, setOption, flairs, idFor, account }) {
+function TargetOptions({ target, kit, project, options, setOption, commitOption, flairs, idFor, account }) {
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>
diff --cc server/services/musicVideo/publish/index.js
index cda7ad6830,952c0a2e0e..585978e6f4
--- a/server/services/musicVideo/publish/index.js
+++ b/server/services/musicVideo/publish/index.js
@@@ -12,7 -12,8 +12,8 @@@ import { ServerError } from '../../../l
import { PATHS, ensureDir } from '../../../lib/fileUtils.js';
import { safeUnder } from '../../../lib/ffmpeg.js';
import { getProject, mutateProjectRecord } from '../projects.js';
- import { buildPublishPayload, publishPreviewParts } from './payloads.js';
-import { buildPublishPayload, publishSongUrl } from './payloads.js';
++import { buildPublishPayload, publishPreviewParts, publishSongUrl } from './payloads.js';
+ import { canonicalizeSunoUrl, isSunoShareLink } from '../../sunoShareLink.js';
import { connectPortosBrowser, serializeBrowserOperation as serialize } from './browser.js';
import { assertAccount, assertPlatformEnabled, getPublishPlatforms, normalizePost } from './platforms.js';
import { youtubeAdapter, shortsAdapter } from './youtube.js';
@@@ -197,25 -214,6 +214,25 @@@ export async function preparePublishDra
});
}
+/**
+ * What Fill draft would post for `target` with these options, without opening
+ * anything: `{ ready: true, parts }` (the rows the director reads), or
+ * `{ ready: false, problem }` naming what is missing, in the words Fill draft
+ * would refuse with.
+ */
+export async function previewPublishPost(projectId, target, options = {}, deps = {}) {
+ if (!(deps.adapters || PUBLISH_ADAPTERS)[target]) throw new ServerError(`Unknown publish target: ${target}`, { status: 400, code: 'VALIDATION_ERROR' });
+ const project = await getProject(projectId);
+ if (!project) throw new ServerError('Project not found', { status: 404, code: 'NOT_FOUND' });
+ const platforms = deps.platforms || await getPublishPlatforms();
- return Promise.resolve()
- .then(() => buildPublishPayload(target, project, withPlatformDefaults(target, options, platforms)))
++ return withSongPage(target, project, withPlatformDefaults(target, options, platforms), deps)
++ .then((resolved) => buildPublishPayload(target, project, resolved))
+ .then((payload) => ({ ready: true, parts: publishPreviewParts(target, project, payload) }), (err) => {
+ if (err?.status === 422 || err?.status === 409) return { ready: false, problem: err.message };
+ throw err;
+ });
+}
+
/** Close a draft without posting it. */
export async function discardPublishDraft(projectId, draftId, deps = {}) {
const draft = drafts.get(draftId);