mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-14 06:50:01 -04:00
fix lint warnings and errors in fetch.ts
This commit is contained in:
parent
257756f998
commit
1147aea917
1 changed files with 5 additions and 8 deletions
|
@ -1,6 +1,4 @@
|
||||||
import { BareHeaders, BareResponseFetch } from "@mercuryworkshop/bare-mux";
|
import { BareResponseFetch } from "@mercuryworkshop/bare-mux";
|
||||||
import IDBMap from "@webreflection/idb-map";
|
|
||||||
import { ParseResultType } from "parse-domain";
|
|
||||||
import { MessageW2C, ScramjetServiceWorker } from ".";
|
import { MessageW2C, ScramjetServiceWorker } from ".";
|
||||||
import { renderError } from "./error";
|
import { renderError } from "./error";
|
||||||
import { FakeServiceWorker } from "./fakesw";
|
import { FakeServiceWorker } from "./fakesw";
|
||||||
|
@ -17,7 +15,6 @@ import {
|
||||||
} from "../shared";
|
} from "../shared";
|
||||||
|
|
||||||
import type { URLMeta } from "../shared/rewriters/url";
|
import type { URLMeta } from "../shared/rewriters/url";
|
||||||
import { Readable } from "stream";
|
|
||||||
|
|
||||||
function newmeta(url: URL): URLMeta {
|
function newmeta(url: URL): URLMeta {
|
||||||
return {
|
return {
|
||||||
|
@ -80,12 +77,12 @@ export async function swfetch(
|
||||||
new URL(client.url).pathname.startsWith(self.$scramjet.config.prefix)
|
new URL(client.url).pathname.startsWith(self.$scramjet.config.prefix)
|
||||||
) {
|
) {
|
||||||
// TODO: i was against cors emulation but we might actually break stuff if we send full origin/referrer always
|
// TODO: i was against cors emulation but we might actually break stuff if we send full origin/referrer always
|
||||||
const url = new URL(decodeUrl(client.url));
|
const clientURL = new URL(decodeUrl(client.url));
|
||||||
if (url.toString().includes("youtube.com")) {
|
if (clientURL.toString().includes("youtube.com")) {
|
||||||
// console.log(headers);
|
// console.log(headers);
|
||||||
} else {
|
} else {
|
||||||
headers.set("Referer", url.toString());
|
headers.set("Referer", clientURL.toString());
|
||||||
headers.set("Origin", url.origin);
|
headers.set("Origin", clientURL.origin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue