mirror of
https://git.undefined-dev.fr/Blendman974/faceclaw.git
synced 2026-11-19 21:03:09 +00:00
15 lines
1.0 KiB
TypeScript
15 lines
1.0 KiB
TypeScript
import { createListenerPool, type InterfaceAddress } from '../remote/listeners';
|
|
declare const FaceclawRemoteInput: any;
|
|
export function remoteNative(onRequestReady: () => void) {
|
|
return createListenerPool(() => {
|
|
const native = FaceclawRemoteInput.alloc().init();
|
|
native.setRequestListener(onRequestReady);
|
|
return { start: (port, address) => String(native.startAddress(port, address)), stop: () => { native.setRequestListener(null); native.stop(); },
|
|
nextRequest: () => native.nextRequest(), complete: (id, response) => native.completeResponse(id, response) };
|
|
});
|
|
}
|
|
export function remoteInterfaces(): InterfaceAddress[] { return JSON.parse(String(FaceclawRemoteInput.interfaces())); }
|
|
export function randomTokenSecret(): string { return String(FaceclawRemoteInput.shared().randomSecret()); }
|
|
export function tokenHash(value: string): string { return String(FaceclawRemoteInput.shared().tokenDigest(value)); }
|
|
export function copyRemoteToken(value: string): void { UIPasteboard.generalPasteboard.string = value; }
|