@soyeht/soyeht 0.2.4 → 0.2.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.
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/src/qr.ts +12 -4
- package/src/service.ts +10 -6
- package/src/version.ts +1 -1
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
package/src/qr.ts
CHANGED
|
@@ -426,11 +426,19 @@ export function renderQrTerminal(text: string): string | null {
|
|
|
426
426
|
}
|
|
427
427
|
|
|
428
428
|
// ▄ (lower half block): foreground = lower half, background = upper half
|
|
429
|
+
// Use 24-bit true color (ESC[48;2;R;G;Bm) for pure black/white contrast.
|
|
430
|
+
// Generic ANSI colors (40/47) map to theme colors which may not be pure B&W.
|
|
431
|
+
const BG_BLACK = "\x1b[48;2;0;0;0m";
|
|
432
|
+
const BG_WHITE = "\x1b[48;2;255;255;255m";
|
|
433
|
+
const FG_BLACK = "\x1b[38;2;0;0;0m";
|
|
434
|
+
const FG_WHITE = "\x1b[38;2;255;255;255m";
|
|
435
|
+
const RST = "\x1b[0m";
|
|
436
|
+
|
|
429
437
|
function cell(top: number, bottom: number): string {
|
|
430
|
-
if (top === 1 && bottom === 1) return
|
|
431
|
-
if (top === 0 && bottom === 0) return
|
|
432
|
-
if (top === 1 && bottom === 0) return
|
|
433
|
-
return
|
|
438
|
+
if (top === 1 && bottom === 1) return `${BG_BLACK} ${RST}`;
|
|
439
|
+
if (top === 0 && bottom === 0) return `${BG_WHITE} ${RST}`;
|
|
440
|
+
if (top === 1 && bottom === 0) return `${FG_WHITE}${BG_BLACK}\u2584${RST}`;
|
|
441
|
+
return `${FG_BLACK}${BG_WHITE}\u2584${RST}`;
|
|
434
442
|
}
|
|
435
443
|
|
|
436
444
|
const lines: string[] = [];
|
package/src/service.ts
CHANGED
|
@@ -139,19 +139,23 @@ async function showPairingQr(api: OpenClawPluginApi, v2deps: SecurityV2Deps): Pr
|
|
|
139
139
|
});
|
|
140
140
|
|
|
141
141
|
// Compact QR: soyeht://pair?g=<gatewayUrl>&t=<token>&fp=<fingerprint>
|
|
142
|
-
//
|
|
143
|
-
|
|
142
|
+
// No encodeURIComponent — custom scheme, no escaping needed.
|
|
143
|
+
// App fetches full key material via HTTP GET /soyeht/pairing/info
|
|
144
|
+
const qrText = `soyeht://pair?g=${gatewayUrl}&t=${pairingToken}&fp=${fingerprint}`;
|
|
144
145
|
const rendered = renderQrTerminal(qrText);
|
|
145
146
|
|
|
146
147
|
if (rendered) {
|
|
147
148
|
// Write QR directly to stdout to avoid logger prefixes breaking ANSI escape codes
|
|
148
149
|
process.stdout.write("\n" + rendered + "\n\n");
|
|
149
|
-
api.logger.info(`[soyeht] Scan the QR code above with the Soyeht app
|
|
150
|
-
api.logger.info(`[soyeht] Fingerprint: ${fingerprint}`);
|
|
151
|
-
api.logger.info(`[soyeht] QR expires in ${AUTO_PAIRING_TTL_MS / 1000}s — restart plugin to generate a new one`);
|
|
150
|
+
api.logger.info(`[soyeht] Scan the QR code above with the Soyeht app`);
|
|
152
151
|
} else {
|
|
153
|
-
api.logger.warn("[soyeht] QR code too large for terminal rendering.
|
|
152
|
+
api.logger.warn("[soyeht] QR code too large for terminal rendering.");
|
|
154
153
|
}
|
|
154
|
+
|
|
155
|
+
// Always log the pairing URL as fallback — user can copy-paste into the app
|
|
156
|
+
api.logger.info(`[soyeht] If QR doesn't scan, copy the line below and paste in the app:`);
|
|
157
|
+
process.stdout.write("\n" + qrText + "\n\n");
|
|
158
|
+
api.logger.info(`[soyeht] Expires in ${AUTO_PAIRING_TTL_MS / 1000}s — restart plugin to generate a new one`);
|
|
155
159
|
}
|
|
156
160
|
|
|
157
161
|
// ---------------------------------------------------------------------------
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const PLUGIN_VERSION = "0.2.
|
|
1
|
+
export const PLUGIN_VERSION = "0.2.6";
|