@profullstack/qryptchat 0.3.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -898,6 +898,28 @@ function foldMessages(messages, myUserId) {
898
898
  });
899
899
  }
900
900
 
901
+ // src/lib/chat/calls.js
902
+ var CALL_TYPE = "call";
903
+ var CALL_JOINABLE_MS = 6 * 60 * 60 * 1000;
904
+ function parseCall(content) {
905
+ try {
906
+ const d = JSON.parse(content);
907
+ if (d?.type !== CALL_TYPE || typeof d.room !== "string" || typeof d.key !== "string")
908
+ return null;
909
+ const key = Uint8Array.from(atob(d.key), (c) => c.charCodeAt(0));
910
+ if (key.length < 32)
911
+ return null;
912
+ return { room: d.room, key, video: !!d.video, at: typeof d.at === "string" ? d.at : null };
913
+ } catch {
914
+ return null;
915
+ }
916
+ }
917
+ function callSummary(message, myUserId) {
918
+ const call = parseCall(message.content);
919
+ const who = message.sender_id === myUserId ? "You" : message.sender?.display_name || message.sender?.username || "Someone";
920
+ return `\uD83D\uDCDE ${who} started ${call?.video ? "a video" : "a voice"} call`;
921
+ }
922
+
901
923
  // src/cli/api.js
902
924
  class QcError extends Error {
903
925
  constructor(message, status) {
@@ -973,7 +995,9 @@ class QcClient {
973
995
  const raw = [];
974
996
  for (const m of messages) {
975
997
  let content = m.encrypted_content ? await this.ring.decrypt(m.encrypted_content) : "";
976
- if (m.message_type === "file" || m.has_attachments) {
998
+ if (m.message_type === CALL_TYPE) {
999
+ content = `${callSummary({ ...m, content }, this.me?.id)} · join on qrypt.chat`;
1000
+ } else if (m.message_type === "file" || m.has_attachments) {
977
1001
  content = `\uD83D\uDCCE ${content && content !== "[File attachment]" ? `${content} ` : ""}(attachment: open qrypt.chat to download)`;
978
1002
  }
979
1003
  raw.push({ ...m, content });
@@ -1131,7 +1155,9 @@ var PAGE = (title, body) => `<!doctype html><meta charset="utf-8"><title>${title
1131
1155
  function isRemote({ platform = process.platform, env = process.env } = {}) {
1132
1156
  if (env.QC_NO_BROWSER)
1133
1157
  return true;
1134
- return !!(env.SSH_CONNECTION || env.SSH_TTY) && !env.DISPLAY && !env.WAYLAND_DISPLAY && platform !== "darwin" && platform !== "win32";
1158
+ if (platform === "darwin" || platform === "win32")
1159
+ return false;
1160
+ return !env.DISPLAY && !env.WAYLAND_DISPLAY;
1135
1161
  }
1136
1162
  function parsePasted(input, state) {
1137
1163
  const text = String(input || "").trim();
package/dist/commands.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  parseArgs2,
4
4
  findChat2,
5
5
  main2
6
- } from "./chunk-4r99spcc.js";
6
+ } from "./chunk-7ane8p3w.js";
7
7
  import"./chunk-vfahhydf.js";
8
8
  export {
9
9
  HELP2 as HELP,
package/dist/mcp.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import"./chunk-vfahhydf.js";
2
2
  import {
3
3
  findChat2
4
- } from "./chunk-4r99spcc.js";
4
+ } from "./chunk-7ane8p3w.js";
5
5
 
6
6
  // src/cli/mcp.js
7
7
  import { createInterface } from "node:readline";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@profullstack/qryptchat",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "qc: qrypt.chat in your terminal. A full-screen end-to-end encrypted chat client (ML-KEM-1024), plus a scriptable CLI and an MCP server.",
5
5
  "type": "module",
6
6
  "bin": {