dirpush 0.1.5 → 0.1.6
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.
|
@@ -13,14 +13,14 @@ Always drive the browser through `dirpush ab` (agent-browser on the agents' own
|
|
|
13
13
|
|
|
14
14
|
## Creating a password without ever seeing it
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
With the sign-up (or reset) page open in `dirpush ab`, one command generates the password, types it into every field you name, checks the site got it, and saves it to the vault. It never appears in your context or any file:
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
dirpush browser password <directory-id>-<product-id> --url <this page's url> --username <email> \
|
|
20
|
+
[--login-url <the site's sign-in page>] '<password selector>' ['<confirm selector>']
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
Passwords always have upper, lower, digit and symbol (24 chars). Pass `--login-url` whenever the page isn't the sign-in page (a sign-up form, a reset link): the vault opens that URL for every later `browser login`. Never generate passwords yourself (`openssl rand -base64` can lack a symbol, and sites reject it).
|
|
24
24
|
|
|
25
25
|
## Continue with Google (`accounts.oauth_google`)
|
|
26
26
|
|
package/package.json
CHANGED
package/src/browser.ts
CHANGED
|
@@ -136,7 +136,7 @@ export function strongPassword() {
|
|
|
136
136
|
* New account password: generated here, typed into every given field of the open tab on `url`'s site, checked,
|
|
137
137
|
* then saved to the vault as `name`. Returns no secret.
|
|
138
138
|
*/
|
|
139
|
-
export async function newPassword(name: string, url: string, username: string, selectors: string[]) {
|
|
139
|
+
export async function newPassword(name: string, url: string, username: string, selectors: string[], loginUrl = url) {
|
|
140
140
|
if (!selectors.length) throw new Error("pass the password field selector(s), e.g. 'input[type=password]'");
|
|
141
141
|
const page = await pageOn(url);
|
|
142
142
|
const pw = strongPassword();
|
|
@@ -145,6 +145,7 @@ export async function newPassword(name: string, url: string, username: string, s
|
|
|
145
145
|
const lengths = JSON.parse(ab(["eval", `JSON.stringify(${JSON.stringify(selectors)}.map((s) => document.querySelector(s)?.value.length ?? -1))`]));
|
|
146
146
|
const got = (typeof lengths === "string" ? JSON.parse(lengths) : lengths) as number[];
|
|
147
147
|
if (got.some((n) => n !== pw.length)) throw new Error(`password fields not filled (lengths ${got.join(", ")}); nothing saved`);
|
|
148
|
-
|
|
148
|
+
// The vault keeps the sign-in page: `browser login` opens on it later, so a reset or sign-up URL there breaks logins.
|
|
149
|
+
ab(["auth", "save", name, "--url", loginUrl, "--username", username, "--password-stdin"], pw);
|
|
149
150
|
return { vault: name, username, fields: selectors.length, page: page.url.slice(0, 200), saved: true };
|
|
150
151
|
}
|
package/src/cli.ts
CHANGED
|
@@ -79,6 +79,7 @@ const { values: flags, positionals } = parseArgs({
|
|
|
79
79
|
source: { type: "string" },
|
|
80
80
|
job: { type: "string" },
|
|
81
81
|
url: { type: "string" },
|
|
82
|
+
"login-url": { type: "string" },
|
|
82
83
|
username: { type: "string" },
|
|
83
84
|
rel: { type: "string" }, // registry set-link
|
|
84
85
|
samples: { type: "string" },
|
|
@@ -655,8 +656,8 @@ const commands: Record<string, (() => Promise<unknown> | unknown) | undefined> =
|
|
|
655
656
|
"browser stop": () => stopBrowser(),
|
|
656
657
|
"browser login": () => vaultLogin(arg(0, "vault-name")),
|
|
657
658
|
"browser password": () => {
|
|
658
|
-
if (!flags.url || !flags.username) throw new Error("browser password <vault-name> --url <
|
|
659
|
-
return newPassword(arg(0, "vault-name"), flags.url, flags.username, args.slice(1));
|
|
659
|
+
if (!flags.url || !flags.username) throw new Error("browser password <vault-name> --url <page-url> --username <email> [--login-url <sign-in page>] <field-selector…>");
|
|
660
|
+
return newPassword(arg(0, "vault-name"), flags.url, flags.username, args.slice(1), flags["login-url"]);
|
|
660
661
|
},
|
|
661
662
|
async "serve"() {
|
|
662
663
|
const { serve } = await import("./server");
|
|
@@ -730,7 +731,7 @@ const HELP: [string, [string, string][]][] = [
|
|
|
730
731
|
["google-login", "the human signs into Google once in the agents' Chrome profile"],
|
|
731
732
|
["browser start | status | stop", "the dedicated Chrome (real profile, Google services blocked) agents drive"],
|
|
732
733
|
["browser login <vault-name>", "fill a saved login into the open tab on that site (password never shown)"],
|
|
733
|
-
["browser password <vault-name> --url u --username e <selector…>", "new
|
|
734
|
+
["browser password <vault-name> --url u --username e [--login-url u] <selector…>", "new password (sign-up or reset): generate, fill, verify and save it (never shown); --login-url when the page isn't the sign-in page (e.g. a reset link)"],
|
|
734
735
|
]],
|
|
735
736
|
["Other", [
|
|
736
737
|
["dr show | dr refresh [--all]", "Domain Rating history (refresh needs AHREFS_API_KEY)"],
|