reafactor readme added instructions and texts

This commit is contained in:
juancarlos.cavero 2025-12-20 13:48:22 +01:00
parent d60c376013
commit 1121b7940f
4 changed files with 47 additions and 47 deletions

View file

@ -34,7 +34,7 @@ OpenShorts leverages state-of-the-art AI to handle the entire content lifecycle:
* **Docker & Docker Compose**. * **Docker & Docker Compose**.
* **Google Gemini API Key** ([Get it for free here](https://aistudio.google.com/app/apikey)). * **Google Gemini API Key** ([Get it for free here](https://aistudio.google.com/app/apikey)).
* **Upload-Post API Key** (Optional, for direct social posting). * **Upload-Post API Key** (Optional, for direct social posting. **Free tier available, no credit card required**).
### 📲 Social Media Setup (Upload-Post) ### 📲 Social Media Setup (Upload-Post)
To enable direct posting, follow these steps: To enable direct posting, follow these steps:
@ -44,7 +44,6 @@ To enable direct posting, follow these steps:
4. **Get API Key**: Navigate to [API Keys](https://app.upload-post.com/api-keys) and generate your key. 4. **Get API Key**: Navigate to [API Keys](https://app.upload-post.com/api-keys) and generate your key.
5. **Use in OpenShorts**: Paste the API Key and select your Profile in the dashboard. 5. **Use in OpenShorts**: Paste the API Key and select your Profile in the dashboard.
![Upload-Post Setup Guide](file:///Users/juancarlos.cavero/.gemini/antigravity/brain/d72ee29e-ee3b-45f0-b00b-fe2d705bb56f/uploaded_image_1766201890395.png)
--- ---

View file

@ -8,7 +8,7 @@ import { getApiUrl } from './config';
// Enhanced "Encryption" using XOR + Base64 with a Salt // Enhanced "Encryption" using XOR + Base64 with a Salt
// This is better than plain Base64 but still client-side. // This is better than plain Base64 but still client-side.
const SECRET_KEY = import.meta.env.VITE_ENCRYPTION_KEY || "OpenShorts-Secret-Key-2025-V1"; const SECRET_KEY = import.meta.env.VITE_ENCRYPTION_KEY || "OpenShorts-Static-Salt-Change-Me";
const ENCRYPTION_PREFIX = "ENC:"; const ENCRYPTION_PREFIX = "ENC:";
const encrypt = (text) => { const encrypt = (text) => {
@ -368,7 +368,15 @@ function App() {
<KeyInput onKeySet={setApiKey} savedKey={apiKey} /> <KeyInput onKeySet={setApiKey} savedKey={apiKey} />
<div className="glass-panel p-6 mt-8"> <div className="glass-panel p-6 mt-8">
<h2 className="text-lg font-semibold mb-4">Social Integration</h2> <div className="flex items-center justify-between mb-4">
<h2 className="text-lg font-semibold">Social Integration</h2>
<span className="text-[10px] bg-white/5 border border-white/5 px-2 py-0.5 rounded text-zinc-500 uppercase tracking-wider">Optional</span>
</div>
<p className="text-xs text-zinc-500 mb-6 leading-relaxed">
Automatically publish your clips to TikTok, Instagram Reels, and YouTube Shorts via <strong>Upload-Post</strong>.
Includes a <strong>free tier</strong> (no credit card required).
If you prefer, you can skip this and manually download/upload your videos.
</p>
<div className="space-y-4"> <div className="space-y-4">
<label className="block text-sm text-zinc-400">Upload-Post API Key</label> <label className="block text-sm text-zinc-400">Upload-Post API Key</label>
<div className="flex gap-2"> <div className="flex gap-2">
@ -495,7 +503,7 @@ function App() {
<div className="flex-1 overflow-y-auto custom-scrollbar p-1"> <div className="flex-1 overflow-y-auto custom-scrollbar p-1">
{results && results.clips && results.clips.length > 0 ? ( {results && results.clips && results.clips.length > 0 ? (
<div className="grid grid-cols-1 xl:grid-cols-2 gap-4 pb-10"> <div className={`grid gap-4 pb-10 ${status === 'complete' ? 'grid-cols-1 xl:grid-cols-2' : 'grid-cols-1'}`}>
{results.clips.map((clip, i) => ( {results.clips.map((clip, i) => (
<ResultCard <ResultCard
key={i} key={i}

View file

@ -66,9 +66,9 @@ export default function ResultCard({ clip, index, jobId, uploadPostKey, uploadUs
const videoUrl = getApiUrl(clip.video_url); const videoUrl = getApiUrl(clip.video_url);
return ( return (
<div className="bg-surface border border-white/5 rounded-2xl overflow-hidden flex flex-col md:flex-row group hover:border-white/10 transition-all animate-[fadeIn_0.5s_ease-out] h-auto md:h-[350px]" style={{ animationDelay: `${index * 0.1}s` }}> <div className="bg-surface border border-white/5 rounded-2xl overflow-hidden flex flex-col md:flex-row group hover:border-white/10 transition-all animate-[fadeIn_0.5s_ease-out] min-h-[300px] h-auto" style={{ animationDelay: `${index * 0.1}s` }}>
{/* Left: Video Preview (Fixed Width on Desktop) */} {/* Left: Video Preview (Responsive Width) */}
<div className="w-full md:w-[200px] bg-black relative shrink-0 aspect-[9/16] md:aspect-auto"> <div className="w-full md:w-[180px] lg:w-[200px] bg-black relative shrink-0 aspect-[9/16] md:aspect-auto">
<video <video
src={videoUrl} src={videoUrl}
controls controls
@ -84,15 +84,15 @@ export default function ResultCard({ clip, index, jobId, uploadPostKey, uploadUs
</div> </div>
{/* Right: Content & Details */} {/* Right: Content & Details */}
<div className="flex-1 p-5 flex flex-col bg-[#121214] overflow-hidden"> <div className="flex-1 p-4 md:p-5 flex flex-col bg-[#121214] overflow-hidden min-w-0">
<div className="mb-4"> <div className="mb-4">
<h3 className="text-base font-bold text-white leading-tight line-clamp-2 mb-2" title={clip.video_title_for_youtube_short}> <h3 className="text-base font-bold text-white leading-tight line-clamp-2 mb-2 break-words" title={clip.video_title_for_youtube_short}>
{clip.video_title_for_youtube_short || "Viral Clip Generated"} {clip.video_title_for_youtube_short || "Viral Clip Generated"}
</h3> </h3>
<div className="flex gap-2 text-[10px] text-zinc-500 font-mono"> <div className="flex flex-wrap gap-2 text-[10px] text-zinc-500 font-mono">
<span className="bg-white/5 px-1.5 py-0.5 rounded border border-white/5">{Math.floor(clip.end - clip.start)}s</span> <span className="bg-white/5 px-1.5 py-0.5 rounded border border-white/5 shrink-0">{Math.floor(clip.end - clip.start)}s</span>
<span className="bg-white/5 px-1.5 py-0.5 rounded border border-white/5">#shorts</span> <span className="bg-white/5 px-1.5 py-0.5 rounded border border-white/5 shrink-0">#shorts</span>
<span className="bg-white/5 px-1.5 py-0.5 rounded border border-white/5">#viral</span> <span className="bg-white/5 px-1.5 py-0.5 rounded border border-white/5 shrink-0">#viral</span>
</div> </div>
</div> </div>
@ -101,9 +101,9 @@ export default function ResultCard({ clip, index, jobId, uploadPostKey, uploadUs
{/* YouTube */} {/* YouTube */}
<div className="bg-black/20 rounded-lg p-3 border border-white/5"> <div className="bg-black/20 rounded-lg p-3 border border-white/5">
<div className="flex items-center gap-2 text-[10px] font-bold text-red-400 mb-1.5 uppercase tracking-wider"> <div className="flex items-center gap-2 text-[10px] font-bold text-red-400 mb-1.5 uppercase tracking-wider">
<Youtube size={12} /> YouTube Title <Youtube size={12} className="shrink-0" /> <span className="truncate">YouTube Title</span>
</div> </div>
<p className="text-xs text-zinc-300 select-all"> <p className="text-xs text-zinc-300 select-all break-words">
{clip.video_title_for_youtube_short || "Viral Short Video"} {clip.video_title_for_youtube_short || "Viral Short Video"}
</p> </p>
</div> </div>
@ -111,12 +111,12 @@ export default function ResultCard({ clip, index, jobId, uploadPostKey, uploadUs
{/* TikTok / IG */} {/* TikTok / IG */}
<div className="bg-black/20 rounded-lg p-3 border border-white/5"> <div className="bg-black/20 rounded-lg p-3 border border-white/5">
<div className="flex items-center gap-2 text-[10px] font-bold text-zinc-400 mb-1.5 uppercase tracking-wider"> <div className="flex items-center gap-2 text-[10px] font-bold text-zinc-400 mb-1.5 uppercase tracking-wider">
<Video size={12} className="text-cyan-400" /> <Video size={12} className="text-cyan-400 shrink-0" />
<span className="text-zinc-500">/</span> <span className="text-zinc-500">/</span>
<Instagram size={12} className="text-pink-400" /> <Instagram size={12} className="text-pink-400 shrink-0" />
Caption <span className="truncate">Caption</span>
</div> </div>
<p className="text-xs text-zinc-300 line-clamp-3 hover:line-clamp-none transition-all cursor-pointer select-all"> <p className="text-xs text-zinc-300 line-clamp-3 hover:line-clamp-none transition-all cursor-pointer select-all break-words">
{clip.video_description_for_tiktok || clip.video_description_for_instagram} {clip.video_description_for_tiktok || clip.video_description_for_instagram}
</p> </p>
</div> </div>
@ -126,16 +126,16 @@ export default function ResultCard({ clip, index, jobId, uploadPostKey, uploadUs
<div className="grid grid-cols-2 gap-3 mt-auto pt-4 border-t border-white/5"> <div className="grid grid-cols-2 gap-3 mt-auto pt-4 border-t border-white/5">
<button <button
onClick={() => setShowModal(true)} onClick={() => setShowModal(true)}
className="col-span-1 py-2 bg-primary hover:bg-blue-600 text-white rounded-lg text-xs font-bold shadow-lg shadow-primary/20 transition-all active:scale-[0.98] flex items-center justify-center gap-2" className="col-span-1 py-2 bg-primary hover:bg-blue-600 text-white rounded-lg text-xs font-bold shadow-lg shadow-primary/20 transition-all active:scale-[0.98] flex items-center justify-center gap-2 truncate px-2"
> >
<Share2 size={14} /> Post <Share2 size={14} className="shrink-0" /> Post
</button> </button>
<a <a
href={videoUrl} href={videoUrl}
download download
className="col-span-1 py-2 bg-white/5 hover:bg-white/10 text-zinc-300 hover:text-white rounded-lg text-xs font-medium transition-colors flex items-center justify-center gap-2 border border-white/5" className="col-span-1 py-2 bg-white/5 hover:bg-white/10 text-zinc-300 hover:text-white rounded-lg text-xs font-medium transition-colors flex items-center justify-center gap-2 border border-white/5 truncate px-2"
> >
<Download size={14} /> Download <Download size={14} className="shrink-0" /> Download
</a> </a>
</div> </div>
</div> </div>

View file

@ -451,13 +451,6 @@ def get_viral_clips(transcript_result, video_duration):
print("❌ Error: GEMINI_API_KEY not found in environment variables.") print("❌ Error: GEMINI_API_KEY not found in environment variables.")
return None return None
# Debug: Print masked key to verify it's loaded correctly
print(f"🔑 Loaded API Key: {api_key[:4]}...{api_key[-4:]} (Length: {len(api_key)})")
if not api_key.startswith("AIza"):
print("\n⚠️ WARNING: The API Key does not start with 'AIza'. Google AI Studio keys typically start with 'AIza'.")
print(" Please check that you copied the 'API Key' and not a Client ID, Secret, or Token.")
print(" Get your key here: https://aistudio.google.com/app/apikey\n")
client = genai.Client(api_key=api_key) client = genai.Client(api_key=api_key)