diff --git a/main.js b/main.js index 7263841..eb44e0d 100644 --- a/main.js +++ b/main.js @@ -1,14 +1,18 @@ // Modules to control application life and create native browser window const { app, BrowserWindow, Menu, shell } = require('electron') const spawn = require('child_process').spawn +const { + default: installExtension, + REACT_DEVELOPER_TOOLS, + REDUX_DEVTOOLS, +} = require('electron-devtools-installer') const fs = require('fs') const path = require('path') const kill = require('tree-kill') const { log, logger } = require('./logger') require('electron-context-menu')() require('fix-path')() -// enables the devtools window automatically -// require('electron-debug')({ isEnabled: true }) +require('electron-debug')({ isEnabled: true, showDevTools: false }) const { AdminWebsocket } = require('@holochain/conductor-api') @@ -34,9 +38,9 @@ const HOLOCHAIN_BIN = './holochain' const LAIR_KEYSTORE_BIN = './lair-keystore' // TODO: make this based on version number? -const CONFIG_PATH = path.join(app.getPath('appData'), 'AcornNew') +const CONFIG_PATH = path.join(app.getPath('appData'), 'HcAcorn') const STORAGE_PATH = path.join(CONFIG_PATH, 'database') -const CONDUCTOR_CONFIG_PATH = path.join(CONFIG_PATH, 'conductor-config.toml') +const CONDUCTOR_CONFIG_PATH = path.join(CONFIG_PATH, 'conductor-config.yml') if (!fs.existsSync(CONFIG_PATH)) { fs.mkdirSync(CONFIG_PATH) @@ -44,12 +48,24 @@ if (!fs.existsSync(CONFIG_PATH)) { fs.writeFileSync( CONDUCTOR_CONFIG_PATH, ` -environment_path = "${STORAGE_PATH}" -use_dangerous_test_keystore = false - -[[admin_interfaces]] -driver.type = "websocket" -driver.port = ${ADMIN_PORT}` +environment_path: ${STORAGE_PATH} +use_dangerous_test_keystore: false +passphrase_service: + type: cmd +admin_interfaces: + - driver: + type: websocket + port: ${ADMIN_PORT} +network: + bootstrap_service: https://bootstrap.holo.host + transport_pool: + - type: proxy + sub_transport: + type: quic + bind_to: kitsune-quic://0.0.0.0:0 + proxy_config: + type: remote_proxy_client + proxy_url: kitsune-proxy://VYgwCrh2ZCKL1lpnMM1VVUee7ks-9BkmW47C_ys4nqg/kitsune-quic/h/kitsune-proxy.harris-braun.com/p/4010/--` ) } @@ -113,6 +129,9 @@ async function startConductor() { holochain_handle = spawn(HOLOCHAIN_BIN, ['-c', CONDUCTOR_CONFIG_PATH], { cwd: __dirname, + env: { + RUST_BACKTRACE: 1, + }, }) holochain_handle.stderr.on('data', (data) => { log('error', 'holochain> ' + data.toString()) @@ -140,11 +159,12 @@ async function startConductor() { async function installIfFirstLaunch(adminWs) { const dnas = await adminWs.listDnas() + // const activeAppIds = await adminWs.listActiveApps() if (dnas.length === 0) { let myPubKey = await adminWs.generateAgentPubKey() await adminWs.installApp({ agent_key: myPubKey, - app_id: PROFILES_APP_ID, + installed_app_id: PROFILES_APP_ID, dnas: [ { nick: MATCH_ACORN_UI_PROFILES_DNA_NICK, @@ -152,15 +172,19 @@ async function installIfFirstLaunch(adminWs) { }, ], }) - await adminWs.activateApp({ app_id: PROFILES_APP_ID }) + await adminWs.activateApp({ installed_app_id: PROFILES_APP_ID }) + await adminWs.attachAppInterface({ port: APP_PORT }) } - await adminWs.attachAppInterface({ port: APP_PORT }) } // This method will be called when Electron has finished // initialization and is ready to create browser windows. // Some APIs can only be used after this event occurs. app.on('ready', async function () { + installExtension(REDUX_DEVTOOLS) + .then(() => installExtension(REACT_DEVELOPER_TOOLS)) + .then((name) => console.log(`Added Extension: ${name}`)) + .catch((err) => console.log('An error occurred: ', err)) createWindow() await startConductor() const adminWs = await AdminWebsocket.connect(`ws://localhost:${ADMIN_PORT}`) diff --git a/nix/acorn/default.nix b/nix/acorn/default.nix index ec8ba70..b502e7c 100644 --- a/nix/acorn/default.nix +++ b/nix/acorn/default.nix @@ -3,11 +3,11 @@ let bundle-dna = (pkgs.writeShellScriptBin "acorn-bundle-dna" '' rm -rf dna # an optional first argument should be the version number you want - # default to 0.4.0 - echo "fetching DNA from https://github.com/h-be/acorn-hc/releases/download/v''${1:-0.4.0}/profiles.dna.gz" - echo "fetching DNA from https://github.com/h-be/acorn-hc/releases/download/v''${1:-0.4.0}/projects.dna.gz" - curl -O -L https://github.com/h-be/acorn-hc/releases/download/v''${1:-0.4.0}/profiles.dna.gz - curl -O -L https://github.com/h-be/acorn-hc/releases/download/v''${1:-0.4.0}/projects.dna.gz + # default to 0.4.1 + echo "fetching DNA from https://github.com/h-be/acorn-hc/releases/download/v''${1:-0.4.2}/profiles.dna.gz" + echo "fetching DNA from https://github.com/h-be/acorn-hc/releases/download/v''${1:-0.4.2}/projects.dna.gz" + curl -O -L https://github.com/h-be/acorn-hc/releases/download/v''${1:-0.4.2}/profiles.dna.gz + curl -O -L https://github.com/h-be/acorn-hc/releases/download/v''${1:-0.4.2}/projects.dna.gz mkdir dna mv profiles.dna.gz dna/profiles.dna.gz mv projects.dna.gz dna/projects.dna.gz @@ -17,8 +17,8 @@ let rm -rf ui mkdir ui # an optional first argument should be the version number you want - # default to 0.4.1 - curl -O -L https://github.com/h-be/acorn-ui/releases/download/v''${1:-0.4.1}/acorn-ui.zip + # default to 0.4.3 + curl -O -L https://github.com/h-be/acorn-ui/releases/download/v''${1:-0.4.3}/acorn-ui.zip # unzip into the ./ui folder unzip acorn-ui.zip -d ui rm acorn-ui.zip @@ -29,8 +29,8 @@ let rm -rf ./ui rm -rf ./dna rm -rf ./Acorn-* - rm -rf $HOME/.config/Acorn - rm -rf $HOME/Library/Application\ Support/Acorn + rm -rf $HOME/.config/HcAcorn + rm -rf $HOME/Library/Application\ Support/HcAcorn rm -rf ./node_modules ''); diff --git a/package-lock.json b/package-lock.json index e203ef8..1f7b6b0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "Acorn", - "version": "0.4.0", + "version": "0.4.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -66,8 +66,9 @@ } }, "@holochain/conductor-api": { - "version": "git://github.com/Connoropolous/holochain-conductor-api.git#e3b20b12d2cb829bde3bfaa85d6cb77eabecc972", - "from": "git://github.com/Connoropolous/holochain-conductor-api.git", + "version": "0.0.1-dev.14", + "resolved": "https://registry.npmjs.org/@holochain/conductor-api/-/conductor-api-0.0.1-dev.14.tgz", + "integrity": "sha512-Y10clXo6T6ln5QcHSznQZgzj0Fph000d916RQJKs4qRbD+kU55dYaqoS4AZwAmYoQskeR6i7eF7XPgUD7QYv9A==", "requires": { "@msgpack/msgpack": "^2.1.0", "@types/ws": "^7.2.4", @@ -314,8 +315,7 @@ "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, "cross-spawn": { "version": "4.0.2", @@ -437,6 +437,47 @@ "electron-localshortcut": "^3.1.0" } }, + "electron-devtools-installer": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/electron-devtools-installer/-/electron-devtools-installer-3.1.1.tgz", + "integrity": "sha512-g2D4J6APbpsiIcnLkFMyKZ6bOpEJ0Ltcc2m66F7oKUymyGAt628OWeU9nRZoh1cNmUs/a6Cls2UfOmsZtE496Q==", + "requires": { + "rimraf": "^3.0.2", + "semver": "^7.2.1", + "unzip-crx-3": "^0.2.0" + }, + "dependencies": { + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "requires": { + "yallist": "^4.0.0" + } + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "requires": { + "glob": "^7.1.3" + } + }, + "semver": { + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "requires": { + "lru-cache": "^6.0.0" + } + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + } + } + }, "electron-dl": { "version": "1.14.0", "resolved": "https://registry.npmjs.org/electron-dl/-/electron-dl-1.14.0.tgz", @@ -892,6 +933,11 @@ "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.0.3.tgz", "integrity": "sha512-TcIMG3qeVLgDr1TEd2XvHaTnMPwYQUQMIBLy+5pLSDKYFc7UIqj39w8EGzZkaxoLv/l2K8HaI0t5AVA+YYgUew==" }, + "immediate": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", + "integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=" + }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -935,8 +981,7 @@ "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, "isbinaryfile": { "version": "3.0.3", @@ -975,6 +1020,17 @@ "graceful-fs": "^4.1.6" } }, + "jszip": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.5.0.tgz", + "integrity": "sha512-WRtu7TPCmYePR1nazfrtuF216cIVon/3GWOvHS9QR5bIwSbnxtdpma6un3jyGGNhHsKCSzn5Ypk+EkDRvTGiFA==", + "requires": { + "lie": "~3.3.0", + "pako": "~1.0.2", + "readable-stream": "~2.3.6", + "set-immediate-shim": "~1.0.1" + } + }, "junk": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/junk/-/junk-3.1.0.tgz", @@ -998,6 +1054,14 @@ "json-buffer": "3.0.0" } }, + "lie": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", + "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", + "requires": { + "immediate": "~3.0.5" + } + }, "load-json-file": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", @@ -1199,6 +1263,11 @@ "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=" }, + "pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" + }, "parse-author": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/parse-author/-/parse-author-2.0.0.tgz", @@ -1285,8 +1354,7 @@ "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" }, "proto-list": { "version": "1.2.4", @@ -1341,7 +1409,6 @@ "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dev": true, "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -1393,8 +1460,7 @@ "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, "sanitize-filename": { "version": "1.6.3", @@ -1424,6 +1490,11 @@ "type-fest": "^0.8.0" } }, + "set-immediate-shim": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", + "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=" + }, "shell-env": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/shell-env/-/shell-env-0.3.0.tgz", @@ -1501,7 +1572,6 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, "requires": { "safe-buffer": "~5.1.0" } @@ -1596,6 +1666,16 @@ "path-exists": "^3.0.0" } }, + "unzip-crx-3": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/unzip-crx-3/-/unzip-crx-3-0.2.0.tgz", + "integrity": "sha512-0+JiUq/z7faJ6oifVB5nSwt589v1KCduqIJupNVDoWSXZtWDmjDGO3RAEOvwJ07w90aoXoP4enKsR7ecMrJtWQ==", + "requires": { + "jszip": "^3.1.0", + "mkdirp": "^0.5.1", + "yaku": "^0.16.6" + } + }, "url-parse-lax": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", @@ -1612,8 +1692,7 @@ "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, "validate-npm-package-license": { "version": "3.0.4", @@ -1652,6 +1731,11 @@ "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.27.tgz", "integrity": "sha1-1QH5ezvbQDr4757MIFcxh6rawOk=" }, + "yaku": { + "version": "0.16.7", + "resolved": "https://registry.npmjs.org/yaku/-/yaku-0.16.7.tgz", + "integrity": "sha1-HRlceKqbW/hHnIlblQT9TwhHmE4=" + }, "yallist": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", diff --git a/package.json b/package.json index d2e4fb9..4c69ed6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Acorn", - "version": "0.4.0", + "version": "0.4.1", "description": "A Holochain State of Affairs Tree application", "main": "main.js", "scripts": { @@ -15,7 +15,7 @@ "author": "Harris-Braun Enterprises, LLC and contributors", "license": "CAL-1.0 Beta 4", "dependencies": { - "@holochain/conductor-api": "git://github.com/Connoropolous/holochain-conductor-api.git", + "@holochain/conductor-api": "0.0.1-dev.14", "command-exists": "^1.2.8", "electron-context-menu": "^0.12.1", "electron-debug": "^3.0.1", @@ -25,7 +25,8 @@ "fix-path": "^2.1.0", "open": "^6.3.0", "sudo-prompt": "^9.0.0", - "tree-kill": "^1.2.2" + "tree-kill": "^1.2.2", + "electron-devtools-installer": "^3.1.1" }, "devDependencies": { "electron": "^8.5.2"