chemicaljs
Advanced tools
Comparing version 2.0.2 to 2.1.0
83
index.js
@@ -22,8 +22,3 @@ import { resolve, dirname } from "node:path"; | ||
import { meteorPath } from "meteorproxy"; | ||
import { | ||
createRammerhead, | ||
shouldRouteRh, | ||
routeRhUpgrade, | ||
routeRhRequest, | ||
} from "@rubynetwork/rammerhead"; | ||
import createRammerhead from "rammerhead/src/server/index.js"; | ||
const __dirname = dirname(fileURLToPath(import.meta.url)); | ||
@@ -72,5 +67,33 @@ | ||
serveChemical = () => { | ||
const rh = createRammerhead({ | ||
logLevel: "error", | ||
}); | ||
const rh = createRammerhead(); | ||
const rammerheadScopes = [ | ||
"/rammerhead.js", | ||
"/hammerhead.js", | ||
"/transport-worker.js", | ||
"/task.js", | ||
"/iframe-task.js", | ||
"/worker-hammerhead.js", | ||
"/messaging", | ||
"/sessionexists", | ||
"/deletesession", | ||
"/newsession", | ||
"/editsession", | ||
"/needpassword", | ||
"/syncLocalStorage", | ||
"/api/shuffleDict", | ||
]; | ||
const rammerheadSession = /^\/[a-z0-9]{32}/; | ||
const shouldRouteRh = (req) => { | ||
const url = new URL(req.url, "http://0.0.0.0"); | ||
return ( | ||
rammerheadScopes.includes(url.pathname) || | ||
rammerheadSession.test(url.pathname) | ||
); | ||
}; | ||
const routeRhRequest = (req, res) => { | ||
rh.emit("request", req, res); | ||
}; | ||
const routeRhUpgrade = (req, socket, head) => { | ||
rh.emit("upgrade", req, socket, head); | ||
}; | ||
@@ -174,3 +197,3 @@ this.app.get("/chemical.js", async (req, res) => { | ||
if (this.options.rammerhead && shouldRouteRh(req)) { | ||
routeRhRequest(rh, req, res); | ||
routeRhRequest(req, res); | ||
} else { | ||
@@ -189,3 +212,3 @@ this.app(req, res); | ||
} else if (this.options.rammerhead && shouldRouteRh(req)) { | ||
routeRhUpgrade(rh, req, socket, head); | ||
routeRhUpgrade(req, socket, head); | ||
} else { | ||
@@ -233,5 +256,33 @@ socket.end(); | ||
const rh = createRammerhead({ | ||
logLevel: "error", | ||
}); | ||
const rh = createRammerhead(); | ||
const rammerheadScopes = [ | ||
"/rammerhead.js", | ||
"/hammerhead.js", | ||
"/transport-worker.js", | ||
"/task.js", | ||
"/iframe-task.js", | ||
"/worker-hammerhead.js", | ||
"/messaging", | ||
"/sessionexists", | ||
"/deletesession", | ||
"/newsession", | ||
"/editsession", | ||
"/needpassword", | ||
"/syncLocalStorage", | ||
"/api/shuffleDict", | ||
]; | ||
const rammerheadSession = /^\/[a-z0-9]{32}/; | ||
const shouldRouteRh = (req) => { | ||
const url = new URL(req.url, "http://0.0.0.0"); | ||
return ( | ||
rammerheadScopes.includes(url.pathname) || | ||
rammerheadSession.test(url.pathname) | ||
); | ||
}; | ||
const routeRhRequest = (req, res) => { | ||
rh.emit("request", req, res); | ||
}; | ||
const routeRhUpgrade = (req, socket, head) => { | ||
rh.emit("upgrade", req, socket, head); | ||
}; | ||
@@ -333,3 +384,3 @@ const app = express(); | ||
if (options.rammerhead && shouldRouteRh(req)) { | ||
routeRhRequest(rh, req, res); | ||
routeRhRequest(req, res); | ||
} else { | ||
@@ -355,3 +406,3 @@ next(); | ||
} else if (options.rammerhead && shouldRouteRh(req)) { | ||
routeRhUpgrade(rh, req, socket, head); | ||
routeRhUpgrade(req, socket, head); | ||
} else { | ||
@@ -358,0 +409,0 @@ for (const upgrader of upgraders) { |
{ | ||
"name": "chemicaljs", | ||
"version": "2.0.2", | ||
"description": "Easily create your own web proxy with no experience required.", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/chemicaljs/chemical.git" | ||
}, | ||
"main": "index.js", | ||
"type": "module", | ||
"author": "Nebelung", | ||
"license": "AGPL-3.0-only", | ||
"scripts": { | ||
"update": "npx npm-check-updates -u && npm i" | ||
}, | ||
"dependencies": { | ||
"@mercuryworkshop/bare-mux": "^2.0.9", | ||
"@mercuryworkshop/epoxy-transport": "^2.1.13", | ||
"@mercuryworkshop/libcurl-transport": "^1.3.10", | ||
"@mercuryworkshop/scramjet": "^1.0.2", | ||
"@mercuryworkshop/wisp-js": "^0.3.2", | ||
"@rubynetwork/rammerhead": "^1.3.5", | ||
"@titaniumnetwork-dev/ultraviolet": "^3.2.7", | ||
"express": "^4.21.0", | ||
"meteorproxy": "^1.0.6-patch.1" | ||
}, | ||
"engines": { | ||
"node": ">=20.11.0" | ||
} | ||
"name": "chemicaljs", | ||
"version": "2.1.0", | ||
"description": "Easily create your own web proxy with no experience required.", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/chemicaljs/chemical.git" | ||
}, | ||
"main": "index.js", | ||
"type": "module", | ||
"author": "Nebelung", | ||
"license": "AGPL-3.0-only", | ||
"scripts": { | ||
"update": "npx npm-check-updates -u && npm i" | ||
}, | ||
"dependencies": { | ||
"@mercuryworkshop/bare-mux": "^2.1.2", | ||
"@mercuryworkshop/epoxy-transport": "^2.1.17", | ||
"@mercuryworkshop/libcurl-transport": "^1.3.10", | ||
"@mercuryworkshop/scramjet": "^1.0.2", | ||
"@mercuryworkshop/wisp-js": "^0.3.2", | ||
"@titaniumnetwork-dev/ultraviolet": "^3.2.7", | ||
"express": "^4.21.1", | ||
"meteorproxy": "^1.0.6-patch.1", | ||
"rammerhead": "https://github.com/chemicaljs/chemical/raw/main/rammerhead.tgz" | ||
}, | ||
"engines": { | ||
"node": ">=20.11.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
HTTP dependency
Supply chain riskContains a dependency which resolves to a remote HTTP URL which could be used to inject untrusted code and reduce overall package reliability.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
474925
11
1220
1
+ Addedrammerhead@https://github.com/chemicaljs/chemical/raw/main/rammerhead.tgz
- Removed@rubynetwork/rammerhead@^1.3.5
- Removed@adobe/css-tools@4.4.1(transitive)
- Removed@electron/asar@3.2.17(transitive)
- Removed@rubynetwork/rammerhead@1.3.6(transitive)
- Removed@rubynetwork/rh@1.2.76(transitive)
- Removed@types/estree@0.0.46(transitive)
- Removedacorn-hammerhead@0.6.2(transitive)
- Removedasync-exit-hook@2.0.1(transitive)
- Removedbowser@1.6.0(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedcallsite@1.0.0(transitive)
- Removedcommander@5.1.0(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedcookie@0.7.2(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removedcrypto-md5@1.0.0(transitive)
- Removeddebug@4.3.1(transitive)
- Removeddes.js@1.1.0(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedesotope-hammerhead@0.6.8(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedglob@7.2.3(transitive)
- Removedhttp-cache-semantics@4.1.1(transitive)
- Removedhttp-parser-js@0.5.8(transitive)
- Removedhttpntlm@1.8.13(transitive)
- Removedhttpreq@1.1.1(transitive)
- Removediconv-lite@0.5.1(transitive)
- Removedinflight@1.0.6(transitive)
- Removedip@1.1.9(transitive)
- Removedisarray@1.0.0(transitive)
- Removedjs-md4@0.3.2(transitive)
- Removedlodash@4.17.21(transitive)
- Removedlru-cache@2.6.36.0.07.18.3(transitive)
- Removedmatch-url-wildcard@0.0.4(transitive)
- Removedmerge-stream@1.0.1(transitive)
- Removedmime@1.4.12.6.0(transitive)
- Removedminimalistic-assert@1.0.1(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedms@2.1.2(transitive)
- Removedmustache@2.3.2(transitive)
- Removednanoid@3.3.7(transitive)
- Removedonce@1.4.0(transitive)
- Removedos-family@1.1.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedpicocolors@1.1.1(transitive)
- Removedpinkie@2.0.4(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedpsl@1.13.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedquerystringify@2.2.0(transitive)
- Removedread-file-relative@1.2.0(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedrequires-port@1.0.0(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedsemver@7.5.3(transitive)
- Removedsticky-session-custom@1.2.1(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedtestcafe-hammerhead@31.7.2(transitive)
- Removedtough-cookie@4.1.3(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removeduglify-js@3.19.3(transitive)
- Removedunderscore@1.12.1(transitive)
- Removeduniversalify@0.2.0(transitive)
- Removedurl-parse@1.5.10(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removeduuid@8.3.2(transitive)
- Removedwrappy@1.0.2(transitive)
- Removedws@7.5.10(transitive)
- Removedyallist@4.0.0(transitive)
Updatedexpress@^4.21.1