relay-companion 0.1.28 → 0.1.30
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.
- package/overlay/main.cjs +13 -0
- package/overlay/space-presence.cjs +16 -0
- package/package.json +1 -1
- package/src/attachments.js +7 -3
package/overlay/main.cjs
CHANGED
|
@@ -32,6 +32,7 @@ const { execFile, execFileSync, spawn, pathToFileURL } = (() => {
|
|
|
32
32
|
const { hostFromBundle, chooseClickHost } = require("./host-select.cjs");
|
|
33
33
|
const {
|
|
34
34
|
reinforceSpacePresence,
|
|
35
|
+
resetWindowZoom,
|
|
35
36
|
showInactiveOnAllSpaces,
|
|
36
37
|
subscribeActiveSpaceChanges,
|
|
37
38
|
} = require("./space-presence.cjs");
|
|
@@ -1020,6 +1021,18 @@ function createWindow() {
|
|
|
1020
1021
|
});
|
|
1021
1022
|
win.webContents.on("preload-error", (_e, p, err) => console.error("[preload-error]", p, err && err.message));
|
|
1022
1023
|
win.webContents.on("render-process-gone", (_e, det) => console.error("[render-gone]", JSON.stringify(det)));
|
|
1024
|
+
win.webContents.on("did-finish-load", () => resetWindowZoom(win));
|
|
1025
|
+
win.webContents.on("zoom-changed", (event) => {
|
|
1026
|
+
if (event && typeof event.preventDefault === "function") event.preventDefault();
|
|
1027
|
+
resetWindowZoom(win);
|
|
1028
|
+
});
|
|
1029
|
+
win.webContents.on("before-input-event", (event, input = {}) => {
|
|
1030
|
+
const key = String(input.key || "").toLowerCase();
|
|
1031
|
+
if ((input.meta || input.control) && (key === "+" || key === "=" || key === "-" || key === "_" || key === "0")) {
|
|
1032
|
+
if (event && typeof event.preventDefault === "function") event.preventDefault();
|
|
1033
|
+
resetWindowZoom(win);
|
|
1034
|
+
}
|
|
1035
|
+
});
|
|
1023
1036
|
win.once("ready-to-show", () => {
|
|
1024
1037
|
// buildPayload() awaits the first task load, so a single push paints all tabs.
|
|
1025
1038
|
pushInbox(true).catch((error) => console.error("[overlay] initial push failed:", error && error.message));
|
|
@@ -4,8 +4,23 @@ function isUsableWindow(win) {
|
|
|
4
4
|
return Boolean(win && !(typeof win.isDestroyed === "function" && win.isDestroyed()));
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
+
function resetWindowZoom(win) {
|
|
8
|
+
if (!isUsableWindow(win) || !win.webContents) return false;
|
|
9
|
+
try {
|
|
10
|
+
if (typeof win.webContents.setZoomFactor === "function") win.webContents.setZoomFactor(1);
|
|
11
|
+
} catch {}
|
|
12
|
+
try {
|
|
13
|
+
if (typeof win.webContents.setVisualZoomLevelLimits === "function") {
|
|
14
|
+
const res = win.webContents.setVisualZoomLevelLimits(1, 1);
|
|
15
|
+
if (res && typeof res.catch === "function") res.catch(() => {});
|
|
16
|
+
}
|
|
17
|
+
} catch {}
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
|
|
7
21
|
function reinforceSpacePresence(win, { moveTop = false } = {}) {
|
|
8
22
|
if (!isUsableWindow(win)) return false;
|
|
23
|
+
resetWindowZoom(win);
|
|
9
24
|
try {
|
|
10
25
|
win.setVisibleOnAllWorkspaces(true, { visibleOnFullScreen: true });
|
|
11
26
|
} catch {}
|
|
@@ -48,6 +63,7 @@ function subscribeActiveSpaceChanges(systemPreferences, callback, { log = () =>
|
|
|
48
63
|
module.exports = {
|
|
49
64
|
ACTIVE_SPACE_CHANGED,
|
|
50
65
|
reinforceSpacePresence,
|
|
66
|
+
resetWindowZoom,
|
|
51
67
|
showInactiveOnAllSpaces,
|
|
52
68
|
subscribeActiveSpaceChanges,
|
|
53
69
|
};
|
package/package.json
CHANGED
package/src/attachments.js
CHANGED
|
@@ -33,7 +33,7 @@ export async function prepareOrdinaryRelayAttachments(args = {}) {
|
|
|
33
33
|
return [
|
|
34
34
|
...passthrough,
|
|
35
35
|
...local.map((file, index) => ({
|
|
36
|
-
id: file.id || ordinaryAttachmentId(file, index),
|
|
36
|
+
id: file.id || ordinaryAttachmentId(file, index, args.idempotencyKey),
|
|
37
37
|
name: file.name,
|
|
38
38
|
contentType: file.contentType,
|
|
39
39
|
bytes: file.bytes,
|
|
@@ -148,8 +148,12 @@ function fileUploadIdempotencyKey(base, file, index) {
|
|
|
148
148
|
return `${safeBase}_file_${index}_${file.sha256.slice(0, 16)}`;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
function ordinaryAttachmentId(file, index) {
|
|
152
|
-
|
|
151
|
+
function ordinaryAttachmentId(file, index, idempotencyKey) {
|
|
152
|
+
const sendHash = createHash("sha256")
|
|
153
|
+
.update(String(idempotencyKey || "relay_mcp_ordinary"))
|
|
154
|
+
.digest("hex")
|
|
155
|
+
.slice(0, 12);
|
|
156
|
+
return `att_${sendHash}_${index}_${file.sha256.slice(0, 16)}`;
|
|
153
157
|
}
|
|
154
158
|
|
|
155
159
|
function inferContentType(filename) {
|