Rebrand step 1: s/riot/element/ in the places where it's reasonably simple

This commit is contained in:
David Baker 2020-07-01 15:30:53 +01:00
parent a11feaca32
commit 466a871094
19 changed files with 52 additions and 220 deletions

View file

@ -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`.

6
element.io/README Normal file
View file

@ -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.

View file

@ -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"
]
}
]

View file

@ -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

View file

@ -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.

View file

@ -1,170 +0,0 @@
#!/bin/bash
usage() {
echo "Usage: $0 -v <version> -d <config directory> [-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"

View file

@ -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);

View file

@ -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:

View file

@ -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');

View file

@ -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') {

View file

@ -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) {

View file

@ -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'); },
},
],
},

View file

@ -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();