mirror of
https://github.com/p-stream/simple-proxy.git
synced 2026-03-11 17:55:39 +00:00
add user agent
This commit is contained in:
parent
2d067ddbec
commit
d50d90b89c
2 changed files with 10 additions and 3 deletions
|
|
@ -69,7 +69,12 @@ async function proxyM3U8(event: any) {
|
||||||
try {
|
try {
|
||||||
// Use native fetch instead of axios
|
// Use native fetch instead of axios
|
||||||
const response = await globalThis.fetch(url, {
|
const response = await globalThis.fetch(url, {
|
||||||
headers: headers as HeadersInit
|
headers: {
|
||||||
|
// Default User-Agent (from src/utils/headers.ts)
|
||||||
|
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:93.0) Gecko/20100101 Firefox/93.0',
|
||||||
|
// Spread the headers from the query parameter, allowing them to override defaults
|
||||||
|
...(headers as HeadersInit),
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,10 @@ export default defineEventHandler(async (event) => {
|
||||||
const response = await globalThis.fetch(url, {
|
const response = await globalThis.fetch(url, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
...headers as HeadersInit,
|
// Default User-Agent (from src/utils/headers.ts)
|
||||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36',
|
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:93.0) Gecko/20100101 Firefox/93.0',
|
||||||
|
// Spread the headers from the query parameter, allowing them to override defaults
|
||||||
|
...(headers as HeadersInit),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue