@holochain/hc-spin 0.200.11 → 0.200.13
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/cli/cli.js +15 -0
- package/dist/cli.js +15 -0
- package/dist/main/index.js +18 -8
- package/package.json +2 -2
- package/src/main/index.ts +2 -1
package/cli/cli.js
CHANGED
|
@@ -20,6 +20,21 @@ for (let i = 0; i < 7; i++) {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
// https://github.com/electron/electron/issues/17972
|
|
24
|
+
if (process.platform === 'linux') {
|
|
25
|
+
let chromeSandboxPathStr = '../node_modules/electron/dist/chrome-sandbox';
|
|
26
|
+
// recursively look for electron binary in node_modules folder
|
|
27
|
+
for (let i = 0; i < 7; i++) {
|
|
28
|
+
const maybeChromeSandbox = path.resolve(__dirname, chromeSandboxPathStr);
|
|
29
|
+
if (fs.existsSync(maybeChromeSandbox)) {
|
|
30
|
+
fs.chmodSync(maybeChromeSandbox, 0o4755);
|
|
31
|
+
break;
|
|
32
|
+
} else {
|
|
33
|
+
chromeSandboxPathStr = '../' + chromeSandboxPathStr;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
23
38
|
if (!electronBinary) {
|
|
24
39
|
throw new Error('Failed to locate electron binary. __dirname: ', __dirname);
|
|
25
40
|
}
|
package/dist/cli.js
CHANGED
|
@@ -20,6 +20,21 @@ for (let i = 0; i < 7; i++) {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
// https://github.com/electron/electron/issues/17972
|
|
24
|
+
if (process.platform === 'linux') {
|
|
25
|
+
let chromeSandboxPathStr = '../node_modules/electron/dist/chrome-sandbox';
|
|
26
|
+
// recursively look for electron binary in node_modules folder
|
|
27
|
+
for (let i = 0; i < 7; i++) {
|
|
28
|
+
const maybeChromeSandbox = path.resolve(__dirname, chromeSandboxPathStr);
|
|
29
|
+
if (fs.existsSync(maybeChromeSandbox)) {
|
|
30
|
+
fs.chmodSync(maybeChromeSandbox, 0o4755);
|
|
31
|
+
break;
|
|
32
|
+
} else {
|
|
33
|
+
chromeSandboxPathStr = '../' + chromeSandboxPathStr;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
23
38
|
if (!electronBinary) {
|
|
24
39
|
throw new Error('Failed to locate electron binary. __dirname: ', __dirname);
|
|
25
40
|
}
|
package/dist/main/index.js
CHANGED
|
@@ -6314,8 +6314,10 @@ const randomByteArray = async (length) => {
|
|
|
6314
6314
|
};
|
|
6315
6315
|
const getNonceExpiration = () => (Date.now() + 5 * 60 * 1e3) * 1e3;
|
|
6316
6316
|
const __HC_LAUNCHER_ENV__ = "__HC_LAUNCHER_ENV__";
|
|
6317
|
+
const __HC_ZOME_CALL_SIGNER__ = "__HC_ZOME_CALL_SIGNER__";
|
|
6317
6318
|
const isLauncher = () => globalThis.window && __HC_LAUNCHER_ENV__ in globalThis.window;
|
|
6318
6319
|
const getLauncherEnvironment = () => isLauncher() ? globalThis.window[__HC_LAUNCHER_ENV__] : void 0;
|
|
6320
|
+
const getHostZomeCallSigner = () => globalThis.window && globalThis.window[__HC_ZOME_CALL_SIGNER__];
|
|
6319
6321
|
const signZomeCallTauri = async (request) => {
|
|
6320
6322
|
const zomeCallUnsigned = {
|
|
6321
6323
|
provenance: Array.from(request.provenance),
|
|
@@ -10849,7 +10851,7 @@ class AppWebsocket extends Emittery {
|
|
|
10849
10851
|
static async connect(url2, defaultTimeout) {
|
|
10850
10852
|
const env = getLauncherEnvironment();
|
|
10851
10853
|
if (env?.APP_INTERFACE_PORT) {
|
|
10852
|
-
url2 = new URL(`ws://
|
|
10854
|
+
url2 = new URL(`ws://localhost:${env.APP_INTERFACE_PORT}`);
|
|
10853
10855
|
}
|
|
10854
10856
|
const wsClient = await WsClient.connect(url2);
|
|
10855
10857
|
const appWebsocket = new AppWebsocket(wsClient, defaultTimeout, env?.INSTALLED_APP_ID);
|
|
@@ -10903,13 +10905,19 @@ const callZomeTransform = {
|
|
|
10903
10905
|
if ("signature" in request) {
|
|
10904
10906
|
return request;
|
|
10905
10907
|
}
|
|
10906
|
-
const
|
|
10907
|
-
if (
|
|
10908
|
-
return signZomeCall(request);
|
|
10909
|
-
} else
|
|
10910
|
-
|
|
10908
|
+
const hostSigner = getHostZomeCallSigner();
|
|
10909
|
+
if (hostSigner) {
|
|
10910
|
+
return hostSigner.signZomeCall(request);
|
|
10911
|
+
} else {
|
|
10912
|
+
const env = getLauncherEnvironment();
|
|
10913
|
+
if (!env) {
|
|
10914
|
+
return signZomeCall(request);
|
|
10915
|
+
}
|
|
10916
|
+
if (env.FRAMEWORK === "electron") {
|
|
10917
|
+
return signZomeCallElectron(request);
|
|
10918
|
+
}
|
|
10919
|
+
return signZomeCallTauri(request);
|
|
10911
10920
|
}
|
|
10912
|
-
return signZomeCallTauri(request);
|
|
10913
10921
|
},
|
|
10914
10922
|
output: (response) => msgpack.decode(response)
|
|
10915
10923
|
};
|
|
@@ -12011,8 +12019,10 @@ electron.app.whenReady().then(async () => {
|
|
|
12011
12019
|
for (var i = 0; i < CLI_OPTS.numAgents; i++) {
|
|
12012
12020
|
const zomeCallSigner = await rustUtils.ZomeCallSigner.connect(lairUrls[i], "pass");
|
|
12013
12021
|
const appPort = portsInfo[i].app_ports[0];
|
|
12014
|
-
const appWs = await AppWebsocket.connect(new URL(`ws://
|
|
12022
|
+
const appWs = await AppWebsocket.connect(new URL(`ws://localhost:${appPort}`));
|
|
12015
12023
|
const appInfo = await appWs.appInfo({ installed_app_id: CLI_OPTS.appId });
|
|
12024
|
+
if (!appInfo)
|
|
12025
|
+
throw new Error("AppInfo undefined.");
|
|
12016
12026
|
const happWindow = await createHappWindow(
|
|
12017
12027
|
CLI_OPTS.uiSource,
|
|
12018
12028
|
CLI_OPTS.happOrWebhappPath,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holochain/hc-spin",
|
|
3
|
-
"version": "0.200.
|
|
3
|
+
"version": "0.200.13",
|
|
4
4
|
"holochainVersion": "0.2.x",
|
|
5
5
|
"description": "CLI to run Holochain aps during development.",
|
|
6
6
|
"author": "matthme",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@electron-toolkit/preload": "^3.0.0",
|
|
37
37
|
"@electron-toolkit/utils": "^3.0.0",
|
|
38
|
-
"@holochain/client": "^0.16.
|
|
38
|
+
"@holochain/client": "^0.16.11",
|
|
39
39
|
"@holochain/hc-spin-rust-utils": "^0.200.3",
|
|
40
40
|
"@msgpack/msgpack": "^2.8.0",
|
|
41
41
|
"commander": "11.1.0",
|
package/src/main/index.ts
CHANGED
|
@@ -330,8 +330,9 @@ app.whenReady().then(async () => {
|
|
|
330
330
|
const zomeCallSigner = await rustUtils.ZomeCallSigner.connect(lairUrls[i], 'pass');
|
|
331
331
|
|
|
332
332
|
const appPort = portsInfo[i].app_ports[0];
|
|
333
|
-
const appWs = await AppWebsocket.connect(new URL(`ws://
|
|
333
|
+
const appWs = await AppWebsocket.connect(new URL(`ws://localhost:${appPort}`));
|
|
334
334
|
const appInfo = await appWs.appInfo({ installed_app_id: CLI_OPTS.appId });
|
|
335
|
+
if (!appInfo) throw new Error('AppInfo undefined.');
|
|
335
336
|
const happWindow = await createHappWindow(
|
|
336
337
|
CLI_OPTS.uiSource,
|
|
337
338
|
CLI_OPTS.happOrWebhappPath,
|