@hasna/machines 0.0.7 → 0.0.8
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/dist/cli/index.js
CHANGED
|
@@ -18112,6 +18112,12 @@ function jsonResponse(response, status, data) {
|
|
|
18112
18112
|
response.end(JSON.stringify(data));
|
|
18113
18113
|
}
|
|
18114
18114
|
var currentContentHash = null;
|
|
18115
|
+
function getCurrentContentHash() {
|
|
18116
|
+
return currentContentHash;
|
|
18117
|
+
}
|
|
18118
|
+
function setCurrentContentHash(hash) {
|
|
18119
|
+
currentContentHash = hash;
|
|
18120
|
+
}
|
|
18115
18121
|
function startClipboardServer(options = {}) {
|
|
18116
18122
|
const config = options.config || readClipboardConfig();
|
|
18117
18123
|
const port = options.port || config.port;
|
|
@@ -18293,7 +18299,6 @@ function startClipboardDaemon(port) {
|
|
|
18293
18299
|
console.log(`clipboard daemon started on port ${daemonPort} (pid ${process.pid})`);
|
|
18294
18300
|
writePid(process.pid);
|
|
18295
18301
|
});
|
|
18296
|
-
let lastHash = "";
|
|
18297
18302
|
const secret = loadSharedSecret2();
|
|
18298
18303
|
const machineId = process.env["HASNA_MACHINES_MACHINE_ID"] || "unknown";
|
|
18299
18304
|
const hasDisplay = hasDisplayServer();
|
|
@@ -18307,9 +18312,10 @@ function startClipboardDaemon(port) {
|
|
|
18307
18312
|
if (!content)
|
|
18308
18313
|
return;
|
|
18309
18314
|
const hash = computeHash2(content);
|
|
18310
|
-
|
|
18315
|
+
const currentContentHash2 = getCurrentContentHash();
|
|
18316
|
+
if (hash === currentContentHash2)
|
|
18311
18317
|
return;
|
|
18312
|
-
|
|
18318
|
+
setCurrentContentHash(hash);
|
|
18313
18319
|
const peers = await discoverPeers();
|
|
18314
18320
|
for (const peer of peers) {
|
|
18315
18321
|
try {
|
|
@@ -9,6 +9,8 @@ export interface ClipboardServerHandle {
|
|
|
9
9
|
port: number;
|
|
10
10
|
close: () => Promise<void>;
|
|
11
11
|
}
|
|
12
|
+
export declare function getCurrentContentHash(): string | null;
|
|
13
|
+
export declare function setCurrentContentHash(hash: string): void;
|
|
12
14
|
export declare function startClipboardServer(options?: ClipboardServerOptions): ClipboardServerHandle;
|
|
13
15
|
export declare function pushClipboardToPeer(host: string, port: number, token: string): Promise<{
|
|
14
16
|
sent: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard-server.d.ts","sourceRoot":"","sources":["../../src/commands/clipboard-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA6C,MAAM,WAAW,CAAC;AAKpF,OAAO,KAAK,EAAE,eAAe,EAAkB,MAAM,aAAa,CAAC;AAuFnE,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,eAAe,CAAC;CAC1B;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAID,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,sBAA2B,GAAG,qBAAqB,CA6ChG;AA6DD,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CA4ChI"}
|
|
1
|
+
{"version":3,"file":"clipboard-server.d.ts","sourceRoot":"","sources":["../../src/commands/clipboard-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA6C,MAAM,WAAW,CAAC;AAKpF,OAAO,KAAK,EAAE,eAAe,EAAkB,MAAM,aAAa,CAAC;AAuFnE,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,MAAM,CAA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