Add origin_proxy cookie (ty sm binaryperson), and remove helmet.

This commit is contained in:
wearrrrr 2024-02-25 18:20:23 -06:00
parent d5ecbaadac
commit 32cfc7676e
4 changed files with 5 additions and 26 deletions

View file

@ -9,7 +9,6 @@ import { build } from "astro";
import chalk from "chalk"; import chalk from "chalk";
import { existsSync } from "fs"; import { existsSync } from "fs";
import dotenv from "dotenv"; import dotenv from "dotenv";
import helmet from "helmet";
dotenv.config(); dotenv.config();
if (!existsSync("./dist")) build(); if (!existsSync("./dist")) build();

9
package-lock.json generated
View file

@ -16,7 +16,6 @@
"compression": "^1.7.4", "compression": "^1.7.4",
"dotenv": "^16.3.1", "dotenv": "^16.3.1",
"express": "^4.18.2", "express": "^4.18.2",
"helmet": "^7.1.0",
"npm": "^10.2.5", "npm": "^10.2.5",
"path": "^0.12.7", "path": "^0.12.7",
"rammerhead": "https://github.com/NebulaServices/rammerhead/releases/download/rammerhead-1.2.41-nebula.8/rammerhead-1.2.41-nebula.7.tgz", "rammerhead": "https://github.com/NebulaServices/rammerhead/releases/download/rammerhead-1.2.41-nebula.8/rammerhead-1.2.41-nebula.7.tgz",
@ -3466,14 +3465,6 @@
"resolved": "https://registry.npmjs.org/headers-polyfill/-/headers-polyfill-3.3.0.tgz", "resolved": "https://registry.npmjs.org/headers-polyfill/-/headers-polyfill-3.3.0.tgz",
"integrity": "sha512-5e57etwBpNcDc0b6KCVWEh/Ro063OxPvzVimUdM0/tsYM/T7Hfy3kknIGj78SFTOhNd8AZY41U8mOHoO4LzmIQ==" "integrity": "sha512-5e57etwBpNcDc0b6KCVWEh/Ro063OxPvzVimUdM0/tsYM/T7Hfy3kknIGj78SFTOhNd8AZY41U8mOHoO4LzmIQ=="
}, },
"node_modules/helmet": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/helmet/-/helmet-7.1.0.tgz",
"integrity": "sha512-g+HZqgfbpXdCkme/Cd/mZkV0aV3BZZZSugecH03kl38m/Kmdx8jKjBikpDj2cr+Iynv4KpYEviojNdTJActJAg==",
"engines": {
"node": ">=16.0.0"
}
},
"node_modules/html-escaper": { "node_modules/html-escaper": {
"version": "3.0.3", "version": "3.0.3",
"resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-3.0.3.tgz", "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-3.0.3.tgz",

View file

@ -17,7 +17,6 @@
"compression": "^1.7.4", "compression": "^1.7.4",
"dotenv": "^16.3.1", "dotenv": "^16.3.1",
"express": "^4.18.2", "express": "^4.18.2",
"helmet": "^7.1.0",
"npm": "^10.2.5", "npm": "^10.2.5",
"path": "^0.12.7", "path": "^0.12.7",
"rammerhead": "https://github.com/NebulaServices/rammerhead/releases/download/rammerhead-1.2.41-nebula.8/rammerhead-1.2.41-nebula.7.tgz", "rammerhead": "https://github.com/NebulaServices/rammerhead/releases/download/rammerhead-1.2.41-nebula.8/rammerhead-1.2.41-nebula.7.tgz",

View file

@ -39,26 +39,18 @@
// Disable URL shuffling on rewrite, eventually I'll try and figure out how it works, but for now, it's disabled. // Disable URL shuffling on rewrite, eventually I'll try and figure out how it works, but for now, it's disabled.
await fetch("/editsession?id=" + sessionID + "&enableShuffling=0"); await fetch("/editsession?id=" + sessionID + "&enableShuffling=0");
// Now save it in a cookie that expires in 72 hours. // Now save it in a cookie that expires in 72 hours.
document.cookie = `rammerhead-session=${sessionID}; max-age=${60 * 60 * 72}; path=/`; document.cookie += `rammerhead-session=${sessionID}; max-age=${60 * 60 * 72}; path=/`;
// Now add an origin_proxy cookie for our domain
document.cookie += `origin_proxy=${window.location.origin}; max-age=${60 * 60 * 72}; path=/`;
} }
try { iframe.src = `/${getCookie("rammerhead-session")}/${url}`;
iframe.src = `https://aluu.xyz/${getCookie("rammerhead-session")}/${url}`;
} catch {
window.open(`https://aluu.xyz/${getCookie("rammerhead-session")}/${url}`);
}
} else { } else {
// Default to UV // Default to UV
iframe.src = window.__uv$config.prefix + window.__uv$config.encodeUrl(url); iframe.src = window.__uv$config.prefix + window.__uv$config.encodeUrl(url);
} }
iframe.style.pointerEvents = "auto"; iframe.style.pointerEvents = "auto";
iframe.classList.add("proxy-frame"); iframe.classList.add("proxy-frame");
try {
document.body.appendChild(iframe); document.body.appendChild(iframe);
} catch {
window.open(iframe.src);
}
iframeURLChange(iframe, (newURL) => updateTopbarURL(preference, newURL)); iframeURLChange(iframe, (newURL) => updateTopbarURL(preference, newURL));
const boundIFrameLoad = iframeLoad.bind(null, iframe, loadingContent, topbar, closeButton); const boundIFrameLoad = iframeLoad.bind(null, iframe, loadingContent, topbar, closeButton);
iframe.addEventListener("load", boundIFrameLoad); iframe.addEventListener("load", boundIFrameLoad);
@ -68,14 +60,12 @@
iframe.style.opacity = 1; iframe.style.opacity = 1;
topbar.style.opacity = 1; topbar.style.opacity = 1;
topbar.style.pointerEvents = "auto"; topbar.style.pointerEvents = "auto";
document.body.style.overflow = "hidden";
closeButton.onclick = () => { closeButton.onclick = () => {
iframe.style.opacity = 0; iframe.style.opacity = 0;
topbar.style.opacity = 0; topbar.style.opacity = 0;
iframe.style.pointerEvents = "none"; iframe.style.pointerEvents = "none";
topbar.style.pointerEvents = "none"; topbar.style.pointerEvents = "none";
document.body.style.overflow = "auto";
iframe.removeEventListener("load", boundIFrameLoad); iframe.removeEventListener("load", boundIFrameLoad);
setTimeout(() => { setTimeout(() => {