From e214c0f19f139c9f5f32c94f54a1975f246203c3 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 13 Dec 2019 11:13:44 +0000 Subject: [PATCH 1/5] Support config directories --- README | 20 +++++++++++++++++--- riot.im/env.sh | 1 - scripts/fetch-package.js | 22 ++++++++++++++++++++++ 3 files changed, 39 insertions(+), 4 deletions(-) delete mode 100644 riot.im/env.sh diff --git a/README b/README index ffdd78a..332fdf2 100644 --- a/README +++ b/README @@ -14,7 +14,8 @@ so the first step is to get a working copy of Riot. There are a few ways of doin ``` # Fetch the prebuilt release Riot package from the riot.im GitHub releases page. The version # fetched will be the same as the local riot-desktop package. -yarn run fetch --noverify +# We're explicitly asking for no config, so the package Riot will have no config.json. +yarn run fetch --noverify --cfgdir '' ``` ...or if you'd like to use GPG to verify the downloaded package: @@ -24,14 +25,14 @@ yarn run fetch --noverify # once. yarn run fetch --importkey # Fetch the package and verify the signature -yarn run fetch +yarn run fetch --cfgdir '' ``` ...or either of the above, but fetching a specific version of Riot: ``` # Fetch the prebuilt release Riot package from the riot.im GitHub releases page. The version # fetched will be the same as the local riot-desktop package. -yarn run fetch --noverify v1.5.6 +yarn run fetch --noverify --cfgdir '' v1.5.6 ``` If you only want to run the app locally and don't need to build packages, you can @@ -74,3 +75,16 @@ If you'd just like to run the electron app locally for development: yarn add electron yarn start ``` + +Config +====== +If you'd like the packaged Riot to have a configuration file, you can create a +config directory and place `config.json` in there, then specify this directory +with the `--cfgdir` option to `yarn run fetch`, eg: +``` +mkdir myconfig +cp /path/to/my/config.json myconfig/ +yarn run fetch --cfgdir myconfig +``` +The config dir for the official Riot.im app is in `riot.im`. Ifb you use this, +your app will auto-update itself using builds from Riot.im. diff --git a/riot.im/env.sh b/riot.im/env.sh deleted file mode 100644 index 0ee8105..0000000 --- a/riot.im/env.sh +++ /dev/null @@ -1 +0,0 @@ -export OSSLSIGNCODE_SIGNARGS='-pkcs11module /Library/Frameworks/eToken.framework/Versions/Current/libeToken.dylib -pkcs11engine /usr/local/lib/engines/engine_pkcs11.so -certs electron_app/riot.im/New_Vector_Ltd.pem -key 0a3271cbc1ec0fd8afb37f6bbe0cd65ba08d3b4d -t http://timestamp.comodoca.com -verbose' diff --git a/scripts/fetch-package.js b/scripts/fetch-package.js index 04efce1..106db3b 100755 --- a/scripts/fetch-package.js +++ b/scripts/fetch-package.js @@ -58,6 +58,7 @@ async function main() { let importkey = false; let pkgDir = 'packages'; let deployDir = 'deploys'; + let cfgDir; let targetVersion; while (process.argv.length > 2) { @@ -76,6 +77,11 @@ async function main() { process.argv.shift(); deployDir = process.argv[2]; break; + case '--cfgdir': + case '-d': + process.argv.shift(); + cfgDir = process.argv[2]; + break; default: targetVersion = process.argv[2]; } @@ -118,6 +124,13 @@ async function main() { }); return 0; } + + if (cfgDir === undefined) { + console.log("No config directory set"); + console.log("Specify a config directory with --cfgdir or -d"); + console.log("To build with no config (and no auto-update), pass the empty string (-d '')"); + return 1; + } if (verify && !haveGpg) { console.log("No working GPG binary: install GPG or pass --noverify to skip verification"); @@ -186,6 +199,15 @@ async function main() { } catch (e) { } + if (cfgDir.length) { + const configJsonSource = path.join(cfgDir, 'config.json'); + const configJsonDest = path.join(expectedDeployDir, 'config.json'); + console.log(configJsonSource + ' -> ' + configJsonDest); + await fsPromises.copyFile(configJsonSource, configJsonDest); + } else { + console.log("Skipping config file"); + } + console.log("Pack " + expectedDeployDir + " -> " + ASAR_PATH); await asar.createPackage(expectedDeployDir, ASAR_PATH); console.log("Done!"); From 89312425803766bdcf91e6218f58249f8b565dcd Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 13 Dec 2019 11:21:34 +0000 Subject: [PATCH 2/5] Don't bail if we can't notarise Just print a big fat warning instead. --- scripts/electron_afterSign.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/electron_afterSign.js b/scripts/electron_afterSign.js index 5952976..5307eaa 100644 --- a/scripts/electron_afterSign.js +++ b/scripts/electron_afterSign.js @@ -10,7 +10,11 @@ exports.default = async function(context) { // from the keychain, so we need to get it from the environment. const userId = process.env.NOTARIZE_APPLE_ID; if (userId === undefined) { - throw new Error("User ID not found. Set NOTARIZE_APPLE_ID."); + console.log("*************************************"); + console.log("* NOTARIZE_APPLE_ID is not set. *"); + console.log("* This build will NOT be notarised. *"); + console.log("*************************************"); + return; } console.log("Notarising macOS app. This may be some time."); From fbec6db1a07f740f3708bd58d9e2992bb0af5626 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 13 Dec 2019 11:46:02 +0000 Subject: [PATCH 3/5] Typing is hard Co-Authored-By: J. Ryan Stinnett --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 332fdf2..23d1c80 100644 --- a/README +++ b/README @@ -86,5 +86,5 @@ mkdir myconfig cp /path/to/my/config.json myconfig/ yarn run fetch --cfgdir myconfig ``` -The config dir for the official Riot.im app is in `riot.im`. Ifb you use this, +The config dir for the official Riot.im app is in `riot.im`. If you use this, your app will auto-update itself using builds from Riot.im. From d7b8d25a34585f8f6257e12adfb3bdf2bb950a7e Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 13 Dec 2019 15:48:56 +0000 Subject: [PATCH 4/5] More appropriate section Co-Authored-By: Hubert Chathi --- pkg/control.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/control.template b/pkg/control.template index 8835e61..6a7d9fd 100644 --- a/pkg/control.template +++ b/pkg/control.template @@ -7,7 +7,7 @@ Depends: libgtk-3-0, libnotify4, libnss3, libxss1, libxtst6, xdg-utils, libatspi Provides: riot-web Conflicts: riot-web Replaces: riot-web -Section: default +Section: net Priority: extra Homepage: https://riot.im/ Description: From 9a3c0f7cdc1472a81904bc7ef7d1855943ea8b2c Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 13 Dec 2019 16:37:07 +0000 Subject: [PATCH 5/5] rename indocker script --- package.json | 6 +++--- scripts/{indocker.sh => in-docker.sh} | 0 2 files changed, 3 insertions(+), 3 deletions(-) rename scripts/{indocker.sh => in-docker.sh} (100%) diff --git a/package.json b/package.json index 3f9f26c..177c4dc 100644 --- a/package.json +++ b/package.json @@ -18,9 +18,9 @@ "start": "electron .", "lint": "eslint src/", "build": "yarn run setversion && electron-builder", - "indocker": "scripts/indocker.sh", - "docker:build": "yarn run indocker yarn run build", - "docker:install": "yarn run indocker yarn install", + "in-docker": "scripts/in-docker.sh", + "docker:build": "yarn run in-docker yarn run build", + "docker:install": "yarn run in-docker yarn install", "clean": "rimraf webapp.asar dist packages deploys" }, "dependencies": { diff --git a/scripts/indocker.sh b/scripts/in-docker.sh similarity index 100% rename from scripts/indocker.sh rename to scripts/in-docker.sh