mirror of
https://github.com/Radiquum/AniX.git
synced 2025-09-06 06:23:53 +05:00
Feature Request: meta tags for share link in social networks #15
This commit is contained in:
parent
f2f628add0
commit
6e38565439
13 changed files with 33 additions and 99 deletions
|
@ -1,4 +1,4 @@
|
|||
export const CURRENT_APP_VERSION = "3.7.0";
|
||||
export const CURRENT_APP_VERSION = "3.8.0";
|
||||
import { env } from "next-runtime-env";
|
||||
|
||||
const NEXT_PUBLIC_API_URL = env("NEXT_PUBLIC_API_URL") || null;
|
||||
|
|
|
@ -1,74 +0,0 @@
|
|||
import { NextResponse } from "next/server";
|
||||
import { NextRequest } from "next/server";
|
||||
import { fetchDataViaPost } from "../utils";
|
||||
import { ENDPOINTS } from "../config";
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const page = parseInt(request.nextUrl.searchParams.get("page")) || 0;
|
||||
const query = decodeURI(request.nextUrl.searchParams.get("q")) || null;
|
||||
const token = request.nextUrl.searchParams.get("token") || null;
|
||||
|
||||
const where = request.nextUrl.searchParams.get("where") || "releases";
|
||||
const searchBy = parseInt(request.nextUrl.searchParams.get("searchBy")) || 0;
|
||||
const list = parseInt(request.nextUrl.searchParams.get("list")) || null;
|
||||
|
||||
let url: URL;
|
||||
|
||||
if (where == "list") {
|
||||
if (!list) {
|
||||
return NextResponse.json(
|
||||
{ message: "List ID required" },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
if (!token) {
|
||||
return NextResponse.json({ message: "token required" }, { status: 400 });
|
||||
}
|
||||
url = new URL(`${ENDPOINTS.search}/profile/list/${list}/${page}`);
|
||||
} else if (where == "history") {
|
||||
if (!token) {
|
||||
return NextResponse.json({ message: "token required" }, { status: 400 });
|
||||
}
|
||||
url = new URL(`${ENDPOINTS.search}/history/${page}`);
|
||||
} else if (where == "favorites") {
|
||||
if (!token) {
|
||||
return NextResponse.json({ message: "token required" }, { status: 400 });
|
||||
}
|
||||
url = new URL(`${ENDPOINTS.search}/favorites/${page}`);
|
||||
} else if (where == "collections") {
|
||||
if (!token) {
|
||||
return NextResponse.json({ message: "token required" }, { status: 400 });
|
||||
}
|
||||
url = new URL(`${ENDPOINTS.search}/favoriteCollections/${page}`);
|
||||
} else if (where == "profiles") {
|
||||
url = new URL(`${ENDPOINTS.search}/profiles/${page}`);
|
||||
} else {
|
||||
url = new URL(`${ENDPOINTS.search}/releases/${page}`);
|
||||
}
|
||||
|
||||
if (token) {
|
||||
url.searchParams.set("token", token);
|
||||
}
|
||||
const body = { query, searchBy };
|
||||
|
||||
const { data, error } = await fetchDataViaPost(
|
||||
url.toString(),
|
||||
JSON.stringify(body),
|
||||
true
|
||||
);
|
||||
if (error) {
|
||||
return new Response(JSON.stringify(error), {
|
||||
status: 500,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return new Response(JSON.stringify(data), {
|
||||
status: 200,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue