mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-12 14:00:01 -04:00
playstore bypass support
This commit is contained in:
parent
1999996b2a
commit
1d10e44ba0
2 changed files with 6 additions and 5 deletions
|
@ -25,8 +25,7 @@ const cspHeaders = [
|
|||
const urlHeaders = ["location", "content-location", "referer"];
|
||||
|
||||
function rewriteLinkHeader(link: string, origin?: URL) {
|
||||
return link
|
||||
.replace(/<(.*)>/gi, (match) => encodeUrl(match, origin));
|
||||
return link.replace(/<(.*)>/gi, (match) => encodeUrl(match, origin));
|
||||
}
|
||||
|
||||
export function rewriteHeaders(rawHeaders: BareHeaders, origin?: URL) {
|
||||
|
@ -49,7 +48,7 @@ export function rewriteHeaders(rawHeaders: BareHeaders, origin?: URL) {
|
|||
});
|
||||
|
||||
if (typeof headers["link"] === "string") {
|
||||
headers["link"] = rewriteLinkHeader(headers["link"], origin)
|
||||
headers["link"] = rewriteLinkHeader(headers["link"], origin);
|
||||
} else if (Array.isArray(headers["link"])) {
|
||||
headers["link"] = headers["link"].map((link) =>
|
||||
rewriteLinkHeader(link, origin)
|
||||
|
|
|
@ -20,7 +20,8 @@ Error.stackTraceLimit = 50;
|
|||
|
||||
global.rws = rewriteJs;
|
||||
export function rewriteJs(js: string | ArrayBuffer, origin?: URL) {
|
||||
if ("window" in globalThis) origin ??= new URL(decodeUrl(location.href));
|
||||
if ("window" in globalThis)
|
||||
origin = origin ?? new URL(decodeUrl(location.href));
|
||||
|
||||
const before = performance.now();
|
||||
if (typeof js === "string") {
|
||||
|
@ -48,7 +49,8 @@ export function rewriteJs(js: string | ArrayBuffer, origin?: URL) {
|
|||
//
|
||||
// if you can ensure all the preconditions are met this is faster than full rewrites
|
||||
export function rewriteJsNaiive(js: string | ArrayBuffer, origin?: URL) {
|
||||
if ("window" in globalThis) origin ??= new URL(decodeUrl(location.href));
|
||||
if ("window" in globalThis)
|
||||
origin = origin ?? new URL(decodeUrl(location.href));
|
||||
|
||||
if (typeof js !== "string") {
|
||||
js = new TextDecoder().decode(js);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue