diff --git a/dashboard/index.html b/dashboard/index.html
index aa2822a..47fc6b5 100644
--- a/dashboard/index.html
+++ b/dashboard/index.html
@@ -2,7 +2,7 @@
-
+
OpenShorts.app
diff --git a/dashboard/public/logo-openshorts.png b/dashboard/public/logo-openshorts.png
index 09972bd..53df264 100644
Binary files a/dashboard/public/logo-openshorts.png and b/dashboard/public/logo-openshorts.png differ
diff --git a/dashboard/src/App.jsx b/dashboard/src/App.jsx
index a4777de..61a1674 100644
--- a/dashboard/src/App.jsx
+++ b/dashboard/src/App.jsx
@@ -4,6 +4,7 @@ import KeyInput from './components/KeyInput';
import MediaInput from './components/MediaInput';
import ResultCard from './components/ResultCard';
import ProcessingAnimation from './components/ProcessingAnimation';
+import { getApiUrl } from './config';
// Simple TikTok icon sine Lucide might not have it or it varies
const TikTokIcon = ({ size = 16, className = "" }) => (
@@ -85,7 +86,7 @@ const UserProfileSelector = ({ profiles, selectedUserId, onSelect }) => {
// Mock polling function
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');
return res.json();
};
@@ -157,7 +158,7 @@ function App() {
const fetchUserProfiles = async () => {
if (!uploadPostKey) return;
try {
- const res = await fetch('/api/social/user', {
+ const res = await fetch(getApiUrl('/api/social/user'), {
headers: { 'X-Upload-Post-Key': uploadPostKey }
});
if (!res.ok) throw new Error("Failed to fetch");
@@ -197,7 +198,7 @@ function App() {
// Content-Type is auto-set for FormData
}
- const res = await fetch('/api/process', {
+ const res = await fetch(getApiUrl('/api/process'), {
method: 'POST',
headers: data.type === 'url' ? headers : { 'X-Gemini-Key': apiKey },
body
diff --git a/dashboard/src/components/ResultCard.jsx b/dashboard/src/components/ResultCard.jsx
index 800c10f..4d0160c 100644
--- a/dashboard/src/components/ResultCard.jsx
+++ b/dashboard/src/components/ResultCard.jsx
@@ -1,5 +1,6 @@
import React, { useState } from '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 }) {
const [showModal, setShowModal] = useState(false);
@@ -27,7 +28,7 @@ export default function ResultCard({ clip, index, jobId, uploadPostKey, uploadUs
setPostResult(null);
try {
- const res = await fetch('/api/social/post', {
+ const res = await fetch(getApiUrl('/api/social/post'), {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
@@ -64,19 +65,21 @@ export default function ResultCard({ clip, index, jobId, uploadPostKey, uploadUs
}
};
+ const videoUrl = getApiUrl(clip.video_url);
+
return (
@@ -131,7 +134,7 @@ export default function ResultCard({ clip, index, jobId, uploadPostKey, uploadUs
Post to Socials
diff --git a/dashboard/src/config.js b/dashboard/src/config.js
new file mode 100644
index 0000000..6846298
--- /dev/null
+++ b/dashboard/src/config.js
@@ -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}`;
+};