From 466a871094fdc59f133b73f4e25cd685ab3745e8 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 1 Jul 2020 15:30:53 +0100 Subject: [PATCH] Rebrand step 1: s/riot/element/ in the places where it's reasonably simple --- README.md | 48 ++--- {riot.im => element.io}/New_Vector_Ltd.pem | 0 element.io/README | 6 + {riot.im => element.io}/nightly/config.json | 0 .../nightly/control.template | 0 .../release/conf_distributions | 0 {riot.im => element.io}/release/config.json | 0 .../release/control.template | 0 package.json | 14 +- release.sh | 2 +- riot.im/README | 6 - scripts/electron-package.sh | 170 ------------------ scripts/electron_winSign.js | 2 +- scripts/hak/README.md | 2 +- src/electron-main.js | 2 +- src/protocol.js | 12 +- src/tray.js | 2 +- src/vectormenu.js | 4 +- src/webcontents-handler.js | 2 +- 19 files changed, 52 insertions(+), 220 deletions(-) rename {riot.im => element.io}/New_Vector_Ltd.pem (100%) create mode 100644 element.io/README rename {riot.im => element.io}/nightly/config.json (100%) rename {riot.im => element.io}/nightly/control.template (100%) rename {riot.im => element.io}/release/conf_distributions (100%) rename {riot.im => element.io}/release/config.json (100%) rename {riot.im => element.io}/release/control.template (100%) delete mode 100644 riot.im/README delete mode 100755 scripts/electron-package.sh diff --git a/README.md b/README.md index 14e643b..b497b3f 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,23 @@ -Riot Desktop -============ +Element Desktop +=============== -This is Riot desktop app as of release 1.6. +This is Element desktop app as of release 1.6. -Fetching Riot -============= -Since this package is just the Electron wrapper for Riot, it doesn't contain any of the Riot code, -so the first step is to get a working copy of Riot. There are a few ways of doing this: +Fetching Element +================ +Since this package is just the Electron wrapper for Element, it doesn't contain any of the Element code, +so the first step is to get a working copy of Element. There are a few ways of doing this: ``` -# 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. -# We're explicitly asking for no config, so the package Riot will have no config.json. +# Fetch the prebuilt release Element package from the riot.im GitHub releases page. The version +# fetched will be the same as the local element-desktop package. +# We're explicitly asking for no config, so the packaged Element will have no config.json. yarn run fetch --noverify --cfgdir '' ``` ...or if you'd like to use GPG to verify the downloaded package: ``` -# Fetch the Riot public key from the riot.im web server over a secure connection and import +# Fetch the Element public key from the riot.im web server over a secure connection and import # it into your local GPG keychain (you'll need GPG installed). You only need to to do this # once. yarn run fetch --importkey @@ -25,10 +25,10 @@ yarn run fetch --importkey yarn run fetch --cfgdir '' ``` -...or either of the above, but fetching a specific version of Riot: +...or either of the above, but fetching a specific version of Element: ``` -# 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. +# Fetch the prebuilt release Element package from the riot.im GitHub releases page. The version +# fetched will be the same as the local element-desktop package. yarn run fetch --noverify --cfgdir '' v1.5.6 ``` @@ -44,15 +44,15 @@ ln -s ../riot-web/webapp ./ Building ======== -Now you have a copy of Riot, you're ready to build packages. If you'd just like to -run Riot locally, skip to the next section. +Now you have a copy of Element, you're ready to build packages. If you'd just like to +run Element locally, skip to the next section. ``` yarn run build ``` This will do a couple of things: * Run the `setversion` script to set the local package version to match whatever - version of Riot you installed above. + version of Element you installed above. * Run electron-builder to build a package. The package built will match the operating system you're running the build process on. @@ -102,7 +102,7 @@ yarn start Config ====== -If you'd like the packaged Riot to have a configuration file, you can create a +If you'd like the packaged Element 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: ``` @@ -110,15 +110,15 @@ 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`. If you use this, -your app will auto-update itself using builds from Riot.im. +The config dir for the official Element.im app is in `riot.im`. If you use this, +your app will auto-update itself using builds from element.io. Profiles ======== To run multiple instances of the desktop app for different accounts, you can launch the executable with the `--profile` argument followed by a unique -identifier, e.g `riot-desktop --profile Work` for it to run a separate profile and +identifier, e.g `element-desktop --profile Work` for it to run a separate profile and not interfere with the default one. Alternatively, a custom location for the profile data can be specified using the @@ -131,5 +131,7 @@ User-specified config.json + `$XDG_CONFIG_HOME\$NAME\config.json` or `~/.config/$NAME/config.json` on Linux + `~/Library/Application Support/$NAME/config.json` on macOS -In the paths above, `$NAME` is typically `Riot`, unless you use `--profile -$PROFILE` in which case it becomes `Riot-$PROFILE`. +In the paths above, `$NAME` is typically `Element`, unless you use `--profile +$PROFILE` in which case it becomes `Element-$PROFILE`, or it is using one of +the above created by a pre-1.7 install, in which case it will be `Riot` or +`Riot-$PROFILE`. diff --git a/riot.im/New_Vector_Ltd.pem b/element.io/New_Vector_Ltd.pem similarity index 100% rename from riot.im/New_Vector_Ltd.pem rename to element.io/New_Vector_Ltd.pem diff --git a/element.io/README b/element.io/README new file mode 100644 index 0000000..66b22f2 --- /dev/null +++ b/element.io/README @@ -0,0 +1,6 @@ +This directory contains the config file for the official element.io distribution +of Element Desktop. + +You probably do not want to build with this config unless you're building the +official element.io distribution, or you'll find your builds will replace +themselves with the element.io build. diff --git a/riot.im/nightly/config.json b/element.io/nightly/config.json similarity index 100% rename from riot.im/nightly/config.json rename to element.io/nightly/config.json diff --git a/riot.im/nightly/control.template b/element.io/nightly/control.template similarity index 100% rename from riot.im/nightly/control.template rename to element.io/nightly/control.template diff --git a/riot.im/release/conf_distributions b/element.io/release/conf_distributions similarity index 100% rename from riot.im/release/conf_distributions rename to element.io/release/conf_distributions diff --git a/riot.im/release/config.json b/element.io/release/config.json similarity index 100% rename from riot.im/release/config.json rename to element.io/release/config.json diff --git a/riot.im/release/control.template b/element.io/release/control.template similarity index 100% rename from riot.im/release/control.template rename to element.io/release/control.template diff --git a/package.json b/package.json index 8cfb8c3..d1d68e8 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { - "name": "riot-desktop", - "productName": "Riot", + "name": "element-desktop", + "productName": "Element", "main": "src/electron-main.js", "version": "1.6.6", "description": "A feature-rich client for Matrix.org", - "author": "New Vector Ltd.", + "author": "Element Communications Ltd.", "repository": { "type": "git", "url": "https://github.com/vector-im/riot-desktop" @@ -82,9 +82,9 @@ "linux": { "target": "deb", "category": "Network;InstantMessaging;Chat", - "maintainer": "support@riot.im", + "maintainer": "support@element.io", "desktop": { - "StartupWMClass": "riot" + "StartupWMClass": "element" } }, "mac": { @@ -103,9 +103,9 @@ "afterSign": "scripts/electron_afterSign", "protocols": [ { - "name": "riot", + "name": "element", "schemes": [ - "riot" + "element" ] } ] diff --git a/release.sh b/release.sh index ce2bd3c..2f07393 100755 --- a/release.sh +++ b/release.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Script to perform a release of riot-desktop. +# Script to perform a release of element-desktop. # # Requires githib-changelog-generator; to install, do # pip install git+https://github.com/matrix-org/github-changelog-generator.git diff --git a/riot.im/README b/riot.im/README deleted file mode 100644 index 8e463c2..0000000 --- a/riot.im/README +++ /dev/null @@ -1,6 +0,0 @@ -This directory contains the config file for the official riot.im distribution -of Riot Desktop. - -You probably do not want to build with this config unless you're building the -official riot.im distribution, or you'll find your builds will replace -themselves with the riot.im build. diff --git a/scripts/electron-package.sh b/scripts/electron-package.sh deleted file mode 100755 index f92c138..0000000 --- a/scripts/electron-package.sh +++ /dev/null @@ -1,170 +0,0 @@ -#!/bin/bash - -usage() { - echo "Usage: $0 -v -d [-n]" - echo - echo "version: commit-ish to check out and build" - echo "config directory: a path to a directory containing" - echo "config.json, a json config file to ship with the build" - echo "and env.sh, a file to source environment variables" - echo "from." - echo "-n: build with no config file." - echo - echo "The update_base_url value from config.json is used to set up auto-update." - echo - echo "Environment variables:" - echo " OSSLSIGNCODE_SIGNARGS: Arguments to pass to osslsigncode when signing" - echo " NOTARIZE_APPLE_ID: Apple ID to use for notarisation. The password for" - echo " this account must be set in NOTARIZE_CREDS in the keychain." -} - -confdir= -version= -skipcfg=0 -while getopts "d:v:n" opt; do - case $opt in - d) - confdir=$OPTARG - ;; - v) - version=$OPTARG - ;; - n) - skipcfg=1 - ;; - \?) - echo "Invalid option: -$OPTARG" >&2 - usage - exit - ;; - esac -done - -if [ -z "$version" ]; then - echo "No version supplied" - usage - exit -fi - -conffile="$confdir/config.json" - -if [ -z "$conffile" ] && [ "$skipcfg" = 0 ]; then - echo "No config file given. Use -c to supply a config file or" - echo "-n to build with no config file (and no auto update)." - exit -fi - -if [ -n "$conffile" ]; then - update_base_url=`jq -r .update_base_url $conffile` - - if [ -z "$update_base_url" ]; then - echo "No update URL supplied. Use update_base_url: null if you really" - echo "want a build with no auto-update." - usage - exit - fi - # Make sure the base URL ends in a slash if it doesn't already - update_base_url=`echo $update_base_url | sed -e 's#\([^\/]\)$#\1\/#'` -fi - -if [ ! -f package.json ]; then - echo "No package.json found. This script must be run from" - echo "the riot-web directory." - exit -fi - -[ -f "$confdir/env.sh" ] && . "$confdir/env.sh" - -if [ -z "$NOTARIZE_APPLE_ID" ]; then - echo "NOTARIZE_APPLE_ID is not set" - exit -fi - -osslsigncode -h 2> /dev/null -if [ $? -ne 255 ]; then # osslsigncode exits with 255 after printing usage... - echo "osslsigncode not found" - exit -fi - -# Test that altool can get its credentials for notarising the mac app -xcrun altool -u "$NOTARIZE_APPLE_ID" -p '@keychain:NOTARIZE_CREDS' --list-apps || exit - -# Get the token password: we'll need it later, but get it now so we fail early if it's not there -token_password=`security find-generic-password -s riot_signing_token -w` -if [ $? -ne 0 ]; then - echo "riot_signing_token not found in keychain" - exit -fi - -set -e - -echo "Building $version using Update base URL $update_base_url" - -projdir=`pwd` -builddir=`mktemp -d 2>/dev/null || mktemp -d -t 'buildtmp'` -pushd "$builddir" - -git clone "$projdir" . -git checkout "$version" - -# Figure out what version we're building -vername=`jq -r .version package.json` - -if [ -n "$conffile" ]; then - popd - cp "$conffile" "$builddir/" - pushd "$builddir" -fi - -# We use Git branch / commit dependencies for some packages, and Yarn seems -# to have a hard time getting that right. See also -# https://github.com/yarnpkg/yarn/issues/4734. As a workaround, we clean the -# global cache here to ensure we get the right thing. -yarn cache clean -yarn install -yarn build:electron - -popd - -distdir="$builddir/electron_app/dist" -pubdir="$projdir/electron_app/pub" -rm -r "$pubdir" || true -mkdir -p "$pubdir" -rm -r "$projdir/electron_app/dist" || true -mkdir -p "$projdir/electron_app/dist" - -# Install packages: what the user downloads the first time, -# (DMGs for mac, exe installer for windows) -mkdir -p "$pubdir/install/macos" -cp $distdir/*.dmg "$pubdir/install/macos/" - -mkdir -p "$pubdir/install/win32/ia32/" -cp $distdir/squirrel-windows-ia32/*.exe "$pubdir/install/win32/ia32/" - -mkdir -p "$pubdir/install/win32/x64/" -cp $distdir/squirrel-windows/*.exe "$pubdir/install/win32/x64/" - -# Packages for auto-update -mkdir -p "$pubdir/update/macos" -cp $distdir/*-mac.zip "$pubdir/update/macos/" -echo "$vername" > "$pubdir/update/macos/latest" - -mkdir -p "$pubdir/update/win32/ia32/" -cp $distdir/squirrel-windows-ia32/*.nupkg "$pubdir/update/win32/ia32/" -cp $distdir/squirrel-windows-ia32/RELEASES "$pubdir/update/win32/ia32/" - -mkdir -p "$pubdir/update/win32/x64/" -cp $distdir/squirrel-windows/*.nupkg "$pubdir/update/win32/x64/" -cp $distdir/squirrel-windows/RELEASES "$pubdir/update/win32/x64/" - -# Move the deb to the main project dir's dist folder -# (just the 64 bit one - the 32 bit one still gets built because -# it's one arch argument for all platforms and we still want 32 bit -# windows, but 32 bit linux is unsupported as of electron 4 and no -# longer appears to work). -cp $distdir/*_amd64.deb "$projdir/electron_app/dist/" - -rm -rf "$builddir" - -echo "$pubdir can now be hosted on your web server." -echo "deb archives are in electron_app/dist/ - these should be added into your debian repository" diff --git a/scripts/electron_winSign.js b/scripts/electron_winSign.js index 8d46d0d..361a102 100644 --- a/scripts/electron_winSign.js +++ b/scripts/electron_winSign.js @@ -24,7 +24,7 @@ function computeSignToolArgs(options, keyContainer) { // so we don't have to hard-code this here // fwiw https://stackoverflow.com/questions/17927895/automate-extended-validation-ev-code-signing // is about the most useful resource on automating code signing... - args.push('/f', 'riot.im\\New_Vector_Ltd.pem'); + args.push('/f', 'element.io\\New_Vector_Ltd.pem'); if (options.hash !== "sha1") { args.push("/fd", options.hash); diff --git a/scripts/hak/README.md b/scripts/hak/README.md index 4aed7d4..325795f 100644 --- a/scripts/hak/README.md +++ b/scripts/hak/README.md @@ -1,7 +1,7 @@ hak === -This tool builds native dependencies for riot-desktop. Here follows some very minimal +This tool builds native dependencies for element-desktop. Here follows some very minimal documentation for it. Goals: diff --git a/src/electron-main.js b/src/electron-main.js index 00215cb..8b46bd6 100644 --- a/src/electron-main.js +++ b/src/electron-main.js @@ -909,4 +909,4 @@ app.on('second-instance', (ev, commandLine, workingDirectory) => { // installer uses for the shortcut icon. // This makes notifications work on windows 8.1 (and is // a noop on other platforms). -app.setAppUserModelId('com.squirrel.riot-web.Riot'); +app.setAppUserModelId('com.squirrel.element-desktop.Element'); diff --git a/src/protocol.js b/src/protocol.js index fbfacb2..3b2cd20 100644 --- a/src/protocol.js +++ b/src/protocol.js @@ -18,8 +18,8 @@ const {app} = require("electron"); const path = require("path"); const fs = require("fs"); -const PROTOCOL = "riot://"; -const SEARCH_PARAM = "riot-desktop-ssoid"; +const PROTOCOL = "element://"; +const SEARCH_PARAM = "element-desktop-ssoid"; const STORE_FILE_NAME = "sso-sessions.json"; // we getPath userData before electron-main changes it, so this is the default value @@ -61,10 +61,10 @@ module.exports = { }, getProfileFromDeeplink: (args) => { // check if we are passed a profile in the SSO callback url - const deeplinkUrl = args.find(arg => arg.startsWith('riot://')); + const deeplinkUrl = args.find(arg => arg.startsWith('element://')); if (deeplinkUrl && deeplinkUrl.includes(SEARCH_PARAM)) { const parsedUrl = new URL(deeplinkUrl); - if (parsedUrl.protocol === 'riot:') { + if (parsedUrl.protocol === 'element:') { const ssoID = parsedUrl.searchParams.get(SEARCH_PARAM); const store = readStore(); console.log("Forwarding to profile: ", store[ssoID]); @@ -78,10 +78,10 @@ module.exports = { // --profile/--profile-dir are passed via the SEARCH_PARAM var in the callback url const args = process.argv.slice(1).filter(arg => arg !== "--hidden" && arg !== "-hidden"); if (app.isPackaged) { - app.setAsDefaultProtocolClient('riot', process.execPath, args); + app.setAsDefaultProtocolClient('element', process.execPath, args); } else if (process.platform === 'win32') { // on Mac/Linux this would just cause the electron binary to open // special handler for running without being packaged, e.g `electron .` by passing our app path to electron - app.setAsDefaultProtocolClient('riot', process.execPath, [app.getAppPath(), ...args]); + app.setAsDefaultProtocolClient('element', process.execPath, [app.getAppPath(), ...args]); } if (process.platform === 'darwin') { diff --git a/src/tray.js b/src/tray.js index 04aaa1f..e235e77 100644 --- a/src/tray.js +++ b/src/tray.js @@ -88,7 +88,7 @@ exports.create = function(config) { // Windows likes ico's too much. if (process.platform === 'win32') { try { - const icoPath = path.join(app.getPath('temp'), 'win32_riot_icon.ico'); + const icoPath = path.join(app.getPath('temp'), 'win32_element_icon.ico'); fs.writeFileSync(icoPath, await pngToIco(newFavicon.toPNG())); newFavicon = nativeImage.createFromPath(icoPath); } catch (e) { diff --git a/src/vectormenu.js b/src/vectormenu.js index 987c1df..66fa573 100644 --- a/src/vectormenu.js +++ b/src/vectormenu.js @@ -62,8 +62,8 @@ const template = [ role: 'help', submenu: [ { - label: 'Riot Help', - click() { shell.openExternal('https://about.riot.im/help'); }, + label: 'Element Help', + click() { shell.openExternal('https://element.io/help'); }, }, ], }, diff --git a/src/webcontents-handler.js b/src/webcontents-handler.js index 00f971c..b9d2ec9 100644 --- a/src/webcontents-handler.js +++ b/src/webcontents-handler.js @@ -56,7 +56,7 @@ function onLinkContextMenu(ev, params) { // Avoid showing a context menu for app icons if (params.hasImageContents) return; // Rewrite URL so that it can be used outside of the app - url = "https://riot.im/app/" + url.substring(23); + url = "https://app.element.io/" + url.substring(23); } const popupMenu = new Menu();