session ? signOut() : router.push('/auth/signin')} className={`w-full flex flex-row items-center cursor-pointer py-2 my-2 hover:bg-gray-700 rounded-lg ${isActive('/auth/signin') ? 'bg-gray-700' : ''}`}>
{session ? 'Logout' : 'Login'}
-
Logout
diff --git a/src/pages/_app.js b/src/pages/_app.js
index 9d45260..15978ba 100644
--- a/src/pages/_app.js
+++ b/src/pages/_app.js
@@ -24,19 +24,19 @@ const queryClient = new QueryClient()
export default function MyApp({
Component, pageProps: { session, ...pageProps }
}) {
- const [sidebarExpanded, setSidebarExpanded] = useState(true);
+ // const [sidebarExpanded, setSidebarExpanded] = useState(true);
- useEffect(() => {
- const handleSidebarToggle = (event) => {
- setSidebarExpanded(event.detail.isExpanded);
- };
+ // useEffect(() => {
+ // const handleSidebarToggle = (event) => {
+ // setSidebarExpanded(event.detail.isExpanded);
+ // };
- window.addEventListener('sidebarToggle', handleSidebarToggle);
+ // window.addEventListener('sidebarToggle', handleSidebarToggle);
- return () => {
- window.removeEventListener('sidebarToggle', handleSidebarToggle);
- };
- }, []);
+ // return () => {
+ // window.removeEventListener('sidebarToggle', handleSidebarToggle);
+ // };
+ // }, []);
return (
diff --git a/src/pages/api/auth/[...nextauth].js b/src/pages/api/auth/[...nextauth].js
index d2cf17c..b231631 100644
--- a/src/pages/api/auth/[...nextauth].js
+++ b/src/pages/api/auth/[...nextauth].js
@@ -143,7 +143,7 @@ export const authOptions = {
},
pages: {
signIn: "/auth/signin",
- },
+ }
};
export default NextAuth(authOptions);
diff --git a/src/pages/api/get-video-url.js b/src/pages/api/get-video-url.js
index e4c0587..90e34b7 100644
--- a/src/pages/api/get-video-url.js
+++ b/src/pages/api/get-video-url.js
@@ -19,8 +19,6 @@ export default async function handler(req, res) {
return res.status(401).json({ error: "Unauthorized" })
}
- console.log("Session:", session)
-
const { videoKey } = req.query
if (!videoKey) {
@@ -34,10 +32,10 @@ export default async function handler(req, res) {
})
const signedUrl = await getSignedUrl(s3Client, command, {
- expiresIn: 10, // URL expires in 10 seconds
+ expiresIn: 3600, // URL expires in 1 hour
})
- res.status(200).json({ url: signedUrl })
+ res.redirect(signedUrl)
} catch (error) {
console.error("Error generating signed URL:", error)
res.status(500).json({ error: "Failed to generate video URL" })
diff --git a/src/pages/draft/[slug]/index.js b/src/pages/draft/[slug]/index.js
index 7377573..cb8f8b2 100644
--- a/src/pages/draft/[slug]/index.js
+++ b/src/pages/draft/[slug]/index.js
@@ -201,6 +201,18 @@ export default function Draft() {
encryptedContent = await nip04.encrypt(process.env.NEXT_PUBLIC_APP_PRIV_KEY, process.env.NEXT_PUBLIC_APP_PUBLIC_KEY, draft.content);
}
+ if (draft?.content.includes('.mp4') || draft?.content.includes('.mov') || draft?.content.includes('.avi') || draft?.content.includes('.wmv') || draft?.content.includes('.flv') || draft?.content.includes('.webm')) {
+ // todo update this for dev and prod
+ const baseUrl = process.env.NEXT_PUBLIC_API_URL || "http://localhost:3000"
+ const videoEmbed = ``;
+ if (draft?.price) {
+ const encryptedVideoUrl = await nip04.encrypt(process.env.NEXT_PUBLIC_APP_PRIV_KEY, process.env.NEXT_PUBLIC_APP_PUBLIC_KEY, videoEmbed);
+ draft.content = encryptedVideoUrl;
+ } else {
+ draft.content = videoEmbed;
+ }
+ }
+
event.kind = draft?.price ? 30402 : 30023;
event.content = draft?.price ? encryptedContent : draft.content;
event.created_at = Math.floor(Date.now() / 1000);
@@ -232,9 +244,8 @@ export default function Draft() {
- {/* List out topics */}
{draft?.topics && draft.topics.map((topic, index) => {
- if (topic === "plebdevs") return;
+ if (topic === "") return;
return (
)
@@ -302,7 +313,9 @@ export default function Draft() {
{
- draft?.content &&
+ (
+ draft?.content &&
+ )
}