add user agent header

This commit is contained in:
Daniel Bulant 2023-10-07 12:54:46 +02:00
parent d191ade47c
commit 790fc49fbc
2 changed files with 10 additions and 2 deletions

View file

@ -2,7 +2,11 @@
/** @type {import('./$types').RequestHandler} */
export async function GET({ url }) {
console.log("[CORS] " + url.searchParams.get('url'));
const ret = await fetch(url.searchParams.get('url'));
const ret = await fetch(url.searchParams.get('url'), {
headers: {
"User-agent": "manga.danbulant.eu (discord @techmandancz)"
}
});
return new Response(await ret.arrayBuffer(), {
headers: {
...ret.headers,

View file

@ -3,7 +3,11 @@ import { json } from '@sveltejs/kit';
/** @type {import('./$types').RequestHandler} */
export async function GET({ url }) {
console.log("[CORS-DBG] " + url.searchParams.get('url'));
const ret = await fetch(url.searchParams.get('url'));
const ret = await fetch(url.searchParams.get('url'), {
headers: {
"User-agent": "manga.danbulant.eu (discord @techmandancz)"
}
});
let text = await ret.text();
let data = text;
try {