aboutsummaryrefslogtreecommitdiff
path: root/pages/api
diff options
context:
space:
mode:
authorFactiven <[email protected]>2023-05-16 22:40:02 +0700
committerGitHub <[email protected]>2023-05-16 22:40:02 +0700
commit9a5754fdba9d778f820fe89b44d1e21ca9f0bb4d (patch)
tree8bd574163e760216bc91f7b3c164232b6982efe8 /pages/api
parentUpdate v3.5.6 (diff)
downloadmoopa-9a5754fdba9d778f820fe89b44d1e21ca9f0bb4d.tar.xz
moopa-9a5754fdba9d778f820fe89b44d1e21ca9f0bb4d.zip
Update v3.5.7 (#12)
* Merge request (#11) * Update v3.5.5 > Now Skip button will hide if player is not in focused state. > Added some options to player. > Manga images should be displayed now. * Update videoPlayer.js * Revamp hero section #1 * UI Improvement > Updating main page > Updated Genres selection using params method > Added search bar v1.0 on main page ( [ctrl + space] to access search bar ) * update meta * Update [...id].js * Update [...id].js > Back to ssr I guess * update episode selector * Update [...info].js * Update UI > Added On-Going section for AniList user * Update content.js * added dynamic og * Update og.jsx * Update og * Update og.jsx * update og and id fallback > Added fallback for anime info if it's not found * Update v3.5.7 > Added On-Going section for AniList user > Added Genre section > Added dynamic Open Graph when sharing anime > Added Episode Selector above information
Diffstat (limited to 'pages/api')
-rw-r--r--pages/api/og.jsx103
1 files changed, 103 insertions, 0 deletions
diff --git a/pages/api/og.jsx b/pages/api/og.jsx
new file mode 100644
index 0000000..b1cf238
--- /dev/null
+++ b/pages/api/og.jsx
@@ -0,0 +1,103 @@
+import { ImageResponse } from "@vercel/og";
+
+export const config = {
+ runtime: "edge",
+};
+
+const karla = fetch(
+ new URL("../../assets/Karla-MediumItalic.ttf", import.meta.url)
+).then((res) => res.arrayBuffer());
+const outfit = fetch(
+ new URL("../../assets/Outfit-Regular.ttf", import.meta.url)
+).then((res) => res.arrayBuffer());
+
+export default async function handler(request) {
+ const Karla = await karla;
+ const Outfit = await outfit;
+
+ const { searchParams } = request.nextUrl;
+ const hasTitle = searchParams.has("title");
+ const title = hasTitle
+ ? searchParams.get("title").length > 64
+ ? searchParams.get("title").slice(0, 64) + "..."
+ : searchParams.get("title")
+ : "Watch Now";
+ const image = searchParams.get("image");
+ if (!title) {
+ return new ImageResponse(<>Visit with &quot;?username=vercel&quot;</>, {
+ width: 1200,
+ height: 630,
+ });
+ }
+
+ return new ImageResponse(
+ (
+ <div
+ style={{
+ display: "flex",
+ fontSize: 60,
+ color: "black",
+ background: "#f6f6f6",
+ width: "100%",
+ height: "100%",
+ backgroundImage: `url(${image})`,
+ }}
+ className="relative w-[1900px] h-[400px] text-[10px]"
+ >
+ <div
+ className="w-[1900px] h-[400px]"
+ style={{
+ display: "flex",
+ width: "100%",
+ paddingLeft: 100,
+ alignItems: "center",
+ color: "white",
+ position: "relative",
+ backgroundImage: `linear-gradient(to right, rgba(0,0,0,0.93), rgba(0,0,0,0.8) , rgba(0,0,0,0.2))`,
+ filter: "brightness(20%)",
+ }}
+ >
+ <span
+ style={{
+ display: "flex",
+ position: "absolute",
+ top: 10,
+ left: 25,
+ fontSize: "40",
+ color: "#FF7F57",
+ fontFamily: "Outfit",
+ filter: "brightness(100%)",
+ }}
+ >
+ moopa
+ </span>
+ <h1
+ style={{
+ width: "70%",
+ fontSize: "70px",
+ filter: "brightness(100%)",
+ }}
+ >
+ {title}
+ </h1>
+ </div>
+ </div>
+ ),
+ {
+ width: 1900,
+ height: 400,
+ fonts: [
+ {
+ name: "Karla",
+ data: Karla,
+ style: "normal",
+ },
+ {
+ name: "Outfit",
+ data: Outfit,
+ style: "normal",
+ },
+ ],
+ }
+ );
+}