rechrome 1.10.2 → 1.10.3
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/package.json +1 -1
- package/rech.js +14 -3
- package/rech.ts +14 -3
package/package.json
CHANGED
package/rech.js
CHANGED
|
@@ -120,7 +120,7 @@ export function parseUrl(raw: string) {
|
|
|
120
120
|
export async function getOrCreateUrl(): Promise<string> {
|
|
121
121
|
// Treat a URL without a bearer key as missing — it cannot authenticate
|
|
122
122
|
try { if (process.env[ENV_KEY] && new URL(process.env[ENV_KEY]!).username) return process.env[ENV_KEY]!; } catch {}
|
|
123
|
-
const key = randomBytes(
|
|
123
|
+
const key = randomBytes(12).toString("base64url"); // 16 chars
|
|
124
124
|
const url = `http://${key}@127.0.0.1:${DEFAULT_PORT}`;
|
|
125
125
|
const newLine = `${ENV_KEY}=${url}`;
|
|
126
126
|
// Write to ~/.env.local so it's not shadowed by project .env.local
|
|
@@ -362,7 +362,7 @@ async function callServe(
|
|
|
362
362
|
process.exit(1);
|
|
363
363
|
});
|
|
364
364
|
if (res.status === 401) {
|
|
365
|
-
console.error(`[rech] rech-client -> rech-server[ok]\n -x:
|
|
365
|
+
console.error(`[rech] rech-client -> rech-server[ok]\n -x: bearer key rejected (used: ${key.slice(0, 4)}...) -> playwright[unknown]`);
|
|
366
366
|
process.exit(1);
|
|
367
367
|
}
|
|
368
368
|
return res.json();
|
|
@@ -486,6 +486,17 @@ async function runOxmgr(args: string[]): Promise<number> {
|
|
|
486
486
|
}
|
|
487
487
|
|
|
488
488
|
async function daemonInstall(serveUrl: string): Promise<void> {
|
|
489
|
+
// Persist the URL to ~/.env.local before starting the daemon. The daemon's
|
|
490
|
+
// loadEnv() walks CWD→root reading .env.local files and unconditionally
|
|
491
|
+
// overwrites process.env.RECHROME_URL from whichever file it finds first.
|
|
492
|
+
// Without this write, oxmgr's --env RECHROME_URL=... gets clobbered by a
|
|
493
|
+
// stale ~/.env.local entry — the daemon then listens on a different bearer
|
|
494
|
+
// key than the one daemonInstall was called with, and every client request
|
|
495
|
+
// is rejected with "bearer key rejected".
|
|
496
|
+
const envRaw = await file(globalEnvFile).text().catch(() => "");
|
|
497
|
+
const filtered = envRaw.trimEnd().split("\n").filter(l => !l.startsWith(`${ENV_KEY}=`));
|
|
498
|
+
await Bun.write(globalEnvFile, [...filtered, `${ENV_KEY}=${serveUrl}`, ""].join("\n"));
|
|
499
|
+
|
|
489
500
|
const home = process.env.HOME!;
|
|
490
501
|
const bunBin = Bun.which("bun") ?? process.execPath;
|
|
491
502
|
const rechScript = import.meta.filename;
|
|
@@ -682,7 +693,7 @@ async function setup(opts: { profile?: string } = {}): Promise<void> {
|
|
|
682
693
|
|
|
683
694
|
// Build RECHROME_URL and show it before asking where to save
|
|
684
695
|
const rechUrl = new URL(url);
|
|
685
|
-
if (!rechUrl.username) rechUrl.username = randomBytes(
|
|
696
|
+
if (!rechUrl.username) rechUrl.username = randomBytes(12).toString("base64url");
|
|
686
697
|
rechUrl.searchParams.set("extension_id", extId);
|
|
687
698
|
rechUrl.searchParams.set("token", token);
|
|
688
699
|
rechUrl.searchParams.set("profile", profileEmail);
|
package/rech.ts
CHANGED
|
@@ -120,7 +120,7 @@ export function parseUrl(raw: string) {
|
|
|
120
120
|
export async function getOrCreateUrl(): Promise<string> {
|
|
121
121
|
// Treat a URL without a bearer key as missing — it cannot authenticate
|
|
122
122
|
try { if (process.env[ENV_KEY] && new URL(process.env[ENV_KEY]!).username) return process.env[ENV_KEY]!; } catch {}
|
|
123
|
-
const key = randomBytes(
|
|
123
|
+
const key = randomBytes(12).toString("base64url"); // 16 chars
|
|
124
124
|
const url = `http://${key}@127.0.0.1:${DEFAULT_PORT}`;
|
|
125
125
|
const newLine = `${ENV_KEY}=${url}`;
|
|
126
126
|
// Write to ~/.env.local so it's not shadowed by project .env.local
|
|
@@ -362,7 +362,7 @@ async function callServe(
|
|
|
362
362
|
process.exit(1);
|
|
363
363
|
});
|
|
364
364
|
if (res.status === 401) {
|
|
365
|
-
console.error(`[rech] rech-client -> rech-server[ok]\n -x:
|
|
365
|
+
console.error(`[rech] rech-client -> rech-server[ok]\n -x: bearer key rejected (used: ${key.slice(0, 4)}...) -> playwright[unknown]`);
|
|
366
366
|
process.exit(1);
|
|
367
367
|
}
|
|
368
368
|
return res.json();
|
|
@@ -486,6 +486,17 @@ async function runOxmgr(args: string[]): Promise<number> {
|
|
|
486
486
|
}
|
|
487
487
|
|
|
488
488
|
async function daemonInstall(serveUrl: string): Promise<void> {
|
|
489
|
+
// Persist the URL to ~/.env.local before starting the daemon. The daemon's
|
|
490
|
+
// loadEnv() walks CWD→root reading .env.local files and unconditionally
|
|
491
|
+
// overwrites process.env.RECHROME_URL from whichever file it finds first.
|
|
492
|
+
// Without this write, oxmgr's --env RECHROME_URL=... gets clobbered by a
|
|
493
|
+
// stale ~/.env.local entry — the daemon then listens on a different bearer
|
|
494
|
+
// key than the one daemonInstall was called with, and every client request
|
|
495
|
+
// is rejected with "bearer key rejected".
|
|
496
|
+
const envRaw = await file(globalEnvFile).text().catch(() => "");
|
|
497
|
+
const filtered = envRaw.trimEnd().split("\n").filter(l => !l.startsWith(`${ENV_KEY}=`));
|
|
498
|
+
await Bun.write(globalEnvFile, [...filtered, `${ENV_KEY}=${serveUrl}`, ""].join("\n"));
|
|
499
|
+
|
|
489
500
|
const home = process.env.HOME!;
|
|
490
501
|
const bunBin = Bun.which("bun") ?? process.execPath;
|
|
491
502
|
const rechScript = import.meta.filename;
|
|
@@ -682,7 +693,7 @@ async function setup(opts: { profile?: string } = {}): Promise<void> {
|
|
|
682
693
|
|
|
683
694
|
// Build RECHROME_URL and show it before asking where to save
|
|
684
695
|
const rechUrl = new URL(url);
|
|
685
|
-
if (!rechUrl.username) rechUrl.username = randomBytes(
|
|
696
|
+
if (!rechUrl.username) rechUrl.username = randomBytes(12).toString("base64url");
|
|
686
697
|
rechUrl.searchParams.set("extension_id", extId);
|
|
687
698
|
rechUrl.searchParams.set("token", token);
|
|
688
699
|
rechUrl.searchParams.set("profile", profileEmail);
|