forked from Blendman974/faceclaw
Add tokens and faceclaw-input script, which allows using a CLI utility as an input device for the glasses
This commit is contained in:
1 parent
313ba85708
commit
ccb320c66f
32 files changed
+1785
-12
No files matched your search
@@ -0,0 +1,13 @@
|
||||
import { createListenerPool, type InterfaceAddress } from '../remote/listeners';
|
||||
declare const FaceclawRemoteInput: any;
|
||||
export function remoteNative() {
|
||||
return createListenerPool(() => {
|
||||
const native = FaceclawRemoteInput.alloc().init();
|
||||
return { start: (port, address) => String(native.startAddress(port, address)), stop: () => 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; }
|
||||
@@ -0,0 +1,17 @@
|
||||
import { createListenerPool, type InterfaceAddress } from '../remote/listeners';
|
||||
import { Utils } from '@nativescript/core';
|
||||
declare const com: any;
|
||||
export function remoteNative() {
|
||||
return createListenerPool(() => {
|
||||
const native = new com.faceclaw.app.FaceclawRemoteInput();
|
||||
return { start: (port, address) => String(native.startAddress(port, address)), stop: () => native.stop(),
|
||||
nextRequest: () => native.nextRequest(), complete: (id, response) => native.complete(id, response) };
|
||||
});
|
||||
}
|
||||
export function remoteInterfaces(): InterfaceAddress[] { return JSON.parse(String(com.faceclaw.app.FaceclawRemoteInput.interfaces())); }
|
||||
export function randomTokenSecret(): string { return String(com.faceclaw.app.FaceclawRemoteInput.getInstance().randomSecret()); }
|
||||
export function tokenHash(value: string): string { return String(com.faceclaw.app.FaceclawRemoteInput.getInstance().hash(value)); }
|
||||
export function copyRemoteToken(value: string): void {
|
||||
const context = Utils.android.getApplicationContext();
|
||||
context.getSystemService('clipboard').setPrimaryClip(android.content.ClipData.newPlainText('Faceclaw input token', value));
|
||||
}
|
||||
Reference in new issue
Block a user