repositories / pi-ext
pi-ext
bugabingas pi extensions
owned by bugabinga
extensions/ui/qr.ts
RawFile outline
import QRCode from "qrcode";
import { uiError } from "./errors";
export async function renderQr(url: string): Promise<string> {
try {
return await QRCode.toString(url, {
type: "terminal",
small: true,
margin: 1,
});
} catch (cause) {
throw uiError("qr_failed", "Could not render terminal QR code", {
action: "Use the OSC link in the /ui widget instead.",
retryable: true,
cause,
});
}
}