fix some things for deploy to pro
This commit is contained in:
parent
d9c85f6aed
commit
a7ba51a2f1
5 changed files with 24 additions and 8 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
<link rel="icon" type="image/png" href="/logo-openshorts.png" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>OpenShorts.app</title>
|
<title>OpenShorts.app</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 266 KiB |
|
|
@ -4,6 +4,7 @@ import KeyInput from './components/KeyInput';
|
||||||
import MediaInput from './components/MediaInput';
|
import MediaInput from './components/MediaInput';
|
||||||
import ResultCard from './components/ResultCard';
|
import ResultCard from './components/ResultCard';
|
||||||
import ProcessingAnimation from './components/ProcessingAnimation';
|
import ProcessingAnimation from './components/ProcessingAnimation';
|
||||||
|
import { getApiUrl } from './config';
|
||||||
|
|
||||||
// Simple TikTok icon sine Lucide might not have it or it varies
|
// Simple TikTok icon sine Lucide might not have it or it varies
|
||||||
const TikTokIcon = ({ size = 16, className = "" }) => (
|
const TikTokIcon = ({ size = 16, className = "" }) => (
|
||||||
|
|
@ -85,7 +86,7 @@ const UserProfileSelector = ({ profiles, selectedUserId, onSelect }) => {
|
||||||
|
|
||||||
// Mock polling function
|
// Mock polling function
|
||||||
const pollJob = async (jobId) => {
|
const pollJob = async (jobId) => {
|
||||||
const res = await fetch(`/api/status/${jobId}`);
|
const res = await fetch(getApiUrl(`/api/status/${jobId}`));
|
||||||
if (!res.ok) throw new Error('Status check failed');
|
if (!res.ok) throw new Error('Status check failed');
|
||||||
return res.json();
|
return res.json();
|
||||||
};
|
};
|
||||||
|
|
@ -157,7 +158,7 @@ function App() {
|
||||||
const fetchUserProfiles = async () => {
|
const fetchUserProfiles = async () => {
|
||||||
if (!uploadPostKey) return;
|
if (!uploadPostKey) return;
|
||||||
try {
|
try {
|
||||||
const res = await fetch('/api/social/user', {
|
const res = await fetch(getApiUrl('/api/social/user'), {
|
||||||
headers: { 'X-Upload-Post-Key': uploadPostKey }
|
headers: { 'X-Upload-Post-Key': uploadPostKey }
|
||||||
});
|
});
|
||||||
if (!res.ok) throw new Error("Failed to fetch");
|
if (!res.ok) throw new Error("Failed to fetch");
|
||||||
|
|
@ -197,7 +198,7 @@ function App() {
|
||||||
// Content-Type is auto-set for FormData
|
// Content-Type is auto-set for FormData
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await fetch('/api/process', {
|
const res = await fetch(getApiUrl('/api/process'), {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: data.type === 'url' ? headers : { 'X-Gemini-Key': apiKey },
|
headers: data.type === 'url' ? headers : { 'X-Gemini-Key': apiKey },
|
||||||
body
|
body
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { Download, Share2, Instagram, Youtube, Video, CheckCircle, AlertCircle, X, Loader2 } from 'lucide-react';
|
import { Download, Share2, Instagram, Youtube, Video, CheckCircle, AlertCircle, X, Loader2 } from 'lucide-react';
|
||||||
|
import { getApiUrl } from '../config';
|
||||||
|
|
||||||
export default function ResultCard({ clip, index, jobId, uploadPostKey, uploadUserId }) {
|
export default function ResultCard({ clip, index, jobId, uploadPostKey, uploadUserId }) {
|
||||||
const [showModal, setShowModal] = useState(false);
|
const [showModal, setShowModal] = useState(false);
|
||||||
|
|
@ -27,7 +28,7 @@ export default function ResultCard({ clip, index, jobId, uploadPostKey, uploadUs
|
||||||
setPostResult(null);
|
setPostResult(null);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetch('/api/social/post', {
|
const res = await fetch(getApiUrl('/api/social/post'), {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
|
@ -64,19 +65,21 @@ export default function ResultCard({ clip, index, jobId, uploadPostKey, uploadUs
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const videoUrl = getApiUrl(clip.video_url);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="glass-panel overflow-hidden animate-[fadeIn_0.5s_ease-out]" style={{ animationDelay: `${index * 0.1}s` }}>
|
<div className="glass-panel overflow-hidden animate-[fadeIn_0.5s_ease-out]" style={{ animationDelay: `${index * 0.1}s` }}>
|
||||||
<div className="grid md:grid-cols-2 gap-0">
|
<div className="grid md:grid-cols-2 gap-0">
|
||||||
<div className="bg-black/50 aspect-[9/16] relative group">
|
<div className="bg-black/50 aspect-[9/16] relative group">
|
||||||
<video
|
<video
|
||||||
src={clip.video_url}
|
src={videoUrl}
|
||||||
controls
|
controls
|
||||||
className="w-full h-full object-contain"
|
className="w-full h-full object-contain"
|
||||||
loop
|
loop
|
||||||
/>
|
/>
|
||||||
<div className="absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity">
|
<div className="absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity">
|
||||||
<a
|
<a
|
||||||
href={clip.video_url}
|
href={videoUrl}
|
||||||
download
|
download
|
||||||
className="p-2 bg-black/60 backdrop-blur rounded-lg text-white hover:bg-black/80 inline-flex"
|
className="p-2 bg-black/60 backdrop-blur rounded-lg text-white hover:bg-black/80 inline-flex"
|
||||||
>
|
>
|
||||||
|
|
@ -131,7 +134,7 @@ export default function ResultCard({ clip, index, jobId, uploadPostKey, uploadUs
|
||||||
<Share2 size={16} /> Post to Socials
|
<Share2 size={16} /> Post to Socials
|
||||||
</button>
|
</button>
|
||||||
<a
|
<a
|
||||||
href={clip.video_url}
|
href={videoUrl}
|
||||||
download
|
download
|
||||||
className="flex-1 py-2 bg-primary/10 hover:bg-primary/20 text-primary rounded-lg text-sm font-medium transition-colors flex items-center justify-center gap-2"
|
className="flex-1 py-2 bg-primary/10 hover:bg-primary/20 text-primary rounded-lg text-sm font-medium transition-colors flex items-center justify-center gap-2"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
12
dashboard/src/config.js
Normal file
12
dashboard/src/config.js
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Configuration for API endpoints
|
||||||
|
// If VITE_API_URL is set (e.g. in production), use it.
|
||||||
|
// Otherwise, default to empty string which means relative paths (proxied in dev).
|
||||||
|
|
||||||
|
export const API_BASE_URL = import.meta.env.VITE_API_URL || '';
|
||||||
|
|
||||||
|
export const getApiUrl = (path) => {
|
||||||
|
if (path.startsWith('http')) return path;
|
||||||
|
// Ensure path starts with / if not present
|
||||||
|
const normalizedPath = path.startsWith('/') ? path : `/${path}`;
|
||||||
|
return `${API_BASE_URL}${normalizedPath}`;
|
||||||
|
};
|
||||||
Loading…
Reference in a new issue