fix(social): let managed users post without BYOK Upload-Post key
The Post modal and Schedule Week modal gated on the localStorage uploadPostKey, so managed (plan/trial) users saw 'Configure API Keys' even though the backend already posts with the server-side managed key. Gate on isManaged || BYOK keys instead. Fixes #3559 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
687412a860
commit
0311b6143d
3 changed files with 16 additions and 8 deletions
|
|
@ -1167,6 +1167,7 @@ function App() {
|
|||
uploadUserId={uploadUserId}
|
||||
geminiApiKey={apiKey}
|
||||
elevenLabsKey={elevenLabsKey}
|
||||
isManaged={isManaged}
|
||||
onPlay={(time) => handleClipPlay(time)}
|
||||
onPause={handleClipPause}
|
||||
/>
|
||||
|
|
@ -1293,6 +1294,7 @@ function App() {
|
|||
jobId={jobId}
|
||||
uploadPostKey={uploadPostKey}
|
||||
uploadUserId={uploadUserId}
|
||||
isManaged={isManaged}
|
||||
/>
|
||||
|
||||
{showLogin && <LoginModal onClose={() => setShowLogin(false)} />}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import HookModal from './HookModal';
|
|||
import TranslateModal from './TranslateModal';
|
||||
import { renderInBrowser } from '../lib/renderInBrowser';
|
||||
|
||||
export default function ResultCard({ clip, index, jobId, durableUrl, uploadPostKey, uploadUserId, geminiApiKey, elevenLabsKey, onPlay, onPause }) {
|
||||
export default function ResultCard({ clip, index, jobId, durableUrl, uploadPostKey, uploadUserId, geminiApiKey, elevenLabsKey, isManaged, onPlay, onPause }) {
|
||||
const [showModal, setShowModal] = useState(false);
|
||||
const [showSubtitleModal, setShowSubtitleModal] = useState(false);
|
||||
const videoRef = React.useRef(null);
|
||||
|
|
@ -326,8 +326,11 @@ export default function ResultCard({ clip, index, jobId, durableUrl, uploadPostK
|
|||
}
|
||||
};
|
||||
|
||||
// Managed (cloud plan/trial) users post with the server-side key — no BYOK needed
|
||||
const canPost = isManaged || (uploadPostKey && uploadUserId);
|
||||
|
||||
const handlePost = async () => {
|
||||
if (!uploadPostKey || !uploadUserId) {
|
||||
if (!canPost) {
|
||||
setPostResult({ success: false, msg: "Missing API Key or User ID." });
|
||||
return;
|
||||
}
|
||||
|
|
@ -570,7 +573,7 @@ export default function ResultCard({ clip, index, jobId, durableUrl, uploadPostK
|
|||
|
||||
<h3 className="text-lg font-bold text-white mb-4">Post / Schedule</h3>
|
||||
|
||||
{!uploadPostKey && (
|
||||
{!canPost && (
|
||||
<div className="mb-4 p-3 bg-yellow-500/10 border border-yellow-500/20 text-yellow-200 text-xs rounded-lg flex items-start gap-2">
|
||||
<AlertCircle size={14} className="mt-0.5 shrink-0" />
|
||||
<div>Configure API Key in Settings first.</div>
|
||||
|
|
@ -658,7 +661,7 @@ export default function ResultCard({ clip, index, jobId, durableUrl, uploadPostK
|
|||
|
||||
<button
|
||||
onClick={handlePost}
|
||||
disabled={posting || !uploadPostKey}
|
||||
disabled={posting || !canPost}
|
||||
className="w-full py-3 bg-primary hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed rounded-xl text-white font-bold transition-all flex items-center justify-center gap-2"
|
||||
>
|
||||
{posting ? <><Loader2 size={16} className="animate-spin" /> {isScheduling ? 'Scheduling...' : 'Publishing...'}</> : <><Share2 size={16} /> {isScheduling ? 'Schedule Post' : 'Publish Now'}</>}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ function detectTimezone() {
|
|||
}
|
||||
}
|
||||
|
||||
export default function ScheduleWeekModal({ isOpen, onClose, clips, jobId, uploadPostKey, uploadUserId }) {
|
||||
export default function ScheduleWeekModal({ isOpen, onClose, clips, jobId, uploadPostKey, uploadUserId, isManaged }) {
|
||||
const [time, setTime] = useState('12:00');
|
||||
const [timezone, setTimezone] = useState(detectTimezone);
|
||||
const [platforms, setPlatforms] = useState({
|
||||
|
|
@ -104,8 +104,11 @@ export default function ScheduleWeekModal({ isOpen, onClose, clips, jobId, uploa
|
|||
|
||||
const selectedPlatforms = Object.keys(platforms).filter(k => platforms[k]);
|
||||
|
||||
// Managed (cloud plan/trial) users post with the server-side key — no BYOK needed
|
||||
const canPost = isManaged || (uploadPostKey && uploadUserId);
|
||||
|
||||
const handleScheduleAll = async () => {
|
||||
if (!uploadPostKey || !uploadUserId) return;
|
||||
if (!canPost) return;
|
||||
if (selectedPlatforms.length === 0) return;
|
||||
|
||||
setScheduling(true);
|
||||
|
|
@ -183,7 +186,7 @@ export default function ScheduleWeekModal({ isOpen, onClose, clips, jobId, uploa
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{!uploadPostKey && (
|
||||
{!canPost && (
|
||||
<div className="mb-4 p-3 bg-yellow-500/10 border border-yellow-500/20 text-yellow-200 text-xs rounded-lg flex items-start gap-2">
|
||||
<AlertCircle size={14} className="mt-0.5 shrink-0" />
|
||||
<div>Configura tu API Key de Upload-Post en Settings primero.</div>
|
||||
|
|
@ -356,7 +359,7 @@ export default function ScheduleWeekModal({ isOpen, onClose, clips, jobId, uploa
|
|||
{!done ? (
|
||||
<button
|
||||
onClick={handleScheduleAll}
|
||||
disabled={scheduling || !uploadPostKey || selectedPlatforms.length === 0}
|
||||
disabled={scheduling || !canPost || selectedPlatforms.length === 0}
|
||||
className="flex-1 py-3 bg-gradient-to-r from-purple-500 to-indigo-600 hover:from-purple-400 hover:to-indigo-500 text-white rounded-xl font-bold transition-all disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2"
|
||||
>
|
||||
{scheduling ? (
|
||||
|
|
|
|||
Loading…
Reference in a new issue