hello new update

This commit is contained in:
2025-07-23 23:34:43 +03:00
parent cb2b4f0d86
commit dfc8e21db1
16 changed files with 279 additions and 277 deletions

View File

@@ -1,52 +0,0 @@
import { type NextRequest, NextResponse } from "next/server"
export async function GET(request: NextRequest) {
const { searchParams } = new URL(request.url);
const apiUrl = "https://apis.roblox.com/discovery-api/omni-recommendation";
const url = `${apiUrl}?${searchParams.toString()}`;
try {
const response = await fetch(url, {
headers: {
"User-Agent": "OCbwoy3ChanAI/1.0",
"Accept": "application/json, text/plain, */*",
"Accept-Encoding": "gzip, deflate, br, zstd",
"Content-Type": "application/json;charset=UTF-8",
"Cookie": request.headers.get("Authorization") || "",
},
});
return NextResponse.json(await response.json());
} catch (error) {
console.error("Error proxying request:", error);
return NextResponse.json({ error: "Internal Server Error" });
}
}
export async function POST(request: NextRequest) {
const { searchParams } = new URL(request.url);
const apiUrl = "https://apis.roblox.com/discovery-api/omni-recommendation";
const url = `${apiUrl}?${searchParams.toString()}`;
try {
const body = await request.json()
const response = await fetch(url, {
method: "POST",
headers: {
"User-Agent": "OCbwoy3ChanAI/1.0",
"Accept": "application/json, text/plain, */*",
"Accept-Encoding": "gzip, deflate, br, zstd",
"Content-Type": "application/json;charset=UTF-8",
"Cookie": request.headers.get("Authorization") || "",
},
body: JSON.stringify(body),
});
return NextResponse.json(await response.json());
} catch (error) {
console.error("Error proxying request:", error);
return NextResponse.json({ error: "Internal Server Error" });
}
}

64
app/api/proxy/route.ts Normal file
View File

@@ -0,0 +1,64 @@
async function proxyRequest(request: Request, method: string) {
const { searchParams } = new URL(request.url);
const target = searchParams.get("url");
if (!target) {
return new Response(
JSON.stringify({ error: "Missing `url` query parameter." }),
{
status: 400,
headers: { "Content-Type": "application/json" },
}
);
}
const targetUrl = new URL(target);
const headers = new Headers(request.headers);
headers.delete("host");
headers.delete("accept-encoding"); // ! important
const init: RequestInit = {
method,
headers,
body: method === "GET" || method === "HEAD" ? undefined : request.body,
};
if (init.body !== undefined) {
(init as any).duplex = "half";
}
const response = await fetch(targetUrl, init);
const responseHeaders = new Headers(response.headers);
responseHeaders.delete("content-encoding"); // ! important
return new Response(response.body, {
status: response.status,
headers: responseHeaders,
});
}
export async function GET(request: Request) {
return proxyRequest(request, "GET");
}
export async function HEAD(request: Request) {
return proxyRequest(request, "HEAD");
}
export async function POST(request: Request) {
return proxyRequest(request, "POST");
}
export async function PUT(request: Request) {
return proxyRequest(request, "PUT");
}
export async function DELETE(request: Request) {
return proxyRequest(request, "DELETE");
}
export async function PATCH(request: Request) {
return proxyRequest(request, "PATCH");
}

View File

@@ -1,52 +0,0 @@
import { type NextRequest, NextResponse } from "next/server"
export async function GET(request: NextRequest) {
const { searchParams } = new URL(request.url);
const apiUrl = "https://thumbnails.roblox.com/v1/batch";
const url = `${apiUrl}?${searchParams.toString()}`;
try {
const response = await fetch(url, {
headers: {
"User-Agent": "OCbwoy3ChanAI/1.0",
"Accept": "application/json, text/plain, */*",
"Accept-Encoding": "gzip, deflate, br, zstd",
"Content-Type": "application/json;charset=UTF-8",
"Cookie": request.headers.get("Authorization") || "",
},
});
return NextResponse.json(await response.json());
} catch (error) {
console.error("Error proxying request:", error);
return NextResponse.json({ error: "Internal Server Error" });
}
}
export async function POST(request: NextRequest) {
const { searchParams } = new URL(request.url);
const apiUrl = "https://thumbnails.roblox.com/v1/batch";
const url = `${apiUrl}?${searchParams.toString()}`;
try {
const body = await request.json()
const response = await fetch(url, {
method: "POST",
headers: {
"User-Agent": "OCbwoy3ChanAI/1.0",
"Accept": "application/json, text/plain, */*",
"Accept-Encoding": "gzip, deflate, br, zstd",
"Content-Type": "application/json;charset=UTF-8",
"Cookie": request.headers.get("Authorization") || "",
},
body: JSON.stringify(body),
});
return NextResponse.json(await response.json());
} catch (error) {
console.error("Error proxying request:", error);
return NextResponse.json({ error: "Internal Server Error" });
}
}

View File

@@ -1,25 +0,0 @@
import { type NextRequest, NextResponse } from "next/server"
export async function GET(request: NextRequest) {
const { searchParams } = new URL(request.url);
const apiUrl = "https://users.roblox.com/v1/users/authenticated";
const url = `${apiUrl}?${searchParams.toString()}`;
try {
const response = await fetch(url, {
headers: {
"User-Agent": "OCbwoy3ChanAI/1.0",
"Accept": "application/json, text/plain, */*",
"Accept-Encoding": "gzip, deflate, br, zstd",
"Content-Type": "application/json;charset=UTF-8",
"Cookie": request.headers.get("Authorization") || "",
},
});
return NextResponse.json(await response.json());
} catch (error) {
console.error("Error proxying request:", error);
return NextResponse.json({ error: "Internal Server Error" });
}
}

View File

@@ -1,23 +0,0 @@
import { NextRequest, NextResponse } from 'next/server';
export async function GET(request: NextRequest) {
const u = new URL(request.url);
const apiUrl = `https://users.roblox.com/v1/users/${u.searchParams.get("id")}`;
try {
const response = await fetch(apiUrl, {
headers: {
"User-Agent": "OCbwoy3ChanAI/1.0",
"Accept": "application/json, text/plain, */*",
"Accept-Encoding": "gzip, deflate, br, zstd",
"Content-Type": "application/json;charset=UTF-8",
"Cookie": request.headers.get("Authorization") || "",
},
});
return NextResponse.json(await response.json());
} catch (error) {
console.error("Error proxying request:", error);
return NextResponse.json({ error: "Internal Server Error" });
}
}