NullVoxPopuli / emberclear

Encrypted Chat. No History. No Logs.
https://emberclear.io
GNU General Public License v3.0
198 stars 39 forks source link

actually do some maintenance #1697

Open NullVoxPopuli opened 2 years ago

NullVoxPopuli commented 2 years ago

As far as gjs/gts and v2 addons are concerned, a lot can be done to improve this repo' including adding turborepo to speed up ci.

I should do some of this and modernize this codebase.

Thankfully, it's not tooooo big.

NullVoxPopuli commented 1 year ago

Also, update networking code? https://docs.holepunch.to/

NullVoxPopuli commented 1 year ago

Standard auth: https://webauthn.guide

NullVoxPopuli commented 1 year ago

Something that might help with long-term maintenance,

NullVoxPopuli commented 11 months ago

Use MessageChannels instead of worker-bi

¹ https://developer.mozilla.org/en-US/docs/Web/API/AbortController ² https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API

from @sukima: For workers I used MessageChannel to convert the postMessage into a promise async/await version

function asyncPostMessage<t = unknown>(worker: Worker, message: unknown, transfers: Transferable[] = []): Promise<T> {
  let { port1, port2 } = new MessageChannel();

  return new Promise<T>((resolve) => {
    port1.onmessage = ({ data }: MessageEvent<T>) => resolve(data);
    worker.postMessage(message, [port2, ...transfers]);
  });
}

and in the worker:

self.addEventListener('message', ({ data, ports: [port] }: MessageEvent<…>) => {
  // Do stuff with data
  port.postMessage(result);
});