@pi-unipi/notify 2.6.1 → 2.9.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.
- package/events.ts +0 -10
- package/package.json +8 -6
- package/settings.ts +0 -19
- package/tui/gotify-setup.ts +108 -143
- package/tui/ntfy-setup.ts +137 -172
- package/tui/recap-model-selector.ts +36 -71
- package/tui/settings-overlay.ts +50 -86
- package/tui/telegram-setup.ts +48 -79
- package/types.ts +0 -2
package/tui/ntfy-setup.ts
CHANGED
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import type { Component } from "@earendil-works/pi-tui";
|
|
10
|
-
import {
|
|
10
|
+
import { Key, matchesKey } from "@earendil-works/pi-tui";
|
|
11
11
|
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
12
12
|
import { sendNtfyNotification } from "../platforms/ntfy.js";
|
|
13
13
|
import { loadNtfyConfig, saveNtfyConfig, getNtfyConfigScope } from "../ntfy-config.js";
|
|
14
|
-
import { boxInnerWidth } from "@pi-unipi/core";
|
|
14
|
+
import { boxInnerWidth, OverlayTheme } from "@pi-unipi/core";
|
|
15
15
|
|
|
16
16
|
type SetupPhase =
|
|
17
17
|
| "instructions"
|
|
@@ -42,7 +42,7 @@ export class NtfySetupOverlay implements Component {
|
|
|
42
42
|
private pasteBuffer = "";
|
|
43
43
|
onClose?: () => void;
|
|
44
44
|
requestRender?: () => void;
|
|
45
|
-
private
|
|
45
|
+
private overlay = new OverlayTheme();
|
|
46
46
|
|
|
47
47
|
constructor() {
|
|
48
48
|
// Determine current scope and pre-fill from resolved config
|
|
@@ -60,7 +60,7 @@ export class NtfySetupOverlay implements Component {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
setTheme(theme: Theme): void {
|
|
63
|
-
this.theme
|
|
63
|
+
this.overlay.setTheme(theme);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
invalidate(): void {}
|
|
@@ -76,10 +76,10 @@ export class NtfySetupOverlay implements Component {
|
|
|
76
76
|
break;
|
|
77
77
|
|
|
78
78
|
case "scope":
|
|
79
|
-
if (data
|
|
79
|
+
if (matchesKey(data, Key.up) || data === "k") {
|
|
80
80
|
// Up
|
|
81
81
|
this.scopeIndex = Math.max(0, this.scopeIndex - 1);
|
|
82
|
-
} else if (data
|
|
82
|
+
} else if (matchesKey(data, Key.down) || data === "j") {
|
|
83
83
|
// Down
|
|
84
84
|
this.scopeIndex = Math.min(1, this.scopeIndex + 1);
|
|
85
85
|
} else if (data === "\r" || data === " ") {
|
|
@@ -241,41 +241,6 @@ export class NtfySetupOverlay implements Component {
|
|
|
241
241
|
});
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
-
// ─── Theme helpers ───────────────────────────────────────────────────
|
|
245
|
-
|
|
246
|
-
private fg(color: string, text: string): string {
|
|
247
|
-
if (this.theme) return this.theme.fg(color as any, text);
|
|
248
|
-
const c: Record<string, string> = {
|
|
249
|
-
accent: "\x1b[36m",
|
|
250
|
-
success: "\x1b[32m",
|
|
251
|
-
warning: "\x1b[33m",
|
|
252
|
-
error: "\x1b[31m",
|
|
253
|
-
dim: "\x1b[2m",
|
|
254
|
-
borderMuted: "\x1b[90m",
|
|
255
|
-
};
|
|
256
|
-
return `${c[color] ?? ""}${text}\x1b[0m`;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
private bold(text: string): string {
|
|
260
|
-
return this.theme ? this.theme.bold(text) : `\x1b[1m${text}\x1b[0m`;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
private frameLine(content: string, innerWidth: number): string {
|
|
264
|
-
const truncated = truncateToWidth(content, innerWidth, "");
|
|
265
|
-
const padding = Math.max(0, innerWidth - visibleWidth(truncated));
|
|
266
|
-
return `${this.fg("borderMuted", "│")}${truncated}${" ".repeat(padding)}${this.fg("borderMuted", "│")}`;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
private ruleLine(innerWidth: number): string {
|
|
270
|
-
return this.fg("borderMuted", `├${"─".repeat(innerWidth)}┤`);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
private borderLine(innerWidth: number, edge: "top" | "bottom"): string {
|
|
274
|
-
const left = edge === "top" ? "┌" : "└";
|
|
275
|
-
const right = edge === "top" ? "┐" : "┘";
|
|
276
|
-
return this.fg("borderMuted", `${left}${"─".repeat(innerWidth)}${right}`);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
244
|
private maskToken(token: string): string {
|
|
280
245
|
if (token.length <= 8) return token;
|
|
281
246
|
return token.slice(0, 4) + "•".repeat(token.length - 8) + token.slice(-4);
|
|
@@ -285,76 +250,76 @@ export class NtfySetupOverlay implements Component {
|
|
|
285
250
|
const innerWidth = boxInnerWidth(width);
|
|
286
251
|
const lines: string[] = [];
|
|
287
252
|
|
|
288
|
-
lines.push(this.borderLine(innerWidth, "top"));
|
|
253
|
+
lines.push(this.overlay.borderLine(innerWidth, "top"));
|
|
289
254
|
lines.push(
|
|
290
|
-
this.frameLine(
|
|
291
|
-
this.fg("accent", this.bold("📢 ntfy Setup")),
|
|
255
|
+
this.overlay.frameLine(
|
|
256
|
+
this.overlay.fg("accent", this.overlay.bold("📢 ntfy Setup")),
|
|
292
257
|
innerWidth
|
|
293
258
|
)
|
|
294
259
|
);
|
|
295
|
-
lines.push(this.ruleLine(innerWidth));
|
|
260
|
+
lines.push(this.overlay.ruleLine(innerWidth));
|
|
296
261
|
|
|
297
262
|
switch (this.phase) {
|
|
298
263
|
case "instructions":
|
|
299
264
|
lines.push(
|
|
300
|
-
this.frameLine(
|
|
301
|
-
this.fg("dim", "Set up ntfy push notifications:"),
|
|
265
|
+
this.overlay.frameLine(
|
|
266
|
+
this.overlay.fg("dim", "Set up ntfy push notifications:"),
|
|
302
267
|
innerWidth
|
|
303
268
|
)
|
|
304
269
|
);
|
|
305
|
-
lines.push(this.frameLine("", innerWidth));
|
|
270
|
+
lines.push(this.overlay.frameLine("", innerWidth));
|
|
306
271
|
lines.push(
|
|
307
|
-
this.frameLine(
|
|
308
|
-
` ${this.bold("1.")} ntfy is a simple HTTP-based notification service`,
|
|
272
|
+
this.overlay.frameLine(
|
|
273
|
+
` ${this.overlay.bold("1.")} ntfy is a simple HTTP-based notification service`,
|
|
309
274
|
innerWidth
|
|
310
275
|
)
|
|
311
276
|
);
|
|
312
277
|
lines.push(
|
|
313
|
-
this.frameLine(
|
|
314
|
-
` ${this.fg("dim", "Public: https://ntfy.sh | Self-hosted: any ntfy server")}`,
|
|
278
|
+
this.overlay.frameLine(
|
|
279
|
+
` ${this.overlay.fg("dim", "Public: https://ntfy.sh | Self-hosted: any ntfy server")}`,
|
|
315
280
|
innerWidth
|
|
316
281
|
)
|
|
317
282
|
);
|
|
318
|
-
lines.push(this.frameLine("", innerWidth));
|
|
283
|
+
lines.push(this.overlay.frameLine("", innerWidth));
|
|
319
284
|
lines.push(
|
|
320
|
-
this.frameLine(
|
|
321
|
-
` ${this.bold("2.")} Choose a topic (acts as a channel name)`,
|
|
285
|
+
this.overlay.frameLine(
|
|
286
|
+
` ${this.overlay.bold("2.")} Choose a topic (acts as a channel name)`,
|
|
322
287
|
innerWidth
|
|
323
288
|
)
|
|
324
289
|
);
|
|
325
290
|
lines.push(
|
|
326
|
-
this.frameLine(
|
|
327
|
-
` ${this.fg("dim", "Subscribe to the topic in the ntfy app or web UI")}`,
|
|
291
|
+
this.overlay.frameLine(
|
|
292
|
+
` ${this.overlay.fg("dim", "Subscribe to the topic in the ntfy app or web UI")}`,
|
|
328
293
|
innerWidth
|
|
329
294
|
)
|
|
330
295
|
);
|
|
331
|
-
lines.push(this.frameLine("", innerWidth));
|
|
296
|
+
lines.push(this.overlay.frameLine("", innerWidth));
|
|
332
297
|
lines.push(
|
|
333
|
-
this.frameLine(
|
|
334
|
-
` ${this.bold("3.")} Optionally set an access token for private servers`,
|
|
298
|
+
this.overlay.frameLine(
|
|
299
|
+
` ${this.overlay.bold("3.")} Optionally set an access token for private servers`,
|
|
335
300
|
innerWidth
|
|
336
301
|
)
|
|
337
302
|
);
|
|
338
303
|
if (this.serverUrl) {
|
|
339
304
|
lines.push(
|
|
340
|
-
this.frameLine(
|
|
341
|
-
` ${this.fg("success", "✓")} Server URL pre-filled from existing config`,
|
|
305
|
+
this.overlay.frameLine(
|
|
306
|
+
` ${this.overlay.fg("success", "✓")} Server URL pre-filled from existing config`,
|
|
342
307
|
innerWidth
|
|
343
308
|
)
|
|
344
309
|
);
|
|
345
310
|
}
|
|
346
311
|
if (this.topic) {
|
|
347
312
|
lines.push(
|
|
348
|
-
this.frameLine(
|
|
349
|
-
` ${this.fg("success", "✓")} Topic pre-filled from existing config`,
|
|
313
|
+
this.overlay.frameLine(
|
|
314
|
+
` ${this.overlay.fg("success", "✓")} Topic pre-filled from existing config`,
|
|
350
315
|
innerWidth
|
|
351
316
|
)
|
|
352
317
|
);
|
|
353
318
|
}
|
|
354
|
-
lines.push(this.ruleLine(innerWidth));
|
|
319
|
+
lines.push(this.overlay.ruleLine(innerWidth));
|
|
355
320
|
lines.push(
|
|
356
|
-
this.frameLine(
|
|
357
|
-
this.fg("dim", "Press Enter to continue, Esc to cancel"),
|
|
321
|
+
this.overlay.frameLine(
|
|
322
|
+
this.overlay.fg("dim", "Press Enter to continue, Esc to cancel"),
|
|
358
323
|
innerWidth
|
|
359
324
|
)
|
|
360
325
|
);
|
|
@@ -362,28 +327,28 @@ export class NtfySetupOverlay implements Component {
|
|
|
362
327
|
|
|
363
328
|
case "scope": {
|
|
364
329
|
lines.push(
|
|
365
|
-
this.frameLine(
|
|
366
|
-
this.fg("dim", "Where should this config be saved?"),
|
|
330
|
+
this.overlay.frameLine(
|
|
331
|
+
this.overlay.fg("dim", "Where should this config be saved?"),
|
|
367
332
|
innerWidth
|
|
368
333
|
)
|
|
369
334
|
);
|
|
370
|
-
lines.push(this.frameLine("", innerWidth));
|
|
335
|
+
lines.push(this.overlay.frameLine("", innerWidth));
|
|
371
336
|
const options = ["Global (all projects)", "Project (this project only)"];
|
|
372
337
|
for (let i = 0; i < options.length; i++) {
|
|
373
338
|
const isSelected = i === this.scopeIndex;
|
|
374
|
-
const label = isSelected ? this.bold(options[i]) : this.fg("dim", options[i]);
|
|
339
|
+
const label = isSelected ? this.overlay.bold(options[i]) : this.overlay.fg("dim", options[i]);
|
|
375
340
|
lines.push(
|
|
376
|
-
this.frameLine(
|
|
377
|
-
` ${isSelected ? this.fg("accent", "▸") : " "} ${label}`,
|
|
341
|
+
this.overlay.frameLine(
|
|
342
|
+
` ${isSelected ? this.overlay.fg("accent", "▸") : " "} ${label}`,
|
|
378
343
|
innerWidth
|
|
379
344
|
)
|
|
380
345
|
);
|
|
381
346
|
}
|
|
382
|
-
lines.push(this.frameLine("", innerWidth));
|
|
383
|
-
lines.push(this.ruleLine(innerWidth));
|
|
347
|
+
lines.push(this.overlay.frameLine("", innerWidth));
|
|
348
|
+
lines.push(this.overlay.ruleLine(innerWidth));
|
|
384
349
|
lines.push(
|
|
385
|
-
this.frameLine(
|
|
386
|
-
this.fg("dim", "↑↓ select · Enter confirm · Esc cancel"),
|
|
350
|
+
this.overlay.frameLine(
|
|
351
|
+
this.overlay.fg("dim", "↑↓ select · Enter confirm · Esc cancel"),
|
|
387
352
|
innerWidth
|
|
388
353
|
)
|
|
389
354
|
);
|
|
@@ -392,35 +357,35 @@ export class NtfySetupOverlay implements Component {
|
|
|
392
357
|
|
|
393
358
|
case "server-url":
|
|
394
359
|
lines.push(
|
|
395
|
-
this.frameLine(
|
|
396
|
-
this.fg("dim", "Enter ntfy server URL:"),
|
|
360
|
+
this.overlay.frameLine(
|
|
361
|
+
this.overlay.fg("dim", "Enter ntfy server URL:"),
|
|
397
362
|
innerWidth
|
|
398
363
|
)
|
|
399
364
|
);
|
|
400
|
-
lines.push(this.frameLine("", innerWidth));
|
|
365
|
+
lines.push(this.overlay.frameLine("", innerWidth));
|
|
401
366
|
lines.push(
|
|
402
|
-
this.frameLine(
|
|
403
|
-
` ${this.fg("accent", this.bold(this.serverUrl || " "))}${this.fg("dim", "█")}`,
|
|
367
|
+
this.overlay.frameLine(
|
|
368
|
+
` ${this.overlay.fg("accent", this.overlay.bold(this.serverUrl || " "))}${this.overlay.fg("dim", "█")}`,
|
|
404
369
|
innerWidth
|
|
405
370
|
)
|
|
406
371
|
);
|
|
407
|
-
lines.push(this.frameLine("", innerWidth));
|
|
372
|
+
lines.push(this.overlay.frameLine("", innerWidth));
|
|
408
373
|
lines.push(
|
|
409
|
-
this.frameLine(
|
|
410
|
-
this.fg("dim", "Default: https://ntfy.sh (public)"),
|
|
374
|
+
this.overlay.frameLine(
|
|
375
|
+
this.overlay.fg("dim", "Default: https://ntfy.sh (public)"),
|
|
411
376
|
innerWidth
|
|
412
377
|
)
|
|
413
378
|
);
|
|
414
379
|
lines.push(
|
|
415
|
-
this.frameLine(
|
|
416
|
-
this.fg("dim", "Leave empty and press Enter for default"),
|
|
380
|
+
this.overlay.frameLine(
|
|
381
|
+
this.overlay.fg("dim", "Leave empty and press Enter for default"),
|
|
417
382
|
innerWidth
|
|
418
383
|
)
|
|
419
384
|
);
|
|
420
|
-
lines.push(this.ruleLine(innerWidth));
|
|
385
|
+
lines.push(this.overlay.ruleLine(innerWidth));
|
|
421
386
|
lines.push(
|
|
422
|
-
this.frameLine(
|
|
423
|
-
this.fg("dim", "Enter to continue · Esc to cancel"),
|
|
387
|
+
this.overlay.frameLine(
|
|
388
|
+
this.overlay.fg("dim", "Enter to continue · Esc to cancel"),
|
|
424
389
|
innerWidth
|
|
425
390
|
)
|
|
426
391
|
);
|
|
@@ -428,35 +393,35 @@ export class NtfySetupOverlay implements Component {
|
|
|
428
393
|
|
|
429
394
|
case "topic":
|
|
430
395
|
lines.push(
|
|
431
|
-
this.frameLine(
|
|
432
|
-
this.fg("dim", "Enter topic name:"),
|
|
396
|
+
this.overlay.frameLine(
|
|
397
|
+
this.overlay.fg("dim", "Enter topic name:"),
|
|
433
398
|
innerWidth
|
|
434
399
|
)
|
|
435
400
|
);
|
|
436
|
-
lines.push(this.frameLine("", innerWidth));
|
|
401
|
+
lines.push(this.overlay.frameLine("", innerWidth));
|
|
437
402
|
lines.push(
|
|
438
|
-
this.frameLine(
|
|
439
|
-
` ${this.fg("accent", this.bold(this.topic || " "))}${this.fg("dim", "█")}`,
|
|
403
|
+
this.overlay.frameLine(
|
|
404
|
+
` ${this.overlay.fg("accent", this.overlay.bold(this.topic || " "))}${this.overlay.fg("dim", "█")}`,
|
|
440
405
|
innerWidth
|
|
441
406
|
)
|
|
442
407
|
);
|
|
443
|
-
lines.push(this.frameLine("", innerWidth));
|
|
408
|
+
lines.push(this.overlay.frameLine("", innerWidth));
|
|
444
409
|
lines.push(
|
|
445
|
-
this.frameLine(
|
|
446
|
-
this.fg("dim", "e.g. my-pi-notifications, project-alerts"),
|
|
410
|
+
this.overlay.frameLine(
|
|
411
|
+
this.overlay.fg("dim", "e.g. my-pi-notifications, project-alerts"),
|
|
447
412
|
innerWidth
|
|
448
413
|
)
|
|
449
414
|
);
|
|
450
415
|
lines.push(
|
|
451
|
-
this.frameLine(
|
|
452
|
-
this.fg("dim", "Pick something unique if using public ntfy.sh"),
|
|
416
|
+
this.overlay.frameLine(
|
|
417
|
+
this.overlay.fg("dim", "Pick something unique if using public ntfy.sh"),
|
|
453
418
|
innerWidth
|
|
454
419
|
)
|
|
455
420
|
);
|
|
456
|
-
lines.push(this.ruleLine(innerWidth));
|
|
421
|
+
lines.push(this.overlay.ruleLine(innerWidth));
|
|
457
422
|
lines.push(
|
|
458
|
-
this.frameLine(
|
|
459
|
-
this.fg("dim", "Enter to continue · Esc to cancel"),
|
|
423
|
+
this.overlay.frameLine(
|
|
424
|
+
this.overlay.fg("dim", "Enter to continue · Esc to cancel"),
|
|
460
425
|
innerWidth
|
|
461
426
|
)
|
|
462
427
|
);
|
|
@@ -464,38 +429,38 @@ export class NtfySetupOverlay implements Component {
|
|
|
464
429
|
|
|
465
430
|
case "token":
|
|
466
431
|
lines.push(
|
|
467
|
-
this.frameLine(
|
|
468
|
-
this.fg("dim", "Enter access token (optional):"),
|
|
432
|
+
this.overlay.frameLine(
|
|
433
|
+
this.overlay.fg("dim", "Enter access token (optional):"),
|
|
469
434
|
innerWidth
|
|
470
435
|
)
|
|
471
436
|
);
|
|
472
|
-
lines.push(this.frameLine("", innerWidth));
|
|
437
|
+
lines.push(this.overlay.frameLine("", innerWidth));
|
|
473
438
|
const displayToken = this.token
|
|
474
|
-
? this.fg("accent", this.bold(this.maskToken(this.token)))
|
|
439
|
+
? this.overlay.fg("accent", this.overlay.bold(this.maskToken(this.token)))
|
|
475
440
|
: " ";
|
|
476
441
|
lines.push(
|
|
477
|
-
this.frameLine(
|
|
478
|
-
` ${displayToken}${this.fg("dim", "█")}`,
|
|
442
|
+
this.overlay.frameLine(
|
|
443
|
+
` ${displayToken}${this.overlay.fg("dim", "█")}`,
|
|
479
444
|
innerWidth
|
|
480
445
|
)
|
|
481
446
|
);
|
|
482
|
-
lines.push(this.frameLine("", innerWidth));
|
|
447
|
+
lines.push(this.overlay.frameLine("", innerWidth));
|
|
483
448
|
lines.push(
|
|
484
|
-
this.frameLine(
|
|
485
|
-
this.fg("dim", "Only needed for private/authenticated ntfy servers"),
|
|
449
|
+
this.overlay.frameLine(
|
|
450
|
+
this.overlay.fg("dim", "Only needed for private/authenticated ntfy servers"),
|
|
486
451
|
innerWidth
|
|
487
452
|
)
|
|
488
453
|
);
|
|
489
454
|
lines.push(
|
|
490
|
-
this.frameLine(
|
|
491
|
-
this.fg("dim", "Not needed for public ntfy.sh"),
|
|
455
|
+
this.overlay.frameLine(
|
|
456
|
+
this.overlay.fg("dim", "Not needed for public ntfy.sh"),
|
|
492
457
|
innerWidth
|
|
493
458
|
)
|
|
494
459
|
);
|
|
495
|
-
lines.push(this.ruleLine(innerWidth));
|
|
460
|
+
lines.push(this.overlay.ruleLine(innerWidth));
|
|
496
461
|
lines.push(
|
|
497
|
-
this.frameLine(
|
|
498
|
-
this.fg("dim", "Enter to continue · Esc to skip"),
|
|
462
|
+
this.overlay.frameLine(
|
|
463
|
+
this.overlay.fg("dim", "Enter to continue · Esc to skip"),
|
|
499
464
|
innerWidth
|
|
500
465
|
)
|
|
501
466
|
);
|
|
@@ -503,151 +468,151 @@ export class NtfySetupOverlay implements Component {
|
|
|
503
468
|
|
|
504
469
|
case "priority":
|
|
505
470
|
lines.push(
|
|
506
|
-
this.frameLine(
|
|
507
|
-
this.fg("dim", "Set notification priority (1-5):"),
|
|
471
|
+
this.overlay.frameLine(
|
|
472
|
+
this.overlay.fg("dim", "Set notification priority (1-5):"),
|
|
508
473
|
innerWidth
|
|
509
474
|
)
|
|
510
475
|
);
|
|
511
|
-
lines.push(this.frameLine("", innerWidth));
|
|
476
|
+
lines.push(this.overlay.frameLine("", innerWidth));
|
|
512
477
|
lines.push(
|
|
513
|
-
this.frameLine(
|
|
514
|
-
` ${this.fg("accent", this.bold(this.priority || " "))}${this.fg("dim", "█")}`,
|
|
478
|
+
this.overlay.frameLine(
|
|
479
|
+
` ${this.overlay.fg("accent", this.overlay.bold(this.priority || " "))}${this.overlay.fg("dim", "█")}`,
|
|
515
480
|
innerWidth
|
|
516
481
|
)
|
|
517
482
|
);
|
|
518
|
-
lines.push(this.frameLine("", innerWidth));
|
|
483
|
+
lines.push(this.overlay.frameLine("", innerWidth));
|
|
519
484
|
lines.push(
|
|
520
|
-
this.frameLine(
|
|
521
|
-
` ${this.fg("dim", "1")} = min · ${this.fg("dim", "3")} = default · ${this.fg("dim", "5")} = max`,
|
|
485
|
+
this.overlay.frameLine(
|
|
486
|
+
` ${this.overlay.fg("dim", "1")} = min · ${this.overlay.fg("dim", "3")} = default · ${this.overlay.fg("dim", "5")} = max`,
|
|
522
487
|
innerWidth
|
|
523
488
|
)
|
|
524
489
|
);
|
|
525
|
-
lines.push(this.ruleLine(innerWidth));
|
|
490
|
+
lines.push(this.overlay.ruleLine(innerWidth));
|
|
526
491
|
lines.push(
|
|
527
|
-
this.frameLine(
|
|
528
|
-
this.fg("dim", "Enter to test connection · Esc to cancel"),
|
|
492
|
+
this.overlay.frameLine(
|
|
493
|
+
this.overlay.fg("dim", "Enter to test connection · Esc to cancel"),
|
|
529
494
|
innerWidth
|
|
530
495
|
)
|
|
531
496
|
);
|
|
532
497
|
break;
|
|
533
498
|
|
|
534
499
|
case "testing":
|
|
535
|
-
lines.push(this.frameLine("", innerWidth));
|
|
500
|
+
lines.push(this.overlay.frameLine("", innerWidth));
|
|
536
501
|
lines.push(
|
|
537
|
-
this.frameLine(
|
|
538
|
-
` ${this.fg("accent", "⠋")} ${this.bold("Testing connection...")}`,
|
|
502
|
+
this.overlay.frameLine(
|
|
503
|
+
` ${this.overlay.fg("accent", "⠋")} ${this.overlay.bold("Testing connection...")}`,
|
|
539
504
|
innerWidth
|
|
540
505
|
)
|
|
541
506
|
);
|
|
542
|
-
lines.push(this.frameLine("", innerWidth));
|
|
507
|
+
lines.push(this.overlay.frameLine("", innerWidth));
|
|
543
508
|
lines.push(
|
|
544
|
-
this.frameLine(
|
|
545
|
-
` ${this.fg("dim", `Sending test to ${this.serverUrl}/${this.topic}`)}`,
|
|
509
|
+
this.overlay.frameLine(
|
|
510
|
+
` ${this.overlay.fg("dim", `Sending test to ${this.serverUrl}/${this.topic}`)}`,
|
|
546
511
|
innerWidth
|
|
547
512
|
)
|
|
548
513
|
);
|
|
549
|
-
lines.push(this.ruleLine(innerWidth));
|
|
514
|
+
lines.push(this.overlay.ruleLine(innerWidth));
|
|
550
515
|
lines.push(
|
|
551
|
-
this.frameLine(
|
|
552
|
-
this.fg("dim", "Esc to cancel"),
|
|
516
|
+
this.overlay.frameLine(
|
|
517
|
+
this.overlay.fg("dim", "Esc to cancel"),
|
|
553
518
|
innerWidth
|
|
554
519
|
)
|
|
555
520
|
);
|
|
556
521
|
break;
|
|
557
522
|
|
|
558
523
|
case "success":
|
|
559
|
-
lines.push(this.frameLine("", innerWidth));
|
|
524
|
+
lines.push(this.overlay.frameLine("", innerWidth));
|
|
560
525
|
lines.push(
|
|
561
|
-
this.frameLine(
|
|
562
|
-
` ${this.fg("success", "✓ ntfy configured successfully!")}`,
|
|
526
|
+
this.overlay.frameLine(
|
|
527
|
+
` ${this.overlay.fg("success", "✓ ntfy configured successfully!")}`,
|
|
563
528
|
innerWidth
|
|
564
529
|
)
|
|
565
530
|
);
|
|
566
|
-
lines.push(this.frameLine("", innerWidth));
|
|
531
|
+
lines.push(this.overlay.frameLine("", innerWidth));
|
|
567
532
|
lines.push(
|
|
568
|
-
this.frameLine(
|
|
569
|
-
` ${this.fg("dim", `Server: ${this.serverUrl}`)}`,
|
|
533
|
+
this.overlay.frameLine(
|
|
534
|
+
` ${this.overlay.fg("dim", `Server: ${this.serverUrl}`)}`,
|
|
570
535
|
innerWidth
|
|
571
536
|
)
|
|
572
537
|
);
|
|
573
538
|
lines.push(
|
|
574
|
-
this.frameLine(
|
|
575
|
-
` ${this.fg("dim", `Topic: ${this.topic}`)}`,
|
|
539
|
+
this.overlay.frameLine(
|
|
540
|
+
` ${this.overlay.fg("dim", `Topic: ${this.topic}`)}`,
|
|
576
541
|
innerWidth
|
|
577
542
|
)
|
|
578
543
|
);
|
|
579
544
|
lines.push(
|
|
580
|
-
this.frameLine(
|
|
581
|
-
` ${this.fg("dim", `Priority: ${this.priority}`)}`,
|
|
545
|
+
this.overlay.frameLine(
|
|
546
|
+
` ${this.overlay.fg("dim", `Priority: ${this.priority}`)}`,
|
|
582
547
|
innerWidth
|
|
583
548
|
)
|
|
584
549
|
);
|
|
585
|
-
lines.push(this.ruleLine(innerWidth));
|
|
550
|
+
lines.push(this.overlay.ruleLine(innerWidth));
|
|
586
551
|
lines.push(
|
|
587
|
-
this.frameLine(
|
|
588
|
-
this.fg("dim", "Closing..."),
|
|
552
|
+
this.overlay.frameLine(
|
|
553
|
+
this.overlay.fg("dim", "Closing..."),
|
|
589
554
|
innerWidth
|
|
590
555
|
)
|
|
591
556
|
);
|
|
592
557
|
break;
|
|
593
558
|
|
|
594
559
|
case "test-failed":
|
|
595
|
-
lines.push(this.frameLine("", innerWidth));
|
|
560
|
+
lines.push(this.overlay.frameLine("", innerWidth));
|
|
596
561
|
lines.push(
|
|
597
|
-
this.frameLine(
|
|
598
|
-
` ${this.fg("error", "✗ Connection test failed")}`,
|
|
562
|
+
this.overlay.frameLine(
|
|
563
|
+
` ${this.overlay.fg("error", "✗ Connection test failed")}`,
|
|
599
564
|
innerWidth
|
|
600
565
|
)
|
|
601
566
|
);
|
|
602
|
-
lines.push(this.frameLine("", innerWidth));
|
|
567
|
+
lines.push(this.overlay.frameLine("", innerWidth));
|
|
603
568
|
lines.push(
|
|
604
|
-
this.frameLine(
|
|
605
|
-
` ${this.fg("dim", this.testError || "Unknown error")}`,
|
|
569
|
+
this.overlay.frameLine(
|
|
570
|
+
` ${this.overlay.fg("dim", this.testError || "Unknown error")}`,
|
|
606
571
|
innerWidth
|
|
607
572
|
)
|
|
608
573
|
);
|
|
609
|
-
lines.push(this.frameLine("", innerWidth));
|
|
574
|
+
lines.push(this.overlay.frameLine("", innerWidth));
|
|
610
575
|
lines.push(
|
|
611
|
-
this.frameLine(
|
|
612
|
-
` ${this.fg("dim", "Check your server URL and topic")}`,
|
|
576
|
+
this.overlay.frameLine(
|
|
577
|
+
` ${this.overlay.fg("dim", "Check your server URL and topic")}`,
|
|
613
578
|
innerWidth
|
|
614
579
|
)
|
|
615
580
|
);
|
|
616
|
-
lines.push(this.ruleLine(innerWidth));
|
|
581
|
+
lines.push(this.overlay.ruleLine(innerWidth));
|
|
617
582
|
lines.push(
|
|
618
|
-
this.frameLine(
|
|
619
|
-
this.fg("dim", "Press Enter to close"),
|
|
583
|
+
this.overlay.frameLine(
|
|
584
|
+
this.overlay.fg("dim", "Press Enter to close"),
|
|
620
585
|
innerWidth
|
|
621
586
|
)
|
|
622
587
|
);
|
|
623
588
|
break;
|
|
624
589
|
|
|
625
590
|
case "error":
|
|
626
|
-
lines.push(this.frameLine("", innerWidth));
|
|
591
|
+
lines.push(this.overlay.frameLine("", innerWidth));
|
|
627
592
|
lines.push(
|
|
628
|
-
this.frameLine(
|
|
629
|
-
` ${this.fg("error", "✗ Setup failed")}`,
|
|
593
|
+
this.overlay.frameLine(
|
|
594
|
+
` ${this.overlay.fg("error", "✗ Setup failed")}`,
|
|
630
595
|
innerWidth
|
|
631
596
|
)
|
|
632
597
|
);
|
|
633
|
-
lines.push(this.frameLine("", innerWidth));
|
|
598
|
+
lines.push(this.overlay.frameLine("", innerWidth));
|
|
634
599
|
lines.push(
|
|
635
|
-
this.frameLine(
|
|
636
|
-
` ${this.fg("dim", this.error || "Unknown error")}`,
|
|
600
|
+
this.overlay.frameLine(
|
|
601
|
+
` ${this.overlay.fg("dim", this.error || "Unknown error")}`,
|
|
637
602
|
innerWidth
|
|
638
603
|
)
|
|
639
604
|
);
|
|
640
|
-
lines.push(this.ruleLine(innerWidth));
|
|
605
|
+
lines.push(this.overlay.ruleLine(innerWidth));
|
|
641
606
|
lines.push(
|
|
642
|
-
this.frameLine(
|
|
643
|
-
this.fg("dim", "Press Enter to close"),
|
|
607
|
+
this.overlay.frameLine(
|
|
608
|
+
this.overlay.fg("dim", "Press Enter to close"),
|
|
644
609
|
innerWidth
|
|
645
610
|
)
|
|
646
611
|
);
|
|
647
612
|
break;
|
|
648
613
|
}
|
|
649
614
|
|
|
650
|
-
lines.push(this.borderLine(innerWidth, "bottom"));
|
|
615
|
+
lines.push(this.overlay.borderLine(innerWidth, "bottom"));
|
|
651
616
|
return lines;
|
|
652
617
|
}
|
|
653
618
|
}
|