-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* updated docker files * change environment variables * change entry scripts and dockerfiles * added tunnel options
- Loading branch information
Showing
20 changed files
with
296 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ npm-debug.log | |
Dockerfile | ||
.dockerignore | ||
.git | ||
.env* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { NextRequest, NextResponse } from "next/server"; | ||
|
||
export async function GET(req: NextRequest) { | ||
const url = req.nextUrl.clone(); | ||
const s3Endpoint = process.env.RAWFILES_S3_ENDPOINT; | ||
|
||
// Ensure the URL is valid | ||
if (!s3Endpoint) { | ||
return NextResponse.json({ error: "S3 endpoint not configured." }, { status: 500 }); | ||
} | ||
|
||
// Change the path to point to the S3 endpoint | ||
url.hostname = new URL(s3Endpoint).hostname; | ||
url.protocol = new URL(s3Endpoint).protocol; | ||
|
||
const response = await fetch(url, { | ||
method: req.method, | ||
headers: req.headers, | ||
body: req.body, | ||
}); | ||
|
||
const responseBody = await response.text(); | ||
return NextResponse.json(responseBody, { status: response.status }); | ||
} | ||
|
||
export async function POST(req: NextRequest) { | ||
const url = req.nextUrl.clone(); | ||
const s3Endpoint = process.env.RAWFILES_S3_ENDPOINT; | ||
|
||
if (!s3Endpoint) { | ||
return NextResponse.json({ error: "S3 endpoint not configured." }, { status: 500 }); | ||
} | ||
|
||
url.hostname = new URL(s3Endpoint).hostname; | ||
url.protocol = new URL(s3Endpoint).protocol; | ||
|
||
const response = await fetch(url, { | ||
method: req.method, | ||
headers: req.headers, | ||
body: req.body, | ||
}); | ||
|
||
const responseBody = await response.text(); | ||
return NextResponse.json(responseBody, { status: response.status }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,12 @@ | ||
"use client"; | ||
import Link from "next/link"; | ||
import { useState } from "react"; | ||
import VideoThumbnailHover from "./videoThumbnailHover"; | ||
|
||
export default function VideoThumbnail({ video }: { video: { id: string, title: string } }) { | ||
const [isHovered, setIsHovered] = useState(false); | ||
export default function VideoThumbnail({ video }: { video: { id: string; title: string } }) { | ||
|
||
const { id, title } = video; | ||
const baseUrl = process.env.PROCESSED_VIDEO_URL!; | ||
|
||
let imgSrc, id, title; | ||
|
||
if (!video) { | ||
imgSrc = isHovered | ||
? "https://picsum.photos/384/216?random=" + Math.random() | ||
: `https://videos.subatic.com/${id}/short.gif`; | ||
id = "abc"; | ||
title = "sample"; | ||
} else { | ||
id = video.id; | ||
imgSrc = isHovered | ||
? `https://videos.subatic.com/${id}/long.gif` | ||
: `https://videos.subatic.com/${id}/short.gif`; | ||
title = video.title; | ||
} | ||
return ( | ||
<div className="mb-5"> | ||
<Link href={`/video/${id}`}> | ||
<figure> | ||
<img | ||
className="mx-auto rounded-lg" | ||
src={imgSrc} | ||
alt="video transcoding...." | ||
onMouseEnter={() => setIsHovered(true)} | ||
onMouseLeave={() => setIsHovered(false)} | ||
/> | ||
<figcaption className="mt-2 text-center text-gray-500 text-md dark:text-gray-400"> | ||
{title} | ||
</figcaption> | ||
</figure> | ||
</Link> | ||
</div> | ||
<VideoThumbnailHover video={{ id, title, baseUrl }} /> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
"use client"; | ||
import Link from "next/link"; | ||
import { useState } from "react"; | ||
|
||
export default function VideoThumbnailHover({ video }: { video: { id: string; title: string, baseUrl: string } }) { | ||
const [isHovered, setIsHovered] = useState(false); | ||
|
||
const { id, title, baseUrl } = video; | ||
|
||
const imgSrc = `${baseUrl}/${id}/${isHovered ? 'long' : 'short'}.gif`; | ||
|
||
return ( | ||
<div className="mb-5"> | ||
<Link href={`/video/${id}`}> | ||
<figure | ||
onMouseEnter={() => setIsHovered(true)} | ||
onMouseLeave={() => setIsHovered(false)} | ||
> | ||
<img | ||
className="mx-auto rounded-lg" | ||
src={imgSrc} | ||
alt={`Thumbnail for ${title}`} | ||
/> | ||
<figcaption className="mt-2 text-center text-gray-500 text-md dark:text-gray-400"> | ||
{title} | ||
</figcaption> | ||
</figure> | ||
</Link> | ||
</div> | ||
); | ||
|
||
|
||
} |
Oops, something went wrong.