rechrome 1.26.0 → 1.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +140 -103
- package/listeners.js +57 -0
- package/listeners.ts +54 -1
- package/package.json +1 -1
- package/rechrome.js +368 -166
- package/rechrome.ts +368 -166
- package/serve.js +3 -1
- package/serve.ts +3 -1
package/serve.js
CHANGED
|
@@ -328,10 +328,12 @@ export async function serve() {
|
|
|
328
328
|
const scoped = listener.profiles !== "*";
|
|
329
329
|
const reqUrl = new URL(req.url);
|
|
330
330
|
const prefix = normalizePrefix(listener.prefix);
|
|
331
|
+
// Accept the path with or without the prefix, so a proxy works whether it keeps the
|
|
332
|
+
// mount path (target .../rechrome) or strips it (bare port). The key, not the prefix,
|
|
333
|
+
// guards every route.
|
|
331
334
|
if (prefix !== "/") {
|
|
332
335
|
if (reqUrl.pathname === prefix.slice(0, -1)) reqUrl.pathname = "/";
|
|
333
336
|
else if (reqUrl.pathname.startsWith(prefix)) reqUrl.pathname = "/" + reqUrl.pathname.slice(prefix.length);
|
|
334
|
-
else return new Response("Not found", { status: 404 });
|
|
335
337
|
}
|
|
336
338
|
|
|
337
339
|
// Serve files from output dir
|
package/serve.ts
CHANGED
|
@@ -328,10 +328,12 @@ export async function serve() {
|
|
|
328
328
|
const scoped = listener.profiles !== "*";
|
|
329
329
|
const reqUrl = new URL(req.url);
|
|
330
330
|
const prefix = normalizePrefix(listener.prefix);
|
|
331
|
+
// Accept the path with or without the prefix, so a proxy works whether it keeps the
|
|
332
|
+
// mount path (target .../rechrome) or strips it (bare port). The key, not the prefix,
|
|
333
|
+
// guards every route.
|
|
331
334
|
if (prefix !== "/") {
|
|
332
335
|
if (reqUrl.pathname === prefix.slice(0, -1)) reqUrl.pathname = "/";
|
|
333
336
|
else if (reqUrl.pathname.startsWith(prefix)) reqUrl.pathname = "/" + reqUrl.pathname.slice(prefix.length);
|
|
334
|
-
else return new Response("Not found", { status: 404 });
|
|
335
337
|
}
|
|
336
338
|
|
|
337
339
|
// Serve files from output dir
|