Signal API updates

This commit is contained in:
Darren Clarke 2024-06-05 15:12:48 +02:00
parent 83653ef23b
commit c729a46a0c
25 changed files with 501 additions and 279 deletions

View file

@ -1,5 +1,13 @@
import { ServiceConfig } from "../lib/service";
const getQRCode = async (token: string): Promise<Record<string, string>> => {
const url = `/api/signal/bots/${token}`;
const result = await fetch(url, { cache: "no-store" });
const { qr } = await result.json();
return { qr, kind: "image" };
};
export const signalConfig: ServiceConfig = {
entity: "signal",
table: "SignalBot",
@ -59,6 +67,15 @@ export const signalConfig: ServiceConfig = {
label: "Token",
copyable: true,
},
{
name: "qrcode",
label: "QR Code",
kind: "qrcode",
size: 4,
getQRCode,
helperText: "Go to link devices in the app, then scan the code",
refreshInterval: 15,
},
],
listColumns: [
{

View file

@ -6,7 +6,7 @@ const getQRCode = async (token: string) => {
const result = await fetch(url, { cache: "no-store" });
const { qr } = await result.json();
return qr ?? "";
return { qr, kind: "data" };
};
export const whatsappConfig: ServiceConfig = {
@ -73,8 +73,8 @@ export const whatsappConfig: ServiceConfig = {
label: "QR Code",
kind: "qrcode",
size: 4,
getValue: getQRCode,
helperText: "Go ahead, scan it",
getQRCode,
helperText: "Go to link devices in the app, then scan the code",
refreshInterval: 15,
},
],