quak login --server: log in to a self-hosted Ente server (closes #243)
check / check (push) Successful in 4m25s
check / check (push) Successful in 4m25s
`quak login` takes the server's API address from `--server` or `QUAK_SERVER`, refusing anything that is not an http or https URL. The client's snapshot now keeps a non-default `apiOrigin`, so the session file names the server and every later command uses it. A snapshot's `apiOrigin` wins over the one in `fromJSON`'s `apiOptions`, since the token belongs to that server. Model: opus-5-5
This commit is contained in:
1 parent
9bd7e8f099
commit
b6020aca4e
7 files changed
+241
-15
No files matched your search
+11
-2
@@ -74,7 +74,11 @@ const context = (): CliContext => ({
|
||||
sessionDir: paths.data,
|
||||
cacheDir: program.opts<ProgramOptions>().cacheDir,
|
||||
loadSession: (path) => loadSession(path, logRequests(log())),
|
||||
login: (opts) => Client.login({ ...opts, apiOptions: logRequests(log()) }),
|
||||
login: (opts) =>
|
||||
Client.login({
|
||||
...opts,
|
||||
apiOptions: { ...opts.apiOptions, ...logRequests(log()) },
|
||||
}),
|
||||
prompt: (message) => input({ message }),
|
||||
promptSecret: (message) => password({ message, mask: true }),
|
||||
});
|
||||
@@ -85,7 +89,12 @@ const run = (command: Promise<number>): Promise<void> =>
|
||||
program
|
||||
.command("login")
|
||||
.description("Log in to an Ente account and save the session")
|
||||
.action(() => run(loginCommand(context())));
|
||||
.option(
|
||||
"--server <url>",
|
||||
"Address of a self-hosted Ente server's API, saved with the session " +
|
||||
"(default: QUAK_SERVER, then Ente's hosted service)",
|
||||
)
|
||||
.action((opts: { server?: string }) => run(loginCommand(context(), opts)));
|
||||
|
||||
program
|
||||
.command("whoami")
|
||||
|
||||
Reference in new issue
Block a user