rechrome 1.8.0 → 1.8.1
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 +3 -1
- package/rech.ts +3 -1
package/package.json
CHANGED
package/rech.js
CHANGED
|
@@ -118,7 +118,8 @@ export function parseUrl(raw: string) {
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
export async function getOrCreateUrl(): Promise<string> {
|
|
121
|
-
|
|
121
|
+
// Treat a URL without a bearer key as missing — it cannot authenticate
|
|
122
|
+
try { if (process.env[ENV_KEY] && new URL(process.env[ENV_KEY]!).username) return process.env[ENV_KEY]!; } catch {}
|
|
122
123
|
const key = randomBytes(9).toString("base64url"); // 12 chars
|
|
123
124
|
const url = `http://${key}@127.0.0.1:${DEFAULT_PORT}`;
|
|
124
125
|
const newLine = `${ENV_KEY}=${url}`;
|
|
@@ -645,6 +646,7 @@ async function setup(opts: { profile?: string } = {}): Promise<void> {
|
|
|
645
646
|
if (saveChoice === "2") mkdirSync(join(process.cwd(), ".rechrome"), { recursive: true });
|
|
646
647
|
const existing = await file(globalEnvPath).text().catch(() => "");
|
|
647
648
|
const rechUrl = new URL(url);
|
|
649
|
+
if (!rechUrl.username) rechUrl.username = randomBytes(9).toString("base64url");
|
|
648
650
|
rechUrl.searchParams.set("extension_id", extId);
|
|
649
651
|
rechUrl.searchParams.set("token", token);
|
|
650
652
|
rechUrl.searchParams.set("profile", profileEmail);
|
package/rech.ts
CHANGED
|
@@ -118,7 +118,8 @@ export function parseUrl(raw: string) {
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
export async function getOrCreateUrl(): Promise<string> {
|
|
121
|
-
|
|
121
|
+
// Treat a URL without a bearer key as missing — it cannot authenticate
|
|
122
|
+
try { if (process.env[ENV_KEY] && new URL(process.env[ENV_KEY]!).username) return process.env[ENV_KEY]!; } catch {}
|
|
122
123
|
const key = randomBytes(9).toString("base64url"); // 12 chars
|
|
123
124
|
const url = `http://${key}@127.0.0.1:${DEFAULT_PORT}`;
|
|
124
125
|
const newLine = `${ENV_KEY}=${url}`;
|
|
@@ -645,6 +646,7 @@ async function setup(opts: { profile?: string } = {}): Promise<void> {
|
|
|
645
646
|
if (saveChoice === "2") mkdirSync(join(process.cwd(), ".rechrome"), { recursive: true });
|
|
646
647
|
const existing = await file(globalEnvPath).text().catch(() => "");
|
|
647
648
|
const rechUrl = new URL(url);
|
|
649
|
+
if (!rechUrl.username) rechUrl.username = randomBytes(9).toString("base64url");
|
|
648
650
|
rechUrl.searchParams.set("extension_id", extId);
|
|
649
651
|
rechUrl.searchParams.set("token", token);
|
|
650
652
|
rechUrl.searchParams.set("profile", profileEmail);
|