Skip to content
This repository has been archived by the owner on Jan 4, 2025. It is now read-only.

Commit

Permalink
novos controles pro player
Browse files Browse the repository at this point in the history
  • Loading branch information
uesleibros committed Sep 2, 2024
1 parent 08efee1 commit dbaa174
Show file tree
Hide file tree
Showing 3 changed files with 164 additions and 30 deletions.
113 changes: 110 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
"chart.js": "^2.9.3",
"disqus-react": "^1.1.5",
"framer-motion": "^11.3.28",
"https-proxy-agent": "^7.0.5",
"next": "14.2.5",
"nextjs-toploader": "^3.6.15",
"node-fetch": "^3.3.2",
"react": "^18",
"react-dom": "^18",
"react-icons": "^5.3.0",
Expand Down
79 changes: 52 additions & 27 deletions src/app/api/imagens/anroll/route.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,58 @@
import fetch from "node-fetch";
import { HttpsProxyAgent } from "https-proxy-agent";

const proxy = "http://118.68.249.51:1005";
const agent = new HttpsProxyAgent(proxy);

export async function GET(request) {
const query = request.nextUrl.searchParams.get("q");
const query = request.nextUrl.searchParams.get("q");

if (!query)
return Response.json({ error: "missing query." }, { status: 401 });
if (!query)
return new Response(
JSON.stringify({ error: "missing query." }),
{ status: 401, headers: { "Content-Type": "application/json" } }
);

const res = await fetch(decodeURIComponent(query), {
headers: {
"Authority": decodeURIComponent(query).replace("https://").split('/')[0],
"Host": "anroll.net",
"Origin": "https://www.anroll.net",
"Referer": "https://www.anroll.net/",
"Cf-Ray": "8bc942b6981b5210-GRU",
"Nel": '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}',
"Report-To": '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=5cULeDVZhT2XGTomTHZHBNgkCWrDOMuKCY1imqjyaln4eueUt%2F3W0VHTYV1s0iZ1k%2B5LO%2B5olLC2L5Iw6CJeWk8Z8gMU85aMIummLJ9WoV6QWYxn45cJuguTZD3tF8sZ8pLcjz8e1j6afRMPppvv"}],"group":"cf-nel","max_age":604800}',
"Server": "cloudflare",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36"
},
cache: "no-store"
});
try {
const url = decodeURIComponent(query);
const res = await fetch(url, {
agent,
headers: {
"Authority": new URL(url).host,
"Host": "anroll.net",
"Origin": "https://www.anroll.net",
"Referer": "https://www.anroll.net/",
"Cf-Ray": "8bc942b6981b5210-GRU",
"Nel": '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}',
"Report-To": '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=5cULeDVZhT2XGTomTHZHBNgkCWrDOMuKCY1imqjyaln4eueUt%2F3W0VHTYV1s0iZ1k%2B5LO%2B5olLC2L5Iw6CJeWk8Z8gMU85aMIummLJ9WoV6QWYxn45cJuguTZD3tF8sZ8pLcjz8e1j6afRMPppvv"}],"group":"cf-nel","max_age":604800}',
"Server": "cloudflare",
"User-Agent":
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36",
},
cache: "no-store",
});

if (!res.ok) {
return new Response(
JSON.stringify({ error: "Failed to fetch the image." }),
{ status: res.status, headers: { "Content-Type": "application/json" } }
);
}

const imageBuffer = await res.arrayBuffer();
const contentLength = imageBuffer.byteLength;
const imageBuffer = await res.arrayBuffer();
const contentLength = imageBuffer.byteLength;

return new Response(imageBuffer, {
status: 200,
headers: {
"Content-Type": "image/webp",
"Content-Length": contentLength
},
});
}
return new Response(imageBuffer, {
status: 200,
headers: {
"Content-Type": "image/webp",
"Content-Length": contentLength.toString(),
},
});
} catch (error) {
return new Response(
JSON.stringify({ error: error.message }),
{ status: 500, headers: { "Content-Type": "application/json" } }
);
}
}

0 comments on commit dbaa174

Please sign in to comment.