mirror of
https://github.com/danbulant/Mangades
synced 2026-07-05 02:50:34 +00:00
add user agent header
This commit is contained in:
parent
d191ade47c
commit
790fc49fbc
2 changed files with 10 additions and 2 deletions
|
|
@ -2,7 +2,11 @@
|
||||||
/** @type {import('./$types').RequestHandler} */
|
/** @type {import('./$types').RequestHandler} */
|
||||||
export async function GET({ url }) {
|
export async function GET({ url }) {
|
||||||
console.log("[CORS] " + url.searchParams.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(), {
|
return new Response(await ret.arrayBuffer(), {
|
||||||
headers: {
|
headers: {
|
||||||
...ret.headers,
|
...ret.headers,
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,11 @@ import { json } from '@sveltejs/kit';
|
||||||
/** @type {import('./$types').RequestHandler} */
|
/** @type {import('./$types').RequestHandler} */
|
||||||
export async function GET({ url }) {
|
export async function GET({ url }) {
|
||||||
console.log("[CORS-DBG] " + url.searchParams.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 text = await ret.text();
|
||||||
let data = text;
|
let data = text;
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue