Fix custom favicon url, replace instructure.jpg with canvas.png, general bug fixes.
This commit is contained in:
parent
c524f5bbfd
commit
c56fff2e78
10 changed files with 113 additions and 25 deletions
15
index.js
15
index.js
|
|
@ -14,6 +14,7 @@ import dotenv from "dotenv";
|
|||
import cookieParser from "cookie-parser";
|
||||
import wisp from "wisp-server-node";
|
||||
import fs from "node:fs";
|
||||
import fetch from 'node-fetch';
|
||||
dotenv.config();
|
||||
|
||||
const LICENSE_SERVER_URL = "https://license.mercurywork.shop/validate?license=";
|
||||
|
|
@ -130,6 +131,18 @@ app.use(function (req, res, next) {
|
|||
res.header("Cross-Origin-Embedder-Policy", "require-corp");
|
||||
next();
|
||||
});
|
||||
app.use("/custom-favicon", async (req, res) => {
|
||||
try {
|
||||
const { url } = req.query;
|
||||
console.log(url)
|
||||
const response = await fetch(url).then((apiRes) => apiRes.buffer());
|
||||
res.setHeader("Content-Type", "image/png");
|
||||
res.send(response);
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
res.send("Error")
|
||||
}
|
||||
});
|
||||
app.use("/", express.static("dist/client/"));
|
||||
app.get("/favicon.ico", (req, res) => {
|
||||
res.sendFile(path.join(process.cwd(), "dist/client/favicon.svg"));
|
||||
|
|
@ -167,7 +180,7 @@ server.on("upgrade", (req, socket, head) => {
|
|||
bare.routeUpgrade(req, socket, head);
|
||||
} else if (shouldRouteRh(req)) {
|
||||
routeRhUpgrade(req, socket, head);
|
||||
} else if (req.url.endsWith("/")) {
|
||||
} else if (req.url.endsWith("/wisp/")) {
|
||||
wisp.routeRequest(req, socket, head);
|
||||
} else {
|
||||
socket.end();
|
||||
|
|
|
|||
85
package-lock.json
generated
85
package-lock.json
generated
|
|
@ -21,6 +21,7 @@
|
|||
"cookie-parser": "^1.4.6",
|
||||
"dotenv": "^16.3.1",
|
||||
"express": "^4.18.2",
|
||||
"node-fetch": "^3.3.2",
|
||||
"npm": "^10.2.5",
|
||||
"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",
|
||||
|
|
@ -3258,6 +3259,14 @@
|
|||
"resolved": "https://registry.npmjs.org/cuint/-/cuint-0.2.2.tgz",
|
||||
"integrity": "sha512-d4ZVpCW31eWwCMe1YT3ur7mUDnTXbgwyzaL320DrcRT45rfjYxkt5QWLrmOJ+/UEAI2+fQgKe/fCjR8l4TpRgw=="
|
||||
},
|
||||
"node_modules/data-uri-to-buffer": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz",
|
||||
"integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==",
|
||||
"engines": {
|
||||
"node": ">= 12"
|
||||
}
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.3.4",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
||||
|
|
@ -4159,6 +4168,28 @@
|
|||
"reusify": "^1.0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/fetch-blob": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz",
|
||||
"integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/jimmywarting"
|
||||
},
|
||||
{
|
||||
"type": "paypal",
|
||||
"url": "https://paypal.me/jimmywarting"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"node-domexception": "^1.0.0",
|
||||
"web-streams-polyfill": "^3.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.20 || >= 14.13"
|
||||
}
|
||||
},
|
||||
"node_modules/file-entry-cache": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
|
||||
|
|
@ -4300,6 +4331,17 @@
|
|||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/formdata-polyfill": {
|
||||
"version": "4.0.10",
|
||||
"resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz",
|
||||
"integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==",
|
||||
"dependencies": {
|
||||
"fetch-blob": "^3.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.20.0"
|
||||
}
|
||||
},
|
||||
"node_modules/forwarded": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
||||
|
|
@ -6640,6 +6682,41 @@
|
|||
"integrity": "sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA==",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/node-domexception": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz",
|
||||
"integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/jimmywarting"
|
||||
},
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://paypal.me/jimmywarting"
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/node-fetch": {
|
||||
"version": "3.3.2",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz",
|
||||
"integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==",
|
||||
"dependencies": {
|
||||
"data-uri-to-buffer": "^4.0.0",
|
||||
"fetch-blob": "^3.1.4",
|
||||
"formdata-polyfill": "^4.0.10"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/node-fetch"
|
||||
}
|
||||
},
|
||||
"node_modules/node-gyp": {
|
||||
"version": "8.4.1",
|
||||
"resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-8.4.1.tgz",
|
||||
|
|
@ -12487,6 +12564,14 @@
|
|||
"url": "https://github.com/sponsors/wooorm"
|
||||
}
|
||||
},
|
||||
"node_modules/web-streams-polyfill": {
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz",
|
||||
"integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==",
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/webauth": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/webauth/-/webauth-1.1.0.tgz",
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
"cookie-parser": "^1.4.6",
|
||||
"dotenv": "^16.3.1",
|
||||
"express": "^4.18.2",
|
||||
"node-fetch": "^3.3.2",
|
||||
"npm": "^10.2.5",
|
||||
"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",
|
||||
|
|
|
|||
BIN
public/icons/canvas.png
Normal file
BIN
public/icons/canvas.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 192 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.7 KiB |
|
|
@ -11,7 +11,7 @@
|
|||
link = document.createElement("link");
|
||||
link.rel = "icon";
|
||||
}
|
||||
link.href = parsedCloak.icon;
|
||||
link.href = `/custom-favicon?url=${parsedCloak.icon}`;
|
||||
document.getElementsByTagName("head")[0].appendChild(link);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,8 +34,7 @@
|
|||
if (!rammerheadSession) {
|
||||
let session = await fetch("/newsession");
|
||||
let sessionID = await session.text();
|
||||
// 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.
|
||||
document.cookie = `rammerhead-session=${sessionID}; max-age=${60 * 60 * 72}; path=/`;
|
||||
// Now add an origin_proxy cookie for our domain
|
||||
|
|
@ -50,12 +49,13 @@
|
|||
|
||||
async function loadContent() {
|
||||
let openWith = localStorage.getItem("alu__selectedOpenWith");
|
||||
let currentProxy = localStorage.getItem("alu__selectedProxy");
|
||||
let url = input!.value.trim();
|
||||
if (!isUrl(url)) url = getSearchEngine() + url;
|
||||
else if (!(url.startsWith("https://") || url.startsWith("http://"))) url = "http://" + url;
|
||||
if (openWith) {
|
||||
let openWithParsed = JSON.parse(openWith);
|
||||
if (openWithParsed.value === "newTab") {
|
||||
if (openWithParsed.value === "newTab" || JSON.parse(currentProxy!).value === "rammerhead") {
|
||||
window.open(await getProxyURL(), "_blank");
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ const presetCloaks = [
|
|||
"/icons/google.png",
|
||||
},
|
||||
{
|
||||
cloakTitle: "Instructure",
|
||||
favicon: "/icons/instructure.jpg",
|
||||
cloakTitle: "Canvas",
|
||||
favicon: "/icons/canvas.png",
|
||||
},
|
||||
{
|
||||
cloakTitle: "Google Classroom",
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ type transportConfig = {
|
|||
} | string;
|
||||
|
||||
export const wispURLDefault =
|
||||
(location.protocol === "https:" ? "wss://" : "ws://") + location.host + "/";
|
||||
(location.protocol === "https:" ? "wss://" : "ws://") + location.host + "/wisp/";
|
||||
export default class TransportManager {
|
||||
private transport = "EpxMod.EpoxyClient";
|
||||
|
||||
|
|
@ -50,9 +50,9 @@ export default class TransportManager {
|
|||
}
|
||||
|
||||
export const TransportMgr = new TransportManager();
|
||||
export function initTransport() {
|
||||
registerRemoteListener(navigator.serviceWorker.controller!);
|
||||
navigator.serviceWorker
|
||||
export async function initTransport() {
|
||||
await registerRemoteListener(navigator.serviceWorker.controller!);
|
||||
await navigator.serviceWorker
|
||||
.register("/sw.js", {
|
||||
scope: window.__uv$config.prefix,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -70,21 +70,9 @@ export function getStaticPaths() {
|
|||
let parsedTransport = JSON.parse(savedTransport);
|
||||
TransportMgr.setTransport(parsedTransport.value);
|
||||
}
|
||||
initTransport();
|
||||
// Inject Epoxy, Libcurl, and Bare scripts into the DOM
|
||||
let epoxyScript = document.createElement("script");
|
||||
epoxyScript.src = "/epoxy/index.js";
|
||||
document.body.appendChild(epoxyScript);
|
||||
let libcurlScript = document.createElement("script");
|
||||
libcurlScript.src = "/libcurl/index.js";
|
||||
document.body.appendChild(libcurlScript);
|
||||
let bareTransportScript = document.createElement("script");
|
||||
bareTransportScript.src = "/bare_transport.js";
|
||||
document.body.appendChild(bareTransportScript);
|
||||
|
||||
await initTransport();
|
||||
});
|
||||
initTransport();
|
||||
// Inject Epoxy, Libcurl, and Bare scripts into the DOM
|
||||
// Inject Epoxy, Libcurl, and Bare scripts into the DOM
|
||||
let epoxyScript = document.createElement("script");
|
||||
epoxyScript.src = "/epoxy/index.js";
|
||||
document.body.appendChild(epoxyScript);
|
||||
|
|
@ -94,6 +82,7 @@ export function getStaticPaths() {
|
|||
let bareTransportScript = document.createElement("script");
|
||||
bareTransportScript.src = "/bare_transport.js";
|
||||
document.body.appendChild(bareTransportScript);
|
||||
await initTransport();
|
||||
type Suggestion = {
|
||||
phrase: string;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue