mysticals 0.5.0 → 0.6.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.
Files changed (2) hide show
  1. package/dist/cli.js +42 -9
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -5,7 +5,7 @@ import { createElement } from "react";
5
5
  import { render } from "ink";
6
6
 
7
7
  // package.json
8
- var version = "0.5.0";
8
+ var version = "0.6.0";
9
9
 
10
10
  // src/client.ts
11
11
  import { spawn } from "child_process";
@@ -4196,9 +4196,16 @@ function StatusLine({ now, message, update, width, onOpen, onInvites, onAccounts
4196
4196
  invites === 1 ? "1 invite" : `${invites} invites`,
4197
4197
  " (i)"
4198
4198
  ] }), onInvites]);
4199
- if (failed.length) parts.push([/* @__PURE__ */ jsxs8(Text8, { color: C.red, children: [
4199
+ const off = failed.filter((a) => a.authError);
4200
+ const broken = failed.filter((a) => !a.authError);
4201
+ if (off.length) parts.push([/* @__PURE__ */ jsxs8(Text8, { color: C.red, children: [
4200
4202
  "\u26A0 ",
4201
- failed.map((a) => a.label).join(", "),
4203
+ off.map((a) => a.label).join(", "),
4204
+ " disconnected (s)"
4205
+ ] }), onAccounts]);
4206
+ if (broken.length) parts.push([/* @__PURE__ */ jsxs8(Text8, { color: C.red, children: [
4207
+ "\u26A0 ",
4208
+ broken.map((a) => a.label).join(", "),
4202
4209
  " sync failed (s)"
4203
4210
  ] }), onAccounts]);
4204
4211
  if (message) parts.push([message]);
@@ -4404,13 +4411,13 @@ function Accounts({ onClose }) {
4404
4411
  (e) => say(errorText(e), true)
4405
4412
  );
4406
4413
  };
4407
- const addGoogle = () => {
4414
+ const googleSignIn2 = (fn, done) => {
4408
4415
  const s = ++googleSession.current;
4409
4416
  setMode({ kind: "google" });
4410
4417
  setMessage(void 0);
4411
4418
  setAuthUrl(void 0);
4412
- api.accounts.addGoogle().then(
4413
- (a) => s === googleSession.current && (setMode({ kind: "list" }), say(`Added ${a.label}`)),
4419
+ fn().then(
4420
+ (a) => s === googleSession.current && (setMode({ kind: "list" }), say(done(a))),
4414
4421
  (e) => s === googleSession.current && (setMode({ kind: "list" }), say(errorText(e), true))
4415
4422
  );
4416
4423
  };
@@ -4418,7 +4425,7 @@ function Accounts({ onClose }) {
4418
4425
  const act = (input) => {
4419
4426
  const { row: row2 } = current();
4420
4427
  if (input === "R") return run("Syncing all\u2026", "Synced all", () => api.sync.now());
4421
- if (input === "g") return addGoogle();
4428
+ if (input === "g") return googleSignIn2(() => api.accounts.addGoogle(), (a2) => `Added ${a2.label}`);
4422
4429
  if (input === "a") return setMode({ kind: "caldav" });
4423
4430
  if (!row2) return;
4424
4431
  const a = row2.account;
@@ -4437,6 +4444,11 @@ function Accounts({ onClose }) {
4437
4444
  return run("Saving\u2026", `${a.label} colour changed`, () => api.accounts.update(a.id, { color: color2 }));
4438
4445
  }
4439
4446
  if (input === "x") return setMode({ kind: "confirm", account: a });
4447
+ if (input === "p" && a.authError) {
4448
+ if (a.kind === "google") return googleSignIn2(() => api.accounts.reauth(a.id), () => `${a.label} reconnected`);
4449
+ setMessage(void 0);
4450
+ return setMode({ kind: "reauth", account: a, value: "" });
4451
+ }
4440
4452
  };
4441
4453
  const confirmRemove = (yes) => {
4442
4454
  const mode2 = getMode();
@@ -4462,6 +4474,19 @@ function Accounts({ onClose }) {
4462
4474
  return;
4463
4475
  }
4464
4476
  if (mode2.kind === "confirm") return confirmRemove(input.toLowerCase() === "y");
4477
+ if (mode2.kind === "reauth") {
4478
+ if (key3.escape) return setMode({ kind: "list" });
4479
+ if (key3.return) {
4480
+ if (!mode2.value) return;
4481
+ const { id: id2, label } = mode2.account;
4482
+ const password = mode2.value;
4483
+ run("Reconnecting\u2026", `${label} reconnected`, () => api.accounts.reauth(id2, { password }));
4484
+ return setMode({ kind: "list" });
4485
+ }
4486
+ const value = editText(mode2.value, input, key3);
4487
+ if (value !== void 0) setMode({ ...mode2, value });
4488
+ return;
4489
+ }
4465
4490
  if (mode2.kind === "rename") {
4466
4491
  if (key3.escape) return setMode({ kind: "list" });
4467
4492
  if (key3.return) {
@@ -4540,7 +4565,14 @@ function Accounts({ onClose }) {
4540
4565
  /* @__PURE__ */ jsx12(Spinner, {}),
4541
4566
  " Loading calendars\u2026"
4542
4567
  ] }),
4543
- a.error && /* @__PURE__ */ jsx12(Text10, { color: C.red, children: ` Last sync failed: ${a.error}` })
4568
+ a.authError ? /* @__PURE__ */ jsx12(Text10, { color: C.red, children: ` Disconnected: ${a.error ?? "credentials rejected"} \u2014 p to reconnect` }) : a.error && /* @__PURE__ */ jsx12(Text10, { color: C.red, children: ` Last sync failed: ${a.error}` }),
4569
+ mode.kind === "reauth" && mode.account.id === a.id && /* @__PURE__ */ jsxs10(Text10, { children: [
4570
+ " New app password: ",
4571
+ /* @__PURE__ */ jsxs10(Text10, { color: C.cyan, children: [
4572
+ "\u2022".repeat(mode.value.length),
4573
+ "\u258F"
4574
+ ] })
4575
+ ] })
4544
4576
  ] }, a.id);
4545
4577
  }),
4546
4578
  mode.kind === "confirm" && /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", marginTop: 1, children: [
@@ -4569,7 +4601,7 @@ function Accounts({ onClose }) {
4569
4601
  /* @__PURE__ */ jsx12(Text10, { color: C.muted, children: `Over SSH, forward its port first: ssh -L ${loopbackPort(authUrl)}:127.0.0.1:${loopbackPort(authUrl)} <host>` })
4570
4602
  ] })
4571
4603
  ] }),
4572
- mode.kind === "rename" && /* @__PURE__ */ jsx12(Text10, { color: C.muted, children: "enter save esc cancel" }),
4604
+ (mode.kind === "rename" || mode.kind === "reauth") && /* @__PURE__ */ jsx12(Text10, { color: C.muted, children: "enter save esc cancel" }),
4573
4605
  loadError && /* @__PURE__ */ jsx12(Text10, { color: C.red, children: loadError }),
4574
4606
  message && /* @__PURE__ */ jsx12(Text10, { color: message.error ? C.red : C.green, children: message.text }),
4575
4607
  mode.kind === "list" && /* @__PURE__ */ jsxs10(Box10, { marginTop: 1, flexWrap: "wrap", children: [
@@ -4580,6 +4612,7 @@ function Accounts({ onClose }) {
4580
4612
  row && button("e", "rename"),
4581
4613
  row && button("c", "colour"),
4582
4614
  row && button("x", "remove"),
4615
+ row?.account.authError && button("p", "reconnect"),
4583
4616
  button("g", "add Google"),
4584
4617
  button("a", "add CalDAV"),
4585
4618
  /* @__PURE__ */ jsx12(Button, { k: "esc", label: "close", onPress: onClose })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mysticals",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Isolated multi-account calendar for the terminal on macOS, Linux and Windows",
5
5
  "keywords": [
6
6
  "calendar",
@@ -47,7 +47,7 @@
47
47
  "tsup": "^8.5.1",
48
48
  "typescript": "^5.9.3",
49
49
  "vitest": "^3.2.7",
50
- "@mysticals/core": "0.5.0"
50
+ "@mysticals/core": "0.6.0"
51
51
  },
52
52
  "scripts": {
53
53
  "dev": "tsup --watch",