Compare commits
2 Commits
travis/thi
...
luke/stick
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
84c696de2e | ||
|
|
0e876fd213 |
4
.babelrc
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"presets": ["react", "es2015", "es2016"],
|
||||
"plugins": ["transform-class-properties", "transform-object-rest-spread", "transform-async-to-bluebird", "transform-runtime", "add-module-exports"]
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
# Exclude a bunch of stuff which can make the build context a larger than it needs to be
|
||||
test/
|
||||
webapp/
|
||||
lib/
|
||||
node_modules/
|
||||
karma-reports/
|
||||
.idea/
|
||||
.tmp/
|
||||
config.json*
|
||||
24
.eslintrc.js
@@ -1,23 +1,3 @@
|
||||
module.exports = {
|
||||
"extends": ["matrix-org", "matrix-org/react"],
|
||||
"env": {
|
||||
"browser": true,
|
||||
"node": true,
|
||||
},
|
||||
"rules": {
|
||||
"quotes": "off",
|
||||
},
|
||||
"overrides": [{
|
||||
"files": ["src/**/*.{ts,tsx}"],
|
||||
"extends": ["matrix-org/ts", "matrix-org/react"],
|
||||
"env": {
|
||||
"browser": true,
|
||||
},
|
||||
"rules": {
|
||||
"quotes": "off",
|
||||
// While converting to ts we allow this
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"prefer-promise-reject-errors": "off",
|
||||
},
|
||||
}],
|
||||
};
|
||||
extends: ["./node_modules/matrix-react-sdk/.eslintrc.js"],
|
||||
}
|
||||
|
||||
2
.github/FUNDING.yml
vendored
@@ -1,2 +0,0 @@
|
||||
patreon: matrixdotorg
|
||||
liberapay: matrixdotorg
|
||||
6
.github/ISSUE_TEMPLATE.md
vendored
@@ -1,5 +1,3 @@
|
||||
<!-- Please report security issues by email to security@matrix.org -->
|
||||
|
||||
<!-- This is a bug report template. By following the instructions below and
|
||||
filling out the sections with your information, you will help the us to get all
|
||||
the necessary data to fix your issue.
|
||||
@@ -38,9 +36,9 @@ For the web app:
|
||||
|
||||
- **Browser**: Chrome, Safari, Firefox? which version?
|
||||
- **OS**: Windows, macOS, Ubuntu, Arch Linux, etc?
|
||||
- **URL**: develop.element.io / app.element.io / somewhere else? If a private server, what version of Element Web?
|
||||
- **URL**: riot.im/develop / riot.im/app / somewhere else? If a private server, what version of riot-web?
|
||||
|
||||
For the desktop app:
|
||||
|
||||
- **OS**: Windows, macOS, Ubuntu, Arch Linux, etc?
|
||||
- **Version**: 1.x.y <!-- check the user settings panel if unsure -->
|
||||
- **Version**: 0.x.y <!-- check the user settings panel if unsure -->
|
||||
|
||||
56
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,56 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!-- Please report security issues by email to security@matrix.org -->
|
||||
|
||||
<!-- This is a bug report template. By following the instructions below and
|
||||
filling out the sections with your information, you will help the us to get all
|
||||
the necessary data to fix your issue.
|
||||
|
||||
You can also preview your report before submitting it. You may remove sections
|
||||
that aren't relevant to your particular case.
|
||||
|
||||
Text between <!-- and --> marks will be invisible in the report.
|
||||
-->
|
||||
|
||||
### Description
|
||||
|
||||
Describe here the problem that you are experiencing, or the feature you are requesting.
|
||||
|
||||
### Steps to reproduce
|
||||
|
||||
- For bugs, list the steps
|
||||
- that reproduce the bug
|
||||
- using hyphens as bullet points
|
||||
|
||||
Describe how what happens differs from what you expected.
|
||||
|
||||
<!-- Please send us logs for your bug report. They're very important for bugs
|
||||
which are hard to reproduce. To do this, create this issue then go to your
|
||||
account settings and click 'Submit Debug Logs' from the Help & About tab -->
|
||||
Logs being sent: yes/no
|
||||
|
||||
<!-- Include screenshots if possible: you can drag and drop images below. -->
|
||||
|
||||
### Version information
|
||||
|
||||
<!-- IMPORTANT: please answer the following questions, to help us narrow down the problem -->
|
||||
|
||||
- **Platform**: web (in-browser) or desktop?
|
||||
|
||||
For the web app:
|
||||
|
||||
- **Browser**: Chrome, Safari, Firefox? which version?
|
||||
- **OS**: Windows, macOS, Ubuntu, Arch Linux, etc?
|
||||
- **URL**: develop.element.io / app.element.io / somewhere else? If a private server, what version of Element Web?
|
||||
|
||||
For the desktop app:
|
||||
|
||||
- **OS**: Windows, macOS, Ubuntu, Arch Linux, etc?
|
||||
- **Version**: 1.x.y <!-- check the user settings panel if unsure -->
|
||||
@@ -1,20 +0,0 @@
|
||||
---
|
||||
name: Suggestion or Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: suggestion
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your suggestion related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
@@ -1,58 +0,0 @@
|
||||
---
|
||||
name: User Interface or Usability Bug report
|
||||
about: Please include screenshots in UI/UX bug reports
|
||||
title: ''
|
||||
labels: bug, ui/ux
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!-- A picture's worth a thousand words: PLEASE INCLUDE A SCREENSHOT :P -->
|
||||
|
||||
<!-- Please report security issues by email to security@matrix.org -->
|
||||
|
||||
<!-- This is a bug report template. By following the instructions below and
|
||||
filling out the sections with your information, you will help the us to get all
|
||||
the necessary data to fix your issue.
|
||||
|
||||
You can also preview your report before submitting it. You may remove sections
|
||||
that aren't relevant to your particular case.
|
||||
|
||||
Text between <!-- and --> marks will be invisible in the report.
|
||||
-->
|
||||
|
||||
### Description
|
||||
|
||||
Describe here the problem that you are experiencing, or the feature you are requesting.
|
||||
|
||||
### Steps to reproduce
|
||||
|
||||
- For bugs, list the steps
|
||||
- that reproduce the bug
|
||||
- using hyphens as bullet points
|
||||
|
||||
Describe how what happens differs from what you expected.
|
||||
|
||||
<!-- Please send us logs for your bug report. They're very important for bugs
|
||||
which are hard to reproduce. To do this, create this issue then go to your
|
||||
account settings and click 'Submit Debug Logs' from the Help & About tab -->
|
||||
Logs being sent: yes/no
|
||||
|
||||
<!-- Include screenshots if possible: you can drag and drop images below. -->
|
||||
|
||||
### Version information
|
||||
|
||||
<!-- IMPORTANT: please answer the following questions, to help us narrow down the problem -->
|
||||
|
||||
- **Platform**: web (in-browser) or desktop?
|
||||
|
||||
For the web app:
|
||||
|
||||
- **Browser**: Chrome, Safari, Firefox? which version?
|
||||
- **OS**: Windows, macOS, Ubuntu, Arch Linux, etc?
|
||||
- **URL**: develop.element.io / app.element.io / somewhere else? If a private server, what version of Element Web?
|
||||
|
||||
For the desktop app:
|
||||
|
||||
- **OS**: Windows, macOS, Ubuntu, Arch Linux, etc?
|
||||
- **Version**: 1.x.y <!-- check the user settings panel if unsure -->
|
||||
10
.gitignore
vendored
@@ -1,21 +1,19 @@
|
||||
/build
|
||||
/cert.pem
|
||||
/dist
|
||||
/karma-reports
|
||||
/key.pem
|
||||
/lib
|
||||
/node_modules
|
||||
/electron_app/node_modules
|
||||
/electron_app/dist
|
||||
/packages/
|
||||
/webapp
|
||||
/.npmrc
|
||||
/*.log
|
||||
package-lock.json
|
||||
.DS_Store
|
||||
npm-debug.log
|
||||
electron/dist
|
||||
electron/pub
|
||||
**/.idea
|
||||
/config.json
|
||||
/config.json.*
|
||||
/config.local*.json
|
||||
/src/component-index.js
|
||||
/.tmp
|
||||
/webpack-stats.json
|
||||
|
||||
@@ -5,34 +5,12 @@
|
||||
"setClasses"
|
||||
],
|
||||
"feature-detects": [
|
||||
"test/css/animations",
|
||||
"test/css/displaytable",
|
||||
"test/css/filters",
|
||||
"test/css/flexbox",
|
||||
"test/es5/specification",
|
||||
"test/css/objectfit",
|
||||
|
||||
"test/es5/date",
|
||||
"test/es5/function",
|
||||
"test/es5/object",
|
||||
"test/es5/undefined",
|
||||
|
||||
"test/es6/array",
|
||||
"test/es6/collections",
|
||||
"test/es6/promises",
|
||||
"test/es6/string",
|
||||
|
||||
"test/svg",
|
||||
"test/svg/asimg",
|
||||
"test/svg/filters",
|
||||
|
||||
"test/url/parser",
|
||||
"test/url/urlsearchparams",
|
||||
|
||||
"test/cors",
|
||||
"test/crypto",
|
||||
"test/iframe/sandbox",
|
||||
"test/json",
|
||||
"test/network/fetch",
|
||||
"test/storage/localstorage"
|
||||
"test/storage/localstorage",
|
||||
"test/workers/webworkers",
|
||||
"test/indexeddb"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
// Copied from react-sdk
|
||||
// TODO: Only keep one copy of this for synchronization purposes
|
||||
module.exports = {
|
||||
"extends": "stylelint-config-standard",
|
||||
"plugins": [
|
||||
"stylelint-scss",
|
||||
],
|
||||
"rules": {
|
||||
"indentation": 4,
|
||||
"comment-empty-line-before": null,
|
||||
"declaration-empty-line-before": null,
|
||||
"length-zero-no-unit": null,
|
||||
"rule-empty-line-before": null,
|
||||
"color-hex-length": null,
|
||||
"max-empty-lines": null,
|
||||
"number-no-trailing-zeros": null,
|
||||
"number-leading-zero": null,
|
||||
"selector-list-comma-newline-after": null,
|
||||
"at-rule-no-unknown": null,
|
||||
"no-descending-specificity": null,
|
||||
"scss/at-rule-no-unknown": [true, {
|
||||
// https://github.com/vector-im/element-web/issues/10544
|
||||
"ignoreAtRules": ["define-mixin"],
|
||||
}],
|
||||
}
|
||||
};
|
||||
32
.travis.yml
Normal file
@@ -0,0 +1,32 @@
|
||||
# we need trusty for the chrome addon
|
||||
dist: trusty
|
||||
|
||||
# we don't need sudo, so can run in a container, which makes startup much
|
||||
# quicker.
|
||||
sudo: false
|
||||
|
||||
language: node_js
|
||||
node_js:
|
||||
# make sure we work with a range of node versions.
|
||||
# As of the time of writing:
|
||||
# - 4.x is still in LTS (until April 2018), but some of our deps (notably
|
||||
# extract-zip) don't work with it
|
||||
# - 5.x has been EOLed for nearly a year.
|
||||
# - 6.x is the active 'LTS' version
|
||||
# - 7.x is no longer supported
|
||||
# - 8.x is the current 'current' version (until October 2017)
|
||||
#
|
||||
# see: https://github.com/nodejs/LTS/
|
||||
#
|
||||
# anything before 6.3 ships with npm 3.9 or earlier, which had problems
|
||||
# with symlinks in node_modules (see
|
||||
# https://github.com/npm/npm/releases/tag/v3.10.0 'FIXES AND REFACTORING').
|
||||
- 6.3
|
||||
- 6
|
||||
- 7
|
||||
addons:
|
||||
chrome: stable
|
||||
install:
|
||||
# clone the deps with depth 1: we know we will only ever need that one
|
||||
# commit.
|
||||
- scripts/fetch-develop.deps.sh --depth 1 && npm install
|
||||
@@ -13,9 +13,3 @@ include:
|
||||
|
||||
* Michael Telatynski (https://github.com/t3chguy)
|
||||
Improved consistency of inverted elements in dark theme across browsers
|
||||
|
||||
* Alexandr Korsak (https://github.com/oivoodoo)
|
||||
Improved multiple file uploading
|
||||
|
||||
* Thom Cleary (https://github.com/thomcatdotrocks)
|
||||
Small update for tarball deployment
|
||||
|
||||
3190
CHANGELOG.md
@@ -1,4 +1,4 @@
|
||||
Contributing code to Element
|
||||
============================
|
||||
Contributing code to Riot
|
||||
=========================
|
||||
|
||||
Element follows the same pattern as https://github.com/matrix-org/matrix-js-sdk/blob/master/CONTRIBUTING.rst.
|
||||
Riot follows the same pattern as https://github.com/matrix-org/synapse/blob/master/CONTRIBUTING.rst.
|
||||
|
||||
40
Dockerfile
@@ -1,40 +0,0 @@
|
||||
# Builder
|
||||
FROM node:14-buster as builder
|
||||
|
||||
# Support custom branches of the react-sdk and js-sdk. This also helps us build
|
||||
# images of element-web develop.
|
||||
ARG USE_CUSTOM_SDKS=false
|
||||
ARG REACT_SDK_REPO="https://github.com/matrix-org/matrix-react-sdk.git"
|
||||
ARG REACT_SDK_BRANCH="master"
|
||||
ARG JS_SDK_REPO="https://github.com/matrix-org/matrix-js-sdk.git"
|
||||
ARG JS_SDK_BRANCH="master"
|
||||
|
||||
RUN apt-get update && apt-get install -y git dos2unix \
|
||||
# These packages are required for building Canvas on architectures like Arm
|
||||
# See https://www.npmjs.com/package/canvas#compiling
|
||||
build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
COPY . /src
|
||||
RUN dos2unix /src/scripts/docker-link-repos.sh && bash /src/scripts/docker-link-repos.sh
|
||||
RUN yarn --network-timeout=100000 install
|
||||
RUN yarn build
|
||||
|
||||
# Copy the config now so that we don't create another layer in the app image
|
||||
RUN cp /src/config.sample.json /src/webapp/config.json
|
||||
|
||||
# Ensure we populate the version file
|
||||
RUN dos2unix /src/scripts/docker-write-version.sh && bash /src/scripts/docker-write-version.sh
|
||||
|
||||
|
||||
# App
|
||||
FROM nginx:alpine
|
||||
|
||||
COPY --from=builder /src/webapp /app
|
||||
|
||||
# Insert wasm type into Nginx mime.types file so they load correctly.
|
||||
RUN sed -i '3i\ \ \ \ application/wasm wasm\;' /etc/nginx/mime.types
|
||||
|
||||
RUN rm -rf /usr/share/nginx/html \
|
||||
&& ln -s /app /usr/share/nginx/html
|
||||
538
README.md
@@ -1,357 +1,285 @@
|
||||
Element
|
||||
=======
|
||||
Riot
|
||||
====
|
||||
|
||||
Element (formerly known as Vector and Riot) is a Matrix web client built using the [Matrix
|
||||
React SDK](https://github.com/matrix-org/matrix-react-sdk).
|
||||
|
||||
Supported Environments
|
||||
======================
|
||||
|
||||
Element has several tiers of support for different environments:
|
||||
|
||||
* Supported
|
||||
* Definition: Issues **actively triaged**, regressions **block** the release
|
||||
* Last 2 major versions of Chrome, Firefox, and Safari on desktop OSes
|
||||
* Latest release of official Element Desktop app on desktop OSes
|
||||
* Desktop OSes means macOS, Windows, and Linux versions for desktop devices
|
||||
that are actively supported by the OS vendor and receive security updates
|
||||
* Experimental
|
||||
* Definition: Issues **accepted**, regressions **do not block** the release
|
||||
* Element as an installed PWA via current stable version of Chrome, Firefox, and Safari
|
||||
* Mobile web for current stable version of Chrome, Firefox, and Safari on Android, iOS, and iPadOS
|
||||
* Not supported
|
||||
* Definition: Issues only affecting unsupported environments are **closed**
|
||||
* Everything else
|
||||
|
||||
For accessing Element on an Android or iOS device, we currently recommend the
|
||||
native apps [element-android](https://github.com/vector-im/element-android)
|
||||
and [element-ios](https://github.com/vector-im/element-ios).
|
||||
Riot (formerly known as Vector) is a Matrix web client built using the Matrix
|
||||
React SDK (https://github.com/matrix-org/matrix-react-sdk).
|
||||
|
||||
Getting Started
|
||||
===============
|
||||
|
||||
The easiest way to test Element is to just use the hosted copy at https://app.element.io.
|
||||
The `develop` branch is continuously deployed to https://develop.element.io
|
||||
for those who like living dangerously.
|
||||
The easiest way to test Riot is to just use the hosted copy at
|
||||
https://riot.im/app. The develop branch is continuously deployed by Jenkins at
|
||||
https://riot.im/develop for those who like living dangerously.
|
||||
|
||||
To host your own copy of Element, the quickest bet is to use a pre-built
|
||||
released version of Element:
|
||||
To host your own copy of Riot, the quickest bet is to use a pre-built
|
||||
released version of Riot:
|
||||
|
||||
1. Download the latest version from https://github.com/vector-im/element-web/releases
|
||||
1. Download the latest version from https://github.com/vector-im/riot-web/releases
|
||||
1. Untar the tarball on your web server
|
||||
1. Move (or symlink) the `element-x.x.x` directory to an appropriate name
|
||||
1. Configure the correct caching headers in your webserver (see below)
|
||||
1. Move (or symlink) the vector-x.x.x directory to an appropriate name
|
||||
1. If desired, copy `config.sample.json` to `config.json` and edit it
|
||||
as desired. See the [configuration docs](docs/config.md) for details.
|
||||
1. Enter the URL into your browser and log into Element!
|
||||
as desired. See below for details.
|
||||
1. Enter the URL into your browser and log into Riot!
|
||||
|
||||
Releases are signed using gpg and the OpenPGP standard, and can be checked against the public key located
|
||||
at https://packages.riot.im/element-release-key.asc.
|
||||
Releases are signed by PGP, and can be checked against the public key
|
||||
at https://riot.im/packages/keys/riot.asc
|
||||
|
||||
Note that for the security of your chats will need to serve Element
|
||||
over HTTPS. Major browsers also do not allow you to use VoIP/video
|
||||
chats over HTTP, as WebRTC is only usable over HTTPS.
|
||||
There are some exceptions like when using localhost, which is
|
||||
considered a [secure context](https://developer.mozilla.org/docs/Web/Security/Secure_Contexts)
|
||||
and thus allowed.
|
||||
Note that Chrome does not allow microphone or webcam access for sites served
|
||||
over http (except localhost), so for working VoIP you will need to serve Riot
|
||||
over https.
|
||||
|
||||
To install Element as a desktop application, see [Running as a desktop
|
||||
app](#running-as-a-desktop-app) below.
|
||||
### Installation Steps for Debian Stretch
|
||||
1. Add the repository to your sources.list using either of the following two options:
|
||||
- Directly to sources.list: `echo "deb https://riot.im/packages/debian/ stretch main" | sudo tee -a /etc/apt/sources.list`
|
||||
- As a separate entry in sources.list.d: `echo "deb https://riot.im/packages/debian/ stretch main" | sudo tee /etc/apt/sources.list.d/riot.list`
|
||||
2. Add the gpg signing key for the riot repository: `curl -s https://riot.im/packages/debian/repo-key.asc | sudo apt-key add -`
|
||||
3. Update your package lists: `sudo apt-get update`
|
||||
4. Install Riot: `sudo apt-get install riot-web`
|
||||
|
||||
Important Security Notes
|
||||
========================
|
||||
Important Security Note
|
||||
=======================
|
||||
|
||||
Separate domains
|
||||
----------------
|
||||
|
||||
We do not recommend running Element from the same domain name as your Matrix
|
||||
We do not recommend running Riot from the same domain name as your Matrix
|
||||
homeserver. The reason is the risk of XSS (cross-site-scripting)
|
||||
vulnerabilities that could occur if someone caused Element to load and render
|
||||
vulnerabilities that could occur if someone caused Riot to load and render
|
||||
malicious user generated content from a Matrix API which then had trusted
|
||||
access to Element (or other apps) due to sharing the same domain.
|
||||
access to Riot (or other apps) due to sharing the same domain.
|
||||
|
||||
We have put some coarse mitigations into place to try to protect against this
|
||||
situation, but it's still not good practice to do it in the first place. See
|
||||
https://github.com/vector-im/element-web/issues/1977 for more details.
|
||||
|
||||
Configuration best practices
|
||||
----------------------------
|
||||
|
||||
Unless you have special requirements, you will want to add the following to
|
||||
your web server configuration when hosting Element Web:
|
||||
|
||||
- The `X-Frame-Options: SAMEORIGIN` header, to prevent Element Web from being
|
||||
framed and protect from [clickjacking][owasp-clickjacking].
|
||||
- The `frame-ancestors 'none'` directive to your `Content-Security-Policy`
|
||||
header, as the modern replacement for `X-Frame-Options` (though both should be
|
||||
included since not all browsers support it yet, see
|
||||
[this][owasp-clickjacking-csp]).
|
||||
- The `X-Content-Type-Options: nosniff` header, to [disable MIME
|
||||
sniffing][mime-sniffing].
|
||||
- The `X-XSS-Protection: 1; mode=block;` header, for basic XSS protection in
|
||||
legacy browsers.
|
||||
|
||||
[mime-sniffing]:
|
||||
<https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#mime_sniffing>
|
||||
|
||||
[owasp-clickjacking-csp]:
|
||||
<https://cheatsheetseries.owasp.org/cheatsheets/Clickjacking_Defense_Cheat_Sheet.html#content-security-policy-frame-ancestors-examples>
|
||||
|
||||
[owasp-clickjacking]:
|
||||
<https://cheatsheetseries.owasp.org/cheatsheets/Clickjacking_Defense_Cheat_Sheet.html>
|
||||
|
||||
If you are using nginx, this would look something like the following:
|
||||
|
||||
```
|
||||
add_header X-Frame-Options SAMEORIGIN;
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
add_header X-XSS-Protection "1; mode=block";
|
||||
add_header Content-Security-Policy "frame-ancestors 'none'";
|
||||
```
|
||||
|
||||
Note: In case you are already setting a `Content-Security-Policy` header
|
||||
elsewhere, you should modify it to include the `frame-ancestors` directive
|
||||
instead of adding that last line.
|
||||
https://github.com/vector-im/riot-web/issues/1977 for more details.
|
||||
|
||||
Building From Source
|
||||
====================
|
||||
|
||||
Element is a modular webapp built with modern ES6 and uses a Node.js build system.
|
||||
Ensure you have the latest LTS version of Node.js installed.
|
||||
Riot is a modular webapp built with modern ES6 and requires a npm build system
|
||||
to build.
|
||||
|
||||
Using `yarn` instead of `npm` is recommended. Please see the Yarn [install
|
||||
guide](https://classic.yarnpkg.com/en/docs/install) if you do not have it already.
|
||||
|
||||
1. Install or update `node.js` so that your `node` is at least v10.x.
|
||||
1. Install `yarn` if not present already.
|
||||
1. Clone the repo: `git clone https://github.com/vector-im/element-web.git`.
|
||||
1. Switch to the element-web directory: `cd element-web`.
|
||||
1. Install the prerequisites: `yarn install`.
|
||||
* If you're using the `develop` branch, then it is recommended to set up a
|
||||
proper development environment (see [Setting up a dev
|
||||
environment](#setting-up-a-dev-environment) below). Alternatively, you
|
||||
can use https://develop.element.io - the continuous integration release of
|
||||
the develop branch.
|
||||
1. Install or update `node.js` so that your `node` is at least v6.3.0 (and `npm`
|
||||
is at least v3.10.x).
|
||||
1. Clone the repo: `git clone https://github.com/vector-im/riot-web.git`.
|
||||
1. Switch to the riot-web directory: `cd riot-web`.
|
||||
1. If you're using the `develop` branch, install the develop versions of the
|
||||
dependencies, as the released ones will be too old:
|
||||
```
|
||||
scripts/fetch-develop.deps.sh
|
||||
```
|
||||
Whenever you git pull on riot-web you will also probably need to force an update
|
||||
to these dependencies - the simplest way is to re-run the script, but you can also
|
||||
manually update and rebuild them:
|
||||
```
|
||||
cd matrix-js-sdk
|
||||
git pull
|
||||
npm install # re-run to pull in any new dependencies
|
||||
# Depending on your version of npm, npm run build may happen as part of
|
||||
# the npm install above (https://docs.npmjs.com/misc/scripts#prepublish-and-prepare)
|
||||
# If in doubt, run it anyway:
|
||||
npm run build
|
||||
cd ../matrix-react-sdk
|
||||
git pull
|
||||
npm install
|
||||
npm run build
|
||||
```
|
||||
However, we recommend setting up a proper development environment (see "Setting
|
||||
up a dev environment" below) if you want to run your own copy of the
|
||||
`develop` branch, as it makes it much easier to keep these dependencies
|
||||
up-to-date. Or just use https://riot.im/develop - the continuous integration
|
||||
release of the develop branch.
|
||||
(Note that we don't reference the develop versions in git directly due to
|
||||
https://github.com/npm/npm/issues/3055.)
|
||||
1. Install the prerequisites: `npm install`.
|
||||
1. Configure the app by copying `config.sample.json` to `config.json` and
|
||||
modifying it. See the [configuration docs](docs/config.md) for details.
|
||||
1. `yarn dist` to build a tarball to deploy. Untaring this file will give
|
||||
modifying it (see below for details).
|
||||
1. `npm run dist` to build a tarball to deploy. Untaring this file will give
|
||||
a version-specific directory containing all the files that need to go on your
|
||||
web server.
|
||||
|
||||
Note that `yarn dist` is not supported on Windows, so Windows users can run `yarn build`,
|
||||
which will build all the necessary files into the `webapp` directory. The version of Element
|
||||
will not appear in Settings without using the dist script. You can then mount the
|
||||
`webapp` directory on your web server to actually serve up the app, which is
|
||||
entirely static content.
|
||||
|
||||
Running as a Desktop app
|
||||
========================
|
||||
|
||||
Element can also be run as a desktop app, wrapped in Electron. You can download a
|
||||
pre-built version from https://element.io/get-started or, if you prefer,
|
||||
build it yourself.
|
||||
|
||||
To build it yourself, follow the instructions at https://github.com/vector-im/element-desktop.
|
||||
|
||||
Many thanks to @aviraldg for the initial work on the Electron integration.
|
||||
|
||||
Other options for running as a desktop app:
|
||||
* @asdf:matrix.org points out that you can use nativefier and it just works(tm)
|
||||
|
||||
```bash
|
||||
yarn global add nativefier
|
||||
nativefier https://app.element.io/
|
||||
```
|
||||
|
||||
The [configuration docs](docs/config.md#desktop-app-configuration) show how to
|
||||
override the desktop app's default settings if desired.
|
||||
|
||||
Running from Docker
|
||||
===================
|
||||
|
||||
The Docker image can be used to serve element-web as a web server. The easiest way to use
|
||||
it is to use the prebuilt image:
|
||||
```bash
|
||||
docker run -p 80:80 vectorim/element-web
|
||||
```
|
||||
|
||||
To supply your own custom `config.json`, map a volume to `/app/config.json`. For example,
|
||||
if your custom config was located at `/etc/element-web/config.json` then your Docker command
|
||||
would be:
|
||||
```bash
|
||||
docker run -p 80:80 -v /etc/element-web/config.json:/app/config.json vectorim/element-web
|
||||
```
|
||||
|
||||
To build the image yourself:
|
||||
```bash
|
||||
git clone https://github.com/vector-im/element-web.git element-web
|
||||
cd element-web
|
||||
git checkout master
|
||||
docker build .
|
||||
```
|
||||
|
||||
If you're building a custom branch, or want to use the develop branch, check out the appropriate
|
||||
element-web branch and then run:
|
||||
```bash
|
||||
docker build -t \
|
||||
--build-arg USE_CUSTOM_SDKS=true \
|
||||
--build-arg REACT_SDK_REPO="https://github.com/matrix-org/matrix-react-sdk.git" \
|
||||
--build-arg REACT_SDK_BRANCH="develop" \
|
||||
--build-arg JS_SDK_REPO="https://github.com/matrix-org/matrix-js-sdk.git" \
|
||||
--build-arg JS_SDK_BRANCH="develop" \
|
||||
.
|
||||
```
|
||||
Note that `npm run dist` is not supported on Windows, so Windows users can run `npm
|
||||
run build`, which will build all the necessary files into the `webapp`
|
||||
directory. The version of Riot will not appear in Settings without
|
||||
using the dist script. You can then mount the `webapp` directory on your
|
||||
webserver to actually serve up the app, which is entirely static content.
|
||||
|
||||
config.json
|
||||
===========
|
||||
|
||||
Element supports a variety of settings to configure default servers, behaviour, themes, etc.
|
||||
See the [configuration docs](docs/config.md) for more details.
|
||||
You can configure the app by copying `config.sample.json` to
|
||||
`config.json` and customising it:
|
||||
|
||||
Labs Features
|
||||
=============
|
||||
1. `default_hs_url` is the default home server url.
|
||||
1. `default_is_url` is the default identity server url (this is the server used
|
||||
for verifying third party identifiers like email addresses). If this is blank,
|
||||
registering with an email address, adding an email address to your account,
|
||||
or inviting users via email address will not work. Matrix identity servers are
|
||||
very simple web services which map third party identifiers (currently only email
|
||||
addresses) to matrix IDs: see http://matrix.org/docs/spec/identity_service/unstable.html
|
||||
for more details. Currently the only public matrix identity servers are https://matrix.org
|
||||
and https://vector.im. In future identity servers will be decentralised.
|
||||
1. `integrations_ui_url`: URL to the web interface for the integrations server.
|
||||
1. `integrations_rest_url`: URL to the REST interface for the integrations server.
|
||||
1. `roomDirectory`: config for the public room directory. This section is optional.
|
||||
1. `roomDirectory.servers`: List of other Home Servers' directories to include in the drop
|
||||
down list. Optional.
|
||||
1. `update_base_url` (electron app only): HTTPS URL to a web server to download
|
||||
updates from. This should be the path to the directory containing `macos`
|
||||
and `win32` (for update packages, not installer packages).
|
||||
1. `cross_origin_renderer_url`: URL to a static HTML page hosting code to help display
|
||||
encrypted file attachments. This MUST be hosted on a completely separate domain to
|
||||
anything else since it is used to isolate the privileges of file attachments to this
|
||||
domain. Default: `usercontent.riot.im`. This needs to contain v1.html from
|
||||
https://github.com/matrix-org/usercontent/blob/master/v1.html
|
||||
|
||||
Some features of Element may be enabled by flags in the `Labs` section of the settings.
|
||||
Some of these features are described in [labs.md](https://github.com/vector-im/element-web/blob/develop/docs/labs.md).
|
||||
Running as a Desktop app
|
||||
========================
|
||||
|
||||
Caching requirements
|
||||
====================
|
||||
Riot can also be run as a desktop app, wrapped in electron. You can download a
|
||||
pre-built version from https://riot.im/desktop.html or, if you prefer,
|
||||
build it yourself. Requires Electron >=1.6.0
|
||||
|
||||
Element requires the following URLs not to be cached, when/if you are serving Element from your own webserver:
|
||||
To run as a desktop app:
|
||||
|
||||
1. Follow the instructions in 'Building From Source' above, but run
|
||||
`npm run build` instead of `npm run dist` (since we don't need the tarball).
|
||||
2. Install electron and run it:
|
||||
|
||||
```
|
||||
npm install electron
|
||||
npm run electron
|
||||
```
|
||||
|
||||
To build packages, use electron-builder. This is configured to output:
|
||||
* dmg + zip for macOS
|
||||
* exe + nupkg for Windows
|
||||
* deb for Linux
|
||||
But this can be customised by editing the `build` section of package.json
|
||||
as per https://github.com/electron-userland/electron-builder/wiki/Options
|
||||
|
||||
See https://github.com/electron-userland/electron-builder/wiki/Multi-Platform-Build
|
||||
for dependencies required for building packages for various platforms.
|
||||
|
||||
The only platform that can build packages for all three platforms is macOS:
|
||||
```
|
||||
/config.*.json
|
||||
/i18n
|
||||
/home
|
||||
/sites
|
||||
/index.html
|
||||
brew install wine --without-x11
|
||||
brew install mono
|
||||
brew install gnu-tar
|
||||
npm install
|
||||
npm run build:electron
|
||||
```
|
||||
|
||||
For other packages, use electron-builder manually. For example, to build a package
|
||||
for 64 bit Linux:
|
||||
|
||||
1. Follow the instructions in 'Building From Source' above
|
||||
2. `node_modules/.bin/build -l --x64`
|
||||
|
||||
All electron packages go into `electron/dist/`
|
||||
|
||||
Many thanks to @aviraldg for the initial work on the electron integration.
|
||||
|
||||
Other options for running as a desktop app:
|
||||
* https://github.com/krisak/vector-electron-desktop
|
||||
* @asdf:matrix.org points out that you can use nativefier and it just works(tm)
|
||||
|
||||
```
|
||||
sudo npm install nativefier -g
|
||||
nativefier https://riot.im/app/
|
||||
```
|
||||
|
||||
Development
|
||||
===========
|
||||
|
||||
Before attempting to develop on Element you **must** read the [developer guide
|
||||
for `matrix-react-sdk`](https://github.com/matrix-org/matrix-react-sdk#developer-guide), which
|
||||
also defines the design, architecture and style for Element too.
|
||||
Before attempting to develop on Riot you **must** read the developer guide
|
||||
for `matrix-react-sdk` at https://github.com/matrix-org/matrix-react-sdk, which
|
||||
also defines the design, architecture and style for Riot too.
|
||||
|
||||
Before starting work on a feature, it's best to ensure your plan aligns well
|
||||
with our vision for Element. Please chat with the team in
|
||||
[#element-dev:matrix.org](https://matrix.to/#/#element-dev:matrix.org) before you
|
||||
start so we can ensure it's something we'd be willing to merge.
|
||||
|
||||
You should also familiarise yourself with the ["Here be Dragons" guide
|
||||
](https://docs.google.com/document/d/12jYzvkidrp1h7liEuLIe6BMdU0NUjndUYI971O06ooM)
|
||||
to the tame & not-so-tame dragons (gotchas) which exist in the codebase.
|
||||
|
||||
The idea of Element is to be a relatively lightweight "skin" of customisations on
|
||||
The idea of Riot is to be a relatively lightweight "skin" of customisations on
|
||||
top of the underlying `matrix-react-sdk`. `matrix-react-sdk` provides both the
|
||||
higher and lower level React components useful for building Matrix communication
|
||||
apps using React.
|
||||
|
||||
After creating a new component you must run `yarn reskindex` to regenerate
|
||||
the `component-index.js` for the app (used in future for skinning).
|
||||
After creating a new component you must run `npm run reskindex` to regenerate
|
||||
the `component-index.js` for the app (used in future for skinning)
|
||||
|
||||
Please note that Element is intended to run correctly without access to the public
|
||||
**However, as of July 2016 this layering abstraction is broken due to rapid
|
||||
development on Riot forcing `matrix-react-sdk` to move fast at the expense of
|
||||
maintaining a clear abstraction between the two.** Hacking on Riot inevitably
|
||||
means hacking equally on `matrix-react-sdk`, and there are bits of
|
||||
`matrix-react-sdk` behaviour incorrectly residing in the `riot-web` project
|
||||
(e.g. matrix-react-sdk specific CSS), and a bunch of Riot specific behaviour
|
||||
in the `matrix-react-sdk` (grep for `vector` / `riot`). This separation problem will be
|
||||
solved asap once development on Riot (and thus matrix-react-sdk) has
|
||||
stabilised. Until then, the two projects should basically be considered as a
|
||||
single unit. In particular, `matrix-react-sdk` issues are currently filed
|
||||
against `riot-web` in github.
|
||||
|
||||
Please note that Riot is intended to run correctly without access to the public
|
||||
internet. So please don't depend on resources (JS libs, CSS, images, fonts)
|
||||
hosted by external CDNs or servers but instead please package all dependencies
|
||||
into Element itself.
|
||||
into Riot itself.
|
||||
|
||||
Setting up a dev environment
|
||||
============================
|
||||
|
||||
Much of the functionality in Element is actually in the `matrix-react-sdk` and
|
||||
Much of the functionality in Riot is actually in the `matrix-react-sdk` and
|
||||
`matrix-js-sdk` modules. It is possible to set these up in a way that makes it
|
||||
easy to track the `develop` branches in git and to make local changes without
|
||||
having to manually rebuild each time.
|
||||
|
||||
First clone and build `matrix-js-sdk`:
|
||||
|
||||
``` bash
|
||||
git clone https://github.com/matrix-org/matrix-js-sdk.git
|
||||
pushd matrix-js-sdk
|
||||
yarn link
|
||||
yarn install
|
||||
popd
|
||||
```
|
||||
1. `git clone git@github.com:matrix-org/matrix-js-sdk.git`
|
||||
1. `pushd matrix-js-sdk`
|
||||
1. `git checkout develop`
|
||||
1. `npm install`
|
||||
1. `npm install source-map-loader` # because webpack is made of fail (https://github.com/webpack/webpack/issues/1472)
|
||||
1. `popd`
|
||||
|
||||
Then similarly with `matrix-react-sdk`:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/matrix-org/matrix-react-sdk.git
|
||||
pushd matrix-react-sdk
|
||||
yarn link
|
||||
yarn link matrix-js-sdk
|
||||
yarn install
|
||||
popd
|
||||
```
|
||||
1. `git clone git@github.com:matrix-org/matrix-react-sdk.git`
|
||||
1. `pushd matrix-react-sdk`
|
||||
1. `git checkout develop`
|
||||
1. `npm install`
|
||||
1. `rm -r node_modules/matrix-js-sdk; ln -s ../../matrix-js-sdk node_modules/`
|
||||
1. `popd`
|
||||
|
||||
Finally, build and start Element itself:
|
||||
Finally, build and start Riot itself:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/vector-im/element-web.git
|
||||
cd element-web
|
||||
yarn link matrix-js-sdk
|
||||
yarn link matrix-react-sdk
|
||||
yarn install
|
||||
yarn start
|
||||
```
|
||||
|
||||
|
||||
Wait a few seconds for the initial build to finish; you should see something like:
|
||||
```
|
||||
Hash: b0af76309dd56d7275c8
|
||||
Version: webpack 1.12.14
|
||||
Time: 14533ms
|
||||
Asset Size Chunks Chunk Names
|
||||
bundle.js 4.2 MB 0 [emitted] main
|
||||
bundle.css 91.5 kB 0 [emitted] main
|
||||
bundle.js.map 5.29 MB 0 [emitted] main
|
||||
bundle.css.map 116 kB 0 [emitted] main
|
||||
+ 1013 hidden modules
|
||||
```
|
||||
1. `git clone git@github.com:vector-im/riot-web.git`
|
||||
1. `cd riot-web`
|
||||
1. `git checkout develop`
|
||||
1. `npm install`
|
||||
1. `rm -r node_modules/matrix-js-sdk; ln -s ../../matrix-js-sdk node_modules/`
|
||||
1. `rm -r node_modules/matrix-react-sdk; ln -s ../../matrix-react-sdk node_modules/`
|
||||
1. `npm start`
|
||||
1. Wait a few seconds for the initial build to finish; you should see something like:
|
||||
```
|
||||
Hash: b0af76309dd56d7275c8
|
||||
Version: webpack 1.12.14
|
||||
Time: 14533ms
|
||||
Asset Size Chunks Chunk Names
|
||||
bundle.js 4.2 MB 0 [emitted] main
|
||||
bundle.css 91.5 kB 0 [emitted] main
|
||||
bundle.js.map 5.29 MB 0 [emitted] main
|
||||
bundle.css.map 116 kB 0 [emitted] main
|
||||
+ 1013 hidden modules
|
||||
```
|
||||
Remember, the command will not terminate since it runs the web server
|
||||
and rebuilds source files when they change. This development server also
|
||||
disables caching, so do NOT use it in production.
|
||||
1. Open http://127.0.0.1:8080/ in your browser to see your newly built Riot.
|
||||
|
||||
Configure the app by copying `config.sample.json` to `config.json` and
|
||||
modifying it. See the [configuration docs](docs/config.md) for details.
|
||||
When you make changes to `matrix-react-sdk` or `matrix-js-sdk`, you will need
|
||||
to run `npm run build` in the relevant directory. You can do this automatically
|
||||
by instead running `npm start` in the directory, to start a development builder
|
||||
which will watch for changes to the files and rebuild automatically.
|
||||
|
||||
Open http://127.0.0.1:8080/ in your browser to see your newly built Element.
|
||||
|
||||
**Note**: The build script uses inotify by default on Linux to monitor directories
|
||||
for changes. If the inotify limits are too low your build will fail silently or with
|
||||
`Error: EMFILE: too many open files`. To avoid these issues, we recommend a watch limit
|
||||
of at least `128M` and instance limit around `512`.
|
||||
|
||||
You may be interested in issues [#15750](https://github.com/vector-im/element-web/issues/15750) and
|
||||
[#15774](https://github.com/vector-im/element-web/issues/15774) for further details.
|
||||
|
||||
To set a new inotify watch and instance limit, execute:
|
||||
|
||||
```
|
||||
sudo sysctl fs.inotify.max_user_watches=131072
|
||||
sudo sysctl fs.inotify.max_user_instances=512
|
||||
sudo sysctl -p
|
||||
```
|
||||
|
||||
If you wish, you can make the new limits permanent, by executing:
|
||||
|
||||
```
|
||||
echo fs.inotify.max_user_watches=131072 | sudo tee -a /etc/sysctl.conf
|
||||
echo fs.inotify.max_user_instances=512 | sudo tee -a /etc/sysctl.conf
|
||||
sudo sysctl -p
|
||||
```
|
||||
|
||||
___
|
||||
|
||||
When you make changes to `matrix-react-sdk` or `matrix-js-sdk` they should be
|
||||
automatically picked up by webpack and built.
|
||||
|
||||
If you add or remove any components from the Element skin, you will need to rebuild
|
||||
the skin's index by running, `yarn reskindex`.
|
||||
If you add or remove any components from the Riot skin, you will need to rebuild
|
||||
the skin's index by running, `npm run reskindex`.
|
||||
|
||||
If any of these steps error with, `file table overflow`, you are probably on a mac
|
||||
which has a very low limit on max open files. Run `ulimit -Sn 1024` and try again.
|
||||
You'll need to do this in each new terminal you open before building Element.
|
||||
You'll need to do this in each new terminal you open before building Riot.
|
||||
|
||||
Running the tests
|
||||
-----------------
|
||||
@@ -363,19 +291,15 @@ are designed to run in a browser instance under the control of
|
||||
* Make sure you have Chrome installed (a recent version, like 59)
|
||||
* Make sure you have `matrix-js-sdk` and `matrix-react-sdk` installed and
|
||||
built, as above
|
||||
* `yarn test`
|
||||
* `npm run test`
|
||||
|
||||
The above will run the tests under Chrome in a `headless` mode.
|
||||
|
||||
You can also tell karma to run the tests in a loop (every time the source
|
||||
changes), in an instance of Chrome on your desktop, with `yarn
|
||||
changes), in an instance of Chrome on your desktop, with `npm run
|
||||
test-multi`. This also gives you the option of running the tests in 'debug'
|
||||
mode, which is useful for stepping through the tests in the developer tools.
|
||||
|
||||
### End-to-End tests
|
||||
|
||||
See [matrix-react-sdk](https://github.com/matrix-org/matrix-react-sdk/#end-to-end-tests) how to run the end-to-end tests.
|
||||
|
||||
Translations
|
||||
============
|
||||
|
||||
@@ -383,56 +307,36 @@ To add a new translation, head to the [translating doc](docs/translating.md).
|
||||
|
||||
For a developer guide, see the [translating dev doc](docs/translating-dev.md).
|
||||
|
||||
[<img src="https://translate.element.io/widgets/element-web/-/multi-auto.svg" alt="translationsstatus" width="340">](https://translate.element.io/engage/element-web/?utm_source=widget)
|
||||
[<img src="https://translate.riot.im/widgets/riot-web/-/multi-auto.svg" alt="translationsstatus" width="340">](https://translate.riot.im/engage/riot-web/?utm_source=widget)
|
||||
|
||||
Triaging issues
|
||||
===============
|
||||
|
||||
Issues will be triaged by the core team using the below set of tags.
|
||||
Issues will be triaged by the core team using the following primary set of tags:
|
||||
|
||||
Tags are meant to be used in combination - e.g.:
|
||||
* P1 critical bug == really urgent stuff that should be next in the bugfixing todo list
|
||||
* "release blocker" == stuff which is blocking us from cutting the next release.
|
||||
* P1 feature type:voip == what VoIP features should we be working on next?
|
||||
priority:
|
||||
|
||||
priority: **compulsory**
|
||||
|
||||
* P1: top priority - i.e. pool of stuff which we should be working on next
|
||||
* P1: top priority; typically blocks releases
|
||||
* P2: still need to fix, but lower than P1
|
||||
* P3: non-urgent
|
||||
* P4: interesting idea - bluesky some day
|
||||
* P4: intereseting idea - bluesky some day
|
||||
* P5: recorded for posterity/to avoid duplicates. No intention to resolves right now.
|
||||
|
||||
bug or feature: **compulsory**
|
||||
bug or feature:
|
||||
|
||||
* bug
|
||||
* feature
|
||||
|
||||
bug severity: **compulsory, if bug**
|
||||
bug severity:
|
||||
|
||||
* cosmetic - feature works functionally but UI/UX is broken
|
||||
* critical - whole app doesn't work
|
||||
* major - entire feature doesn't work
|
||||
* minor - partially broken feature (but still usable)
|
||||
* cosmetic - feature works functionally but UI/UX is broken
|
||||
|
||||
types
|
||||
* type:* - refers to a particular part of the app; used to filter bugs
|
||||
on a given topic - e.g. VOIP, signup, timeline, etc.
|
||||
|
||||
additional categories (self-explanatory):
|
||||
additional categories:
|
||||
|
||||
* release blocker
|
||||
* ui/ux (think of this as cosmetic)
|
||||
* network (specific to network conditions)
|
||||
* platform specific
|
||||
* accessibility
|
||||
* maintenance
|
||||
* performance
|
||||
* i18n
|
||||
* blocked - whether this issue currently can't be progressed due to outside factors
|
||||
|
||||
community engagement
|
||||
* easy
|
||||
* hacktoberfest
|
||||
* bounty? - proposal to be included in a bounty programme
|
||||
* bounty - included in Status Open Bounty
|
||||
* platform (platform specific)
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
module.exports = "css-file-stub";
|
||||
@@ -1,25 +0,0 @@
|
||||
module.exports = {
|
||||
"sourceMaps": true,
|
||||
"presets": [
|
||||
["@babel/preset-env", {
|
||||
"targets": [
|
||||
"last 2 Chrome versions", "last 2 Firefox versions", "last 2 Safari versions"
|
||||
],
|
||||
}],
|
||||
"@babel/preset-typescript",
|
||||
"@babel/preset-flow",
|
||||
"@babel/preset-react",
|
||||
],
|
||||
"plugins": [
|
||||
["@babel/plugin-proposal-decorators", {legacy: true}],
|
||||
"@babel/plugin-proposal-export-default-from",
|
||||
"@babel/plugin-proposal-numeric-separator",
|
||||
"@babel/plugin-proposal-class-properties",
|
||||
"@babel/plugin-proposal-object-rest-spread",
|
||||
"@babel/plugin-proposal-optional-chaining",
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator",
|
||||
"@babel/plugin-transform-flow-comments",
|
||||
"@babel/plugin-syntax-dynamic-import",
|
||||
"@babel/plugin-transform-runtime",
|
||||
],
|
||||
};
|
||||
@@ -1,54 +1,19 @@
|
||||
{
|
||||
"default_server_config": {
|
||||
"m.homeserver": {
|
||||
"base_url": "https://matrix-client.matrix.org",
|
||||
"server_name": "matrix.org"
|
||||
},
|
||||
"m.identity_server": {
|
||||
"base_url": "https://vector.im"
|
||||
}
|
||||
},
|
||||
"disable_custom_urls": false,
|
||||
"disable_guests": false,
|
||||
"disable_login_language_selector": false,
|
||||
"disable_3pid_login": false,
|
||||
"brand": "Element",
|
||||
"default_hs_url": "https://matrix.org",
|
||||
"default_is_url": "https://vector.im",
|
||||
"brand": "Riot",
|
||||
"integrations_ui_url": "https://scalar.vector.im/",
|
||||
"integrations_rest_url": "https://scalar.vector.im/api",
|
||||
"integrations_widgets_urls": [
|
||||
"https://scalar.vector.im/_matrix/integrations/v1",
|
||||
"https://scalar.vector.im/api",
|
||||
"https://scalar-staging.vector.im/_matrix/integrations/v1",
|
||||
"https://scalar-staging.vector.im/api",
|
||||
"https://scalar-staging.riot.im/scalar/api"
|
||||
],
|
||||
"bug_report_endpoint_url": "https://element.io/bugreports/submit",
|
||||
"defaultCountryCode": "GB",
|
||||
"showLabsSettings": false,
|
||||
"features": {
|
||||
"feature_new_spinner": false
|
||||
},
|
||||
"default_federate": true,
|
||||
"default_theme": "light",
|
||||
"bug_report_endpoint_url": "https://riot.im/bugreports/submit",
|
||||
"enableLabs": true,
|
||||
"roomDirectory": {
|
||||
"servers": [
|
||||
"matrix.org"
|
||||
]
|
||||
},
|
||||
"welcomeUserId": "@riot-bot:matrix.org",
|
||||
"piwik": {
|
||||
"url": "https://piwik.riot.im/",
|
||||
"whitelistedHSUrls": ["https://matrix.org"],
|
||||
"whitelistedISUrls": ["https://vector.im", "https://matrix.org"],
|
||||
"siteId": 1
|
||||
},
|
||||
"enable_presence_by_hs_url": {
|
||||
"https://matrix.org": false,
|
||||
"https://matrix-client.matrix.org": false
|
||||
},
|
||||
"settingDefaults": {
|
||||
"breadcrumbs": true
|
||||
},
|
||||
"jitsi": {
|
||||
"preferredDomain": "jitsi.riot.im"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"name": "Element",
|
||||
"description": "A glossy Matrix collaboration client for the web.",
|
||||
"repository": {
|
||||
"url": "https://github.com/vector-im/element-web",
|
||||
"license": "Apache License 2.0"
|
||||
},
|
||||
"bugs": {
|
||||
"list": "https://github.com/vector-im/element-web/issues",
|
||||
"report": "https://github.com/vector-im/element-web/issues/new/choose"
|
||||
},
|
||||
"keywords": [
|
||||
"chat",
|
||||
"riot",
|
||||
"matrix"
|
||||
]
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
# App load order
|
||||
|
||||
Old slow flow:
|
||||

|
||||
|
||||
Current more parallel flow:
|
||||

|
||||
|
||||
<details><summary>Code</summary>
|
||||
<p>
|
||||
<pre><code>
|
||||
digraph G {
|
||||
node [shape=box];
|
||||
|
||||
subgraph cluster_0 {
|
||||
color=orange;
|
||||
node [style=filled];
|
||||
label = "index.ts";
|
||||
|
||||
entrypoint, s0, ready [shape=point];
|
||||
rageshake, config, i18n, theme, skin, olm [shape=parallelogram];
|
||||
mobile [shape=diamond, label="mobile"];
|
||||
modernizr [shape=diamond];
|
||||
redirect, incompatible [shape=egg];
|
||||
|
||||
entrypoint -> rageshake;
|
||||
rageshake -> mobile [color=blue];
|
||||
mobile -> s0 [label="No"];
|
||||
mobile -> redirect [label="Yes"];
|
||||
|
||||
s0 -> platform;
|
||||
s0 -> olm;
|
||||
platform -> config;
|
||||
|
||||
config -> i18n [color=blue];
|
||||
config -> theme [color=blue];
|
||||
config -> skin [color=blue];
|
||||
|
||||
i18n -> modernizr [color=blue];
|
||||
theme -> modernizr [color=blue];
|
||||
skin -> modernizr [color=blue];
|
||||
|
||||
modernizr -> ready [label="Yes"];
|
||||
modernizr -> incompatible [label="No"];
|
||||
incompatible -> ready [label="user ignore"];
|
||||
|
||||
olm -> ready [color=red];
|
||||
config -> ready [color=red];
|
||||
skin -> ready [color=red];
|
||||
theme -> ready [color=red];
|
||||
i18n -> ready [color=red];
|
||||
}
|
||||
|
||||
subgraph cluster_1 {
|
||||
color = green;
|
||||
node [style=filled];
|
||||
label = "init.tsx";
|
||||
|
||||
ready -> loadApp;
|
||||
loadApp -> matrixchat;
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
</p>
|
||||
</details>
|
||||
|
||||
Key:
|
||||
+ Parallelogram: async/await task
|
||||
+ Box: sync task
|
||||
+ Diamond: conditional branch
|
||||
+ Egg: user interaction
|
||||
+ Blue arrow: async task is allowed to settle but allowed to fail
|
||||
+ Red arrow: async task success is asserted
|
||||
|
||||
Notes:
|
||||
+ A task begins when all its dependencies (arrows going into it) are fulfilled.
|
||||
+ The success of setting up rageshake is never asserted, element-web has a fallback path for running without IDB (and thus rageshake).
|
||||
+ Everything is awaited to be settled before the Modernizr check, to allow it to make use of things like i18n if they are successful.
|
||||
|
||||
Underlying dependencies:
|
||||

|
||||
211
docs/config.md
@@ -1,211 +0,0 @@
|
||||
Configuration
|
||||
=============
|
||||
|
||||
You can configure the app by copying `config.sample.json` to
|
||||
`config.json` and customising it:
|
||||
|
||||
For a good example, see https://develop.element.io/config.json.
|
||||
|
||||
1. `default_server_config` sets the default homeserver and identity server URL for
|
||||
Element to use. The object is the same as returned by [https://<server_name>/.well-known/matrix/client](https://matrix.org/docs/spec/client_server/latest.html#get-well-known-matrix-client),
|
||||
with added support for a `server_name` under the `m.homeserver` section to display
|
||||
a custom homeserver name. Alternatively, the config can contain a `default_server_name`
|
||||
instead which is where Element will go to get that same object, although this option is
|
||||
deprecated - see the `.well-known` link above for more information on using this option.
|
||||
Note that the `default_server_name` is used to get a complete server configuration
|
||||
whereas the `server_name` in the `default_server_config` is for display purposes only.
|
||||
* *Note*: The URLs can also be individually specified as `default_hs_url` and
|
||||
`default_is_url`, however these are deprecated. They are maintained for backwards
|
||||
compatibility with older configurations. `default_is_url` is respected only
|
||||
if `default_hs_url` is used.
|
||||
* Element will fail to load if a mix of `default_server_config`, `default_server_name`, or
|
||||
`default_hs_url` is specified. When multiple sources are specified, it is unclear
|
||||
which should take priority and therefore the application cannot continue.
|
||||
* As of Element 1.4.0, identity servers are optional. See [Identity servers](#identity-servers) below.
|
||||
1. `features`: Lookup of optional features that may be force-enabled (`true`) or force-disabled (`false`).
|
||||
When features are not listed here, their defaults will be used, and users can turn them on/off if `showLabsSettings`
|
||||
allows them to. The available optional experimental features vary from release to release and are
|
||||
[documented](labs.md). The feature flag process is [documented](feature-flags.md) as well.
|
||||
1. `showLabsSettings`: Shows the "labs" tab of user settings. Useful to allow users to turn on experimental features
|
||||
they might not otherwise have access to.
|
||||
1. `brand`: String to pass to your homeserver when configuring email notifications, to let the
|
||||
homeserver know what email template to use when talking to you.
|
||||
1. `branding`: Configures various branding and logo details, such as:
|
||||
1. `welcomeBackgroundUrl`: An image to use as a wallpaper outside the app
|
||||
during authentication flows. If an array is passed, an image is chosen randomly for each visit.
|
||||
1. `authHeaderLogoUrl`: An logo image that is shown in the header during
|
||||
authentication flows
|
||||
1. `authFooterLinks`: a list of links to show in the authentication page footer:
|
||||
`[{"text": "Link text", "url": "https://link.target"}, {"text": "Other link", ...}]`
|
||||
1. `reportEvent`: Configures the dialog for reporting content to the homeserver
|
||||
admin.
|
||||
1. `adminMessageMD`: An extra message to show on the reporting dialog to
|
||||
mention homeserver-specific policies. Accepts Markdown.
|
||||
1. `integrations_ui_url`: URL to the web interface for the integrations server. The integrations
|
||||
server is not Element and normally not your homeserver either. The integration server settings
|
||||
may be left blank to disable integrations.
|
||||
1. `integrations_rest_url`: URL to the REST interface for the integrations server.
|
||||
1. `integrations_widgets_urls`: list of URLs to the REST interface for the widget integrations server.
|
||||
1. `bug_report_endpoint_url`: endpoint to send bug reports to (must be running a
|
||||
https://github.com/matrix-org/rageshake server). Bug reports are sent when a user clicks
|
||||
"Send Logs" within the application. Bug reports can be disabled/hidden by leaving the
|
||||
`bug_report_endpoint_url` out of your config file.
|
||||
1. `roomDirectory`: config for the public room directory. This section is optional.
|
||||
1. `roomDirectory.servers`: List of other homeservers' directories to include in the drop
|
||||
down list. Optional.
|
||||
1. `default_theme`: name of theme to use by default (e.g. 'light')
|
||||
1. `update_base_url` (electron app only): HTTPS URL to a web server to download
|
||||
updates from. This should be the path to the directory containing `macos`
|
||||
and `win32` (for update packages, not installer packages).
|
||||
1. `piwik`: Analytics can be disabled by setting `piwik: false` or by leaving the piwik config
|
||||
option out of your config file. If you want to enable analytics, set `piwik` to be an object
|
||||
containing the following properties:
|
||||
1. `url`: The URL of the Piwik instance to use for collecting analytics
|
||||
1. `whitelistedHSUrls`: a list of HS URLs to not redact from the analytics
|
||||
1. `whitelistedISUrls`: a list of IS URLs to not redact from the analytics
|
||||
1. `siteId`: The Piwik Site ID to use when sending analytics to the Piwik server configured above
|
||||
1. `welcomeUserId`: the user ID of a bot to invite whenever users register that can give them a tour
|
||||
1. `embeddedPages`: Configures the pages displayed in portions of Element that
|
||||
embed static files, such as:
|
||||
1. `welcomeUrl`: Initial content shown on the outside of the app when not
|
||||
logged in. Defaults to `welcome.html` supplied with Element.
|
||||
1. `homeUrl`: Content shown on the inside of the app when a specific room is
|
||||
not selected. By default, no home page is configured. If one is set, a
|
||||
button to access it will be shown in the top left menu.
|
||||
1. `defaultCountryCode`: The ISO 3166 alpha2 country code to use when showing
|
||||
country selectors, like the phone number input on the registration page.
|
||||
Defaults to `GB` if the given code is unknown or not provided.
|
||||
1. `settingDefaults`: Defaults for settings that support the `config` level,
|
||||
as an object mapping setting name to value (note that the "theme" setting
|
||||
is special cased to the `default_theme` in the config file).
|
||||
1. `disable_custom_urls`: disallow the user to change the
|
||||
default homeserver when signing up or logging in.
|
||||
1. `permalinkPrefix`: Used to change the URL that Element generates permalinks with.
|
||||
By default, this is "https://matrix.to" to generate matrix.to (spec) permalinks.
|
||||
Set this to your Element instance URL if you run an unfederated server (eg:
|
||||
"https://element.example.org").
|
||||
1. `jitsi`: Used to change the default conference options. Learn more about the
|
||||
Jitsi options at [jitsi.md](./jitsi.md).
|
||||
1. `preferredDomain`: The domain name of the preferred Jitsi instance. Defaults
|
||||
to `jitsi.riot.im`. This is used whenever a user clicks on the voice/video
|
||||
call buttons - integration managers may use a different domain.
|
||||
1. `enable_presence_by_hs_url`: The property key should be the URL of the homeserver
|
||||
and its value defines whether to enable/disable the presence status display
|
||||
from that homeserver. If no options are configured, presence is shown for all
|
||||
homeservers.
|
||||
1. `disable_guests`: Disables guest access tokens and auto-guest registrations.
|
||||
Defaults to false (guests are allowed).
|
||||
1. `disable_login_language_selector`: Disables the login language selector. Defaults
|
||||
to false (language selector is shown).
|
||||
1. `disable_3pid_login`: Disables 3rd party identity options on login and registration form
|
||||
Defaults to false (3rd party identity options are shown).
|
||||
1. `default_federate`: Default option for room federation when creating a room
|
||||
Defaults to true (room federation enabled).
|
||||
1. `desktopBuilds`: Used to alter promotional links to the desktop app. By default
|
||||
the builds are considered available and accessible from https://element.io. This
|
||||
config option is typically used in the context of encouraging encrypted message
|
||||
search capabilities (Seshat). All the options listed below are required if this
|
||||
option is specified.
|
||||
1. `available`: When false, the desktop app will not be promoted to the user.
|
||||
1. `logo`: An HTTP URL to the avatar for the desktop build. Should be 24x24, ideally
|
||||
an SVG.
|
||||
1. `url`: An HTTP URL for where to send the user to download the desktop build.
|
||||
1. `voip_mxid_translate_pattern`: Used to route VoIP calls to different Matrix IDs.
|
||||
Any VoIP calls placed will instead be placed to the translated Matrix ID from the
|
||||
pattern string but still appear to be with the original Matrix ID. Correspondingly,
|
||||
incoming VoIP calls will be made to appear as if they came from a different Matrix ID.
|
||||
The value is a template string with substitution `$(mxid)` which is the complete
|
||||
URL-encoded native Matrix ID, using '=' instead of '%'. For example, a value of
|
||||
`@_myappservice_$(mxid):example.org` would cause any VoIP call to `@bob:foo.example`
|
||||
to be redirected to `@_myappservice_=40bob=3Afoo.example:example.org` and calls
|
||||
from the latter to appear as if they were from the former.
|
||||
This option is experimental and may be removed at any time without notice. It's
|
||||
also strongly advised not to set this option unless you're absolutly certain you
|
||||
know what you're doing.
|
||||
1. `mobileGuideToast`: Whether to show a toast a startup which nudges users on
|
||||
iOS and Android towards the native mobile apps. The toast redirects to the
|
||||
mobile guide if they accept. Defaults to false.
|
||||
|
||||
Note that `index.html` also has an og:image meta tag that is set to an image
|
||||
hosted on riot.im. This is the image used if links to your copy of Element
|
||||
appear in some websites like Facebook, and indeed Element itself. This has to be
|
||||
static in the HTML and an absolute URL (and HTTP rather than HTTPS), so it's
|
||||
not possible for this to be an option in config.json. If you'd like to change
|
||||
it, you can build Element, but run
|
||||
`RIOT_OG_IMAGE_URL="http://example.com/logo.png" yarn build`.
|
||||
Alternatively, you can edit the `og:image` meta tag in `index.html` directly
|
||||
each time you download a new version of Element.
|
||||
|
||||
Identity servers
|
||||
================
|
||||
|
||||
The identity server is used for inviting other users to a room via third party
|
||||
identifiers like emails and phone numbers. It is not used to store your password
|
||||
or account information.
|
||||
|
||||
As of Element 1.4.0, all identity server functions are optional and you are
|
||||
prompted to agree to terms before data is sent to the identity server.
|
||||
|
||||
Element will check multiple sources when looking for an identity server to use in
|
||||
the following order of preference:
|
||||
|
||||
1. The identity server set in the user's account data
|
||||
* For a new user, no value is present in their account data. It is only set
|
||||
if the user visits Settings and manually changes their identity server.
|
||||
2. The identity server provided by the `.well-known` lookup that occurred at
|
||||
login
|
||||
3. The identity server provided by the Riot config file
|
||||
|
||||
If none of these sources have an identity server set, then Element will prompt the
|
||||
user to set an identity server first when attempting to use features that
|
||||
require one.
|
||||
|
||||
Currently, the only two public identity servers are https://vector.im and
|
||||
https://matrix.org, however in the future identity servers will be
|
||||
decentralised.
|
||||
|
||||
Desktop app configuration
|
||||
=========================
|
||||
|
||||
See https://github.com/vector-im/element-desktop#user-specified-configjson
|
||||
|
||||
UI Features
|
||||
===========
|
||||
|
||||
Parts of the UI can be disabled using UI features. These are settings which appear
|
||||
under `settingDefaults` and can only be `true` (default) or `false`. When `false`,
|
||||
parts of the UI relating to that feature will be disabled regardless of the user's
|
||||
preferences.
|
||||
|
||||
Currently, the following UI feature flags are supported:
|
||||
|
||||
* `UIFeature.urlPreviews` - Whether URL previews are enabled across the entire application.
|
||||
* `UIFeature.feedback` - Whether prompts to supply feedback are shown.
|
||||
* `UIFeature.voip` - Whether or not VoIP is shown readily to the user. When disabled,
|
||||
Jitsi widgets will still work though they cannot easily be added.
|
||||
* `UIFeature.widgets` - Whether or not widgets will be shown.
|
||||
* `UIFeature.flair` - Whether or not community flair is shown in rooms.
|
||||
* `UIFeature.communities` - Whether or not to show any UI related to communities. Implicitly
|
||||
disables `UIFeature.flair` when disabled.
|
||||
* `UIFeature.advancedSettings` - Whether or not sections titled "advanced" in room and
|
||||
user settings are shown to the user.
|
||||
* `UIFeature.shareQrCode` - Whether or not the QR code on the share room/event dialog
|
||||
is shown.
|
||||
* `UIFeature.shareSocial` - Whether or not the social icons on the share room/event dialog
|
||||
are shown.
|
||||
* `UIFeature.identityServer` - Whether or not functionality requiring an identity server
|
||||
is shown. When disabled, the user will not be able to interact with the identity
|
||||
server (sharing email addresses, 3PID invites, etc).
|
||||
* `UIFeature.thirdPartyId` - Whether or not UI relating to third party identifiers (3PIDs)
|
||||
is shown. Typically this is considered "contact information" on the homeserver, and is
|
||||
not directly related to the identity server.
|
||||
* `UIFeature.registration` - Whether or not the registration page is accessible. Typically
|
||||
useful if accounts are managed externally.
|
||||
* `UIFeature.passwordReset` - Whether or not the password reset page is accessible. Typically
|
||||
useful if accounts are managed externally.
|
||||
* `UIFeature.deactivate` - Whether or not the deactivate account button is accessible. Typically
|
||||
useful if accounts are managed externally.
|
||||
* `UIFeature.advancedEncryption` - Whether or not advanced encryption options are shown to the
|
||||
user.
|
||||
* `UIFeature.roomHistorySettings` - Whether or not the room history settings are shown to the user.
|
||||
This should only be used if the room history visibility options are managed by the server.
|
||||
@@ -1,34 +0,0 @@
|
||||
# Customisations
|
||||
|
||||
Element Web and the React SDK support "customisation points" that can be used to
|
||||
easily add custom logic specific to a particular deployment of Element Web.
|
||||
|
||||
An example of this is the [security customisations
|
||||
module](https://github.com/matrix-org/matrix-react-sdk/blob/develop/src/customisations/Security.ts).
|
||||
This module in the React SDK only defines some empty functions and their types:
|
||||
it does not do anything by default.
|
||||
|
||||
To make use of these customisation points, you will first need to fork Element
|
||||
Web so that you can add your own code. Even though the default module is part of
|
||||
the React SDK, you can still override it from the Element Web layer:
|
||||
|
||||
1. Copy the default customisation module to
|
||||
`element-web/src/customisations/YourNameSecurity.ts`
|
||||
2. Edit customisations points and make sure export the ones you actually want to
|
||||
activate
|
||||
3. Tweak the Element build process to use the customised module instead of the
|
||||
default by adding this to end of the `plugins` array in `webpack.config.js`:
|
||||
|
||||
```js
|
||||
new webpack.NormalModuleReplacementPlugin(
|
||||
/src\/customisations\/Security.ts/,
|
||||
path.resolve(__dirname, 'src/customisations/YourNameSecurity.ts'),
|
||||
),
|
||||
```
|
||||
|
||||
If we add more customisation modules in the future, we'll likely improve these
|
||||
steps to remove the need for build changes like the above.
|
||||
|
||||
By isolating customisations to their own module, this approach should remove the
|
||||
chance of merge conflicts when updating your fork, and thus simplify ongoing
|
||||
maintenance.
|
||||
63
docs/e2ee.md
@@ -1,63 +0,0 @@
|
||||
# End to end encryption by default
|
||||
|
||||
By default, Element will create encrypted DM rooms if the user you are chatting with has keys uploaded on their account.
|
||||
For private room creation, Element will default to encryption on but give you the choice to opt-out.
|
||||
|
||||
## Disabling encryption by default
|
||||
|
||||
Set the following on your homeserver's
|
||||
`/.well-known/matrix/client` config:
|
||||
|
||||
```json
|
||||
{
|
||||
"io.element.e2ee": {
|
||||
"default": false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
# Secure backup
|
||||
|
||||
By default, Element strongly encourages (but does not require) users to set up
|
||||
Secure Backup so that cross-signing identity key and message keys can be
|
||||
recovered in case of a disaster where you lose access to all active devices.
|
||||
|
||||
## Requiring secure backup
|
||||
|
||||
To require Secure Backup to be configured before Element can be used, set the
|
||||
following on your homeserver's `/.well-known/matrix/client` config:
|
||||
|
||||
```json
|
||||
{
|
||||
"io.element.e2ee": {
|
||||
"secure_backup_required": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Preferring setup methods
|
||||
|
||||
By default, Element offers users a choice of a random key or user-chosen
|
||||
passphrase when setting up Secure Backup. If a homeserver admin would like to
|
||||
only offer one of these, you can signal this via the
|
||||
`/.well-known/matrix/client` config, for example:
|
||||
|
||||
```json
|
||||
{
|
||||
"io.element.e2ee": {
|
||||
"secure_backup_setup_methods": ["passphrase"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The field `secure_backup_setup_methods` is an array listing the methods the
|
||||
client should display. Supported values currently include `key` and
|
||||
`passphrase`. If the `secure_backup_setup_methods` field is not present or
|
||||
exists but does not contain any supported methods, Element will fallback to the
|
||||
default value of: `["key", "passphrase"]`.
|
||||
|
||||
# Compatibility
|
||||
|
||||
The settings above were first proposed under a `im.vector.riot.e2ee` key, which
|
||||
is now deprecated. Element will check for either key, preferring
|
||||
`io.element.e2ee` if both exist.
|
||||
@@ -1,107 +0,0 @@
|
||||
# Feature flags
|
||||
|
||||
When developing new features for Element, we use feature flags to give us more
|
||||
flexibility and control over when and where those features are enabled.
|
||||
|
||||
For example, flags make the following things possible:
|
||||
|
||||
* Extended testing of a feature via labs on develop
|
||||
* Enabling features when ready instead of the first moment the code is released
|
||||
* Testing a feature with a specific set of users (by enabling only on a specific
|
||||
Element instance)
|
||||
|
||||
The size of the feature controlled by a feature flag may vary widely: it could
|
||||
be a large project like reactions or a smaller change to an existing algorithm.
|
||||
A large project might use several feature flags if it's useful to control the
|
||||
deployment of different portions independently.
|
||||
|
||||
Everyone involved in a feature (engineering, design, product, reviewers) should
|
||||
think about its deployment plan up front as best as possible so we can have the
|
||||
right feature flags in place from the start.
|
||||
|
||||
## Interaction with spec process
|
||||
|
||||
Historically, we have often used feature flags to guard client features that
|
||||
depend on unstable spec features. Unfortunately, there was never clear agreement
|
||||
about how long such a flag should live for, when it should be removed, etc.
|
||||
|
||||
Under the [new spec
|
||||
process](https://github.com/matrix-org/matrix-doc/pull/2324), server-side
|
||||
unstable features can be used by clients and enabled by default as long as
|
||||
clients commit to doing the associated clean up work once a feature stabilises.
|
||||
|
||||
## Starting work on a feature
|
||||
|
||||
When starting work on a feature, we should create a matching feature flag:
|
||||
|
||||
1. Add a new
|
||||
[setting](https://github.com/matrix-org/matrix-react-sdk/blob/develop/src/settings/Settings.ts)
|
||||
of the form:
|
||||
```js
|
||||
"feature_cats": {
|
||||
isFeature: true,
|
||||
displayName: _td("Adds cats everywhere"),
|
||||
supportedLevels: LEVELS_FEATURE,
|
||||
default: false,
|
||||
},
|
||||
```
|
||||
2. Check whether the feature is enabled as appropriate:
|
||||
```js
|
||||
SettingsStore.getValue("feature_cats")
|
||||
```
|
||||
3. Document the feature in the [labs documentation](https://github.com/vector-im/element-web/blob/develop/docs/labs.md)
|
||||
|
||||
With these steps completed, the feature is disabled by default, but can be
|
||||
enabled on develop and nightly by interested users for testing.
|
||||
|
||||
Different features may have different deployment plans for when to enable where.
|
||||
The following lists a few common options.
|
||||
|
||||
## Enabling by default on develop and nightly
|
||||
|
||||
Set the feature to `true` in the
|
||||
[develop](https://github.com/vector-im/element-web/blob/develop/element.io/develop/config.json)
|
||||
and
|
||||
[nightly](https://github.com/vector-im/element-desktop/blob/develop/element.io/nightly/config.json)
|
||||
configs:
|
||||
|
||||
```json
|
||||
"features": {
|
||||
"feature_cats": true
|
||||
},
|
||||
```
|
||||
|
||||
## Enabling by default on staging, app, and release
|
||||
|
||||
Set the feature to `true` in the
|
||||
[staging / app](https://github.com/vector-im/element-web/blob/develop/element.io/app/config.json)
|
||||
and
|
||||
[release](https://github.com/vector-im/element-desktop/blob/develop/element.io/release/config.json)
|
||||
configs.
|
||||
|
||||
**Note:** The above will only enable the feature for https://app.element.io and official Element
|
||||
Desktop builds. It will not be enabled for self-hosted installed, custom desktop builds, etc. To
|
||||
cover these cases, change the setting's `default` in `Settings.ts` to `true`.
|
||||
|
||||
## Feature deployed successfully
|
||||
|
||||
Once we're confident that a feature is working well, we should remove or convert the flag.
|
||||
|
||||
If the feature is meant to be turned off/on by the user:
|
||||
1. Remove `isFeature` from the [setting](https://github.com/matrix-org/matrix-react-sdk/blob/develop/src/settings/Settings.ts)
|
||||
2. Change the `default` to `true` (if desired).
|
||||
3. Remove the feature from the [labs documentation](https://github.com/vector-im/element-web/blob/develop/docs/labs.md)
|
||||
4. Celebrate! 🥳
|
||||
|
||||
If the feature is meant to be forced on (non-configurable):
|
||||
1. Remove the [setting](https://github.com/matrix-org/matrix-react-sdk/blob/develop/src/settings/Settings.ts)
|
||||
2. Remove all `getValue` lines that test for the feature.
|
||||
3. Remove the feature from the [labs documentation](https://github.com/vector-im/element-web/blob/develop/docs/labs.md)
|
||||
4. If applicable, remove the feature state from
|
||||
[develop](https://github.com/vector-im/element-web/blob/develop/element.io/develop/config.json),
|
||||
[nightly](https://github.com/vector-im/element-desktop/blob/develop/element.io/nightly/config.json),
|
||||
[staging / app](https://github.com/vector-im/element-web/blob/develop/element.io/app/config.json),
|
||||
and
|
||||
[release](https://github.com/vector-im/element-desktop/blob/develop/element.io/release/config.json)
|
||||
configs
|
||||
5. Celebrate! 🥳
|
||||
|
Before Width: | Height: | Size: 155 KiB |
@@ -1,100 +0,0 @@
|
||||
# Jitsi wrapper developer docs
|
||||
|
||||
*If you're looking for information on how to set up Jitsi in your Element, see
|
||||
[jitsi.md](./jitsi.md) instead.*
|
||||
|
||||
These docs are for developers wondering how the different conference buttons work
|
||||
within Element. If you're not a developer, you're probably looking for [jitsi.md](./jitsi.md).
|
||||
|
||||
## Brief introduction to widgets
|
||||
|
||||
Widgets are embedded web applications in a room, controlled through state events, and
|
||||
have a `url` property. They are largely specified by [MSC1236](https://github.com/matrix-org/matrix-doc/issues/1236)
|
||||
and have extensions proposed under [MSC1286](https://github.com/matrix-org/matrix-doc/issues/1286).
|
||||
|
||||
The `url` is typically something we shove into an iframe with sandboxing (see `AppTile`
|
||||
in the react-sdk), though for some widgets special integration can be done. v2 widgets
|
||||
have a `data` object which helps achieve that special integration, though v1 widgets
|
||||
are best iframed and left alone.
|
||||
|
||||
Widgets have a `postMessage` API they can use to interact with Element, which also allows
|
||||
Element to interact with them. Typically this is most used by the sticker picker (an
|
||||
account-level widget), though widgets like the Jitsi widget will request permissions to
|
||||
get 'stuck' into the room list during a conference.
|
||||
|
||||
Widgets can be added with the `/addwidget <url>` command.
|
||||
|
||||
## Brief introduction to integration managers
|
||||
|
||||
Integration managers (like Scalar and Dimension) are accessible via the 4 squares in
|
||||
the top right of the room and provide a simple UI over top of bridges, bots, and other
|
||||
stuff to plug into a room. They are a separate service to Element and are thus iframed
|
||||
in a dialog as well. They also have a `postMessage` API they can use to interact with
|
||||
the client to create things like widgets, give permissions to bridges, and generally
|
||||
set everything up for the integration the user is working with.
|
||||
|
||||
Integration managers do not currently have a spec associated with them, though efforts
|
||||
are underway in [MSC1286](https://github.com/matrix-org/matrix-doc/issues/1286).
|
||||
|
||||
## Widgets configured by integration managers
|
||||
|
||||
Integration managers will often "wrap" a widget by using a widget `url` which points
|
||||
to the integration manager instead of to where the user requested the widget be. For
|
||||
example, a custom widget added in an integration manager for https://matrix.org will
|
||||
end up creating a widget with a URL like `https://integrations.example.org?widgetUrl=https%3A%2F%2Fmatrix.org`.
|
||||
|
||||
The integration manager's wrapper will typically have another iframe to isolate the
|
||||
widget from the client by yet another layer. The wrapper often provides other functionality
|
||||
which might not be available on the embedded site, such as a fullscreen button or the
|
||||
communication layer with the client (all widgets *should* be talking to the client
|
||||
over `postMessage`, even if they aren't going to be using the widget APIs).
|
||||
|
||||
Widgets added with the `/addwidget` command will *not* be wrapped as they are not going
|
||||
through an integration manager. The widgets themselves *should* also work outside of
|
||||
Element. Widgets currently have a "pop out" button which opens them in a new tab and
|
||||
therefore have no connection back to Riot.
|
||||
|
||||
## Jitsi widgets from integration managers
|
||||
|
||||
Integration managers will create an entire widget event and send it over `postMessage`
|
||||
for the client to add to the room. This means that the integration manager gets to
|
||||
decide the conference domain, conference name, and other aspects of the widget. As
|
||||
a result, users can end up with a Jitsi widget that does not use the same conference
|
||||
server they specified in their config.json - this is expected.
|
||||
|
||||
Some integration managers allow the user to change the conference name while others
|
||||
will generate one for the user.
|
||||
|
||||
## Jitsi widgets generated by Element itself
|
||||
|
||||
When the user clicks on the call buttons by the composer, the integration manager is
|
||||
not involved in the slightest. Instead, Element itself generates a widget event, this time
|
||||
using the config.json parameters, and publishes that to the room. If there's only two
|
||||
people in the room, a plain WebRTC call is made instead of using a widget at all - these
|
||||
are defined in the Matrix specification.
|
||||
|
||||
The Jitsi widget created by Element uses a local `jitsi.html` wrapper (or one hosted by
|
||||
`https://app.element.io` for desktop users or those on non-https domains) as the widget
|
||||
`url`. The wrapper has some basic functionality for talking to Element to ensure the
|
||||
required `postMessage` calls are fulfilled.
|
||||
|
||||
**Note**: Per [jitsi.md](./jitsi.md) the `preferredDomain` can also come from the server's
|
||||
client .well-known data.
|
||||
|
||||
## The Jitsi wrapper in Element
|
||||
|
||||
Whenever Element sees a Jitsi widget, it ditches the `url` and instead replaces it with
|
||||
its local wrapper, much like what it would do when creating a widget. However, instead
|
||||
of using one from [app.element.io](https://app.element.io), it will use one local to the client instead.
|
||||
|
||||
The wrapper is used to provide a consistent experience to users, as well as being faster
|
||||
and less risky to load. The local wrapper URL is populated with the conference information
|
||||
from the original widget (which could be a v1 or v2 widget) so the user joins the right
|
||||
call.
|
||||
|
||||
Critically, when the widget URL is reconstructed it does *not* take into account the
|
||||
config.json's `preferredDomain` for Jitsi. If it did this, users would end up on different
|
||||
conference servers and therefore different calls entirely.
|
||||
|
||||
**Note**: Per [jitsi.md](./jitsi.md) the `preferredDomain` can also come from the server's
|
||||
client .well-known data.
|
||||
@@ -1,73 +0,0 @@
|
||||
# Jitsi in Element
|
||||
|
||||
Element uses [Jitsi](https://jitsi.org/) for conference calls, which provides options for
|
||||
self-hosting your own server and supports most major platforms.
|
||||
|
||||
1:1 calls, or calls between you and one other person, do not use Jitsi. Instead, those
|
||||
calls work directly between clients or via TURN servers configured on the respective
|
||||
homeservers.
|
||||
|
||||
There's a number of ways to start a Jitsi call: the easiest way is to click on the
|
||||
voice or video buttons near the message composer in a room with more than 2 people. This
|
||||
will add a Jitsi widget which allows anyone in the room to join.
|
||||
|
||||
Integration managers (available through the 4 squares in the top right of the room) may
|
||||
provide their own approaches for adding Jitsi widgets.
|
||||
|
||||
## Configuring Element to use your self-hosted Jitsi server
|
||||
|
||||
Element will use the Jitsi server that is embedded in the widget, even if it is not the
|
||||
one you configured. This is because conference calls must be held on a single Jitsi
|
||||
server and cannot be split over multiple servers.
|
||||
|
||||
However, you can configure Element to *start* a conference with your Jitsi server by adding
|
||||
to your [config](./config.md) the following:
|
||||
```json
|
||||
{
|
||||
"jitsi": {
|
||||
"preferredDomain": "your.jitsi.example.org"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The default is `jitsi.riot.im` (a free service offered by Element), and the demo site for
|
||||
Jitsi uses `meet.jit.si` (also free).
|
||||
|
||||
Once you've applied the config change, refresh Element and press the call button. This
|
||||
should start a new conference on your Jitsi server.
|
||||
|
||||
**Note**: The widget URL will point to a `jitsi.html` page hosted by Element. The Jitsi
|
||||
domain will appear later in the URL as a configuration parameter.
|
||||
|
||||
**Hint**: If you want everyone on your homeserver to use the same Jitsi server by
|
||||
default, and you are using element-web 1.6 or newer, set the following on your homeserver's
|
||||
`/.well-known/matrix/client` config:
|
||||
```json
|
||||
{
|
||||
"im.vector.riot.jitsi": {
|
||||
"preferredDomain": "your.jitsi.example.org"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Element Android
|
||||
|
||||
Element Android (1.0.5+) supports custom Jitsi domains, similar to Element Web above.
|
||||
|
||||
1:1 calls, or calls between you and one other person, do not use Jitsi. Instead, those
|
||||
calls work directly between clients or via TURN servers configured on the respective
|
||||
homeservers.
|
||||
|
||||
For rooms with more than 2 joined members, when creating a Jitsi conference via call/video buttons of the toolbar (not via integration manager), Element Android will create a widget using the [wrapper](https://github.com/vector-im/element-web/blob/develop/docs/jitsi-dev.md) hosted on `app.element.io`.
|
||||
The domain used is the one specified by the `/.well-known/matrix/client` endpoint, and if not present it uses the fallback defined in `config.xml` (jitsi.riot.im)
|
||||
|
||||
For active Jitsi widgets in the room, a native Jitsi widget UI is created and points to the instance specified in the `domain` key of the widget content data.
|
||||
|
||||
Element Android manages allowed native widgets permissions a bit differently than web widgets (as the data shared are different and never shared with the widget URL). For Jitsi widgets, permissions are requested only once per domain (consent saved in account data).
|
||||
|
||||
## Element iOS
|
||||
|
||||
Currently the Element mobile apps do not support custom Jitsi servers and will instead
|
||||
use the default `jitsi.riot.im` server. When users on the mobile apps join the call,
|
||||
they will be joining a different conference which has the same name, but not the same
|
||||
participants. This is a known bug and which needs to be fixed.
|
||||
117
docs/labs.md
@@ -1,117 +0,0 @@
|
||||
# Labs features
|
||||
|
||||
If Labs is enabled in the [Element config](config.md), you can enable some of these features by going
|
||||
to `Settings->Labs`. This list is non-exhaustive and subject to change, chat in
|
||||
[#element-web:matrix.org](https://matrix.to/#/#element-web:matrix.org) for more information.
|
||||
|
||||
**Be warned! Labs features are not finalised, they may be fragile, they may change, they may be
|
||||
dropped. Ask in the room if you are unclear about any details here.**
|
||||
|
||||
## Render LaTeX maths in messages (`feature_latex_maths`)
|
||||
|
||||
Enables rendering of LaTeX maths in messages using [KaTeX](https://katex.org/). LaTeX between single dollar-signs is interpreted as inline maths and double dollar-signs as display maths (i.e. centred on its own line).
|
||||
|
||||
## New spinner design (`feature_new_spinner`)
|
||||
|
||||
Replaces the old spinner image with a new, svg-based one featuring a sleeker design.
|
||||
|
||||
## Message pinning (`feature_pinning`)
|
||||
|
||||
Allows you to pin messages in the room. To pin a message, use the 3 dots to the right of the message
|
||||
and select "Pin".
|
||||
|
||||
## Custom status (`feature_custom_status`)
|
||||
|
||||
An experimental approach for supporting custom status messages across DMs. To set a status, click on
|
||||
your avatar next to the message composer.
|
||||
|
||||
## Custom tags (`feature_custom_tags`)
|
||||
|
||||
An experimental approach for dealing with custom tags. Custom tags will appear in the bottom portion
|
||||
of the community filter panel.
|
||||
|
||||
Setting custom tags is not supported by Element.
|
||||
|
||||
## Render simple counters in room header (`feature_state_counters`)
|
||||
|
||||
Allows rendering of labelled counters above the message list.
|
||||
|
||||
Once enabled, send a custom state event to a room to set values:
|
||||
|
||||
1. In a room, type `/devtools` to bring up the devtools interface
|
||||
2. Click "Send Custom Event"
|
||||
3. Toggle from "Event" to "State Event"
|
||||
4. Set the event type to: `re.jki.counter` and give it a unique key
|
||||
5. Specify the content in the following format:
|
||||
|
||||
```
|
||||
{
|
||||
"link": "",
|
||||
"severity": "normal",
|
||||
"title": "my counter",
|
||||
"value": 0
|
||||
}
|
||||
```
|
||||
|
||||
That's it. Now should see your new counter under the header.
|
||||
|
||||
## Multiple integration managers (`feature_many_integration_managers`)
|
||||
|
||||
Exposes a way to access all the integration managers known to Element. This is an implementation of [MSC1957](https://github.com/matrix-org/matrix-doc/pull/1957).
|
||||
|
||||
## New ways to ignore people (`feature_mjolnir`)
|
||||
|
||||
When enabled, a new settings tab appears for users to be able to manage their ban lists.
|
||||
This is a different kind of ignoring where the ignored user's messages still get rendered,
|
||||
but are hidden by default.
|
||||
|
||||
Ban lists are rooms within Matrix, proposed as [MSC2313](https://github.com/matrix-org/matrix-doc/pull/2313).
|
||||
[Mjolnir](https://github.com/matrix-org/mjolnir) is a set of moderation tools which support
|
||||
ban lists.
|
||||
|
||||
## Verifications in DMs (`feature_dm_verification`)
|
||||
|
||||
An implementation of [MSC2241](https://github.com/matrix-org/matrix-doc/pull/2241). When enabled, verification might not work with devices which don't support MSC2241.
|
||||
|
||||
This also includes a new implementation of the user & member info panel, designed to share more code between showing community members & room members. Built on top of this new panel is also a new UX for verification from the member panel.
|
||||
|
||||
The setting will be removed in a future release, enabling it non-optionally for
|
||||
all users.
|
||||
|
||||
## Bridge info tab (`feature_bridge_state`)
|
||||
|
||||
Adds a "Bridge Info" tab to the Room Settings dialog, if a compatible bridge is
|
||||
present in the room. The Bridge info tab pulls information from the `m.bridge` state event ([MSC2346](https://github.com/matrix-org/matrix-doc/pull/2346)). Since the feature is based upon a MSC, most
|
||||
bridges are not expected to be compatible, and users should not rely on this
|
||||
tab as the single source of truth just yet.
|
||||
|
||||
## Presence indicator in room list (`feature_presence_in_room_list`)
|
||||
|
||||
This adds a presence indicator in the room list next to DM rooms where the other
|
||||
person is online.
|
||||
|
||||
## Custom themes (`feature_custom_themes`)
|
||||
|
||||
Custom themes are possible through Element's [theme support](./theming.md), though
|
||||
normally these themes need to be defined in the config for Element. This labs flag
|
||||
adds an ability for end users to add themes themselves by using a URL to the JSON
|
||||
theme definition.
|
||||
|
||||
For some sample themes, check out [aaronraimist/element-themes](https://github.com/aaronraimist/element-themes).
|
||||
|
||||
## Message preview tweaks
|
||||
|
||||
To enable message previews for reactions in all rooms, enable `feature_roomlist_preview_reactions_all`.
|
||||
To enable message previews for reactions in DMs, enable `feature_roomlist_preview_reactions_dms`, ignored when it is enabled for all rooms.
|
||||
|
||||
## Communities v2 prototyping (`feature_communities_v2_prototypes`) [In Development]
|
||||
|
||||
**This is a highly experimental implementation for parts of the communities v2 experience.** It does not
|
||||
represent what communities v2 will look/feel like and can/will change without notice. Due to the early
|
||||
stages this feature is in and the requirement for a compatible homeserver, we will not be accepting issues
|
||||
or feedback for this functionality at this time.
|
||||
|
||||
## Dehydrated devices (`feature_dehydration`)
|
||||
|
||||
Allows users to receive encrypted messages by creating a device that is stored
|
||||
encrypted on the server, as described in [MSC2697](https://github.com/matrix-org/matrix-doc/pull/2697).
|
||||
@@ -1,53 +0,0 @@
|
||||
## Memory leaks
|
||||
|
||||
Element usually emits slow behaviour just before it is about to crash. Getting a
|
||||
memory snapshot (below) just before that happens is ideal in figuring out what
|
||||
is going wrong.
|
||||
|
||||
Common symptoms are clicking on a room and it feels like the tab froze and scrolling
|
||||
becoming jumpy/staggered.
|
||||
|
||||
If you receive a white screen (electron) or the chrome crash page, it is likely
|
||||
run out of memory and it is too late for a memory profile. Please do report when
|
||||
this happens though so we can try and narrow down what might have gone wrong.
|
||||
|
||||
## Memory profiles/snapshots
|
||||
|
||||
When investigating memory leaks/problems it's usually important to compare snapshots
|
||||
from different points in the Element session lifecycle. Most importantly, a snapshot
|
||||
to establish the baseline or "normal" memory usage is useful. Taking a snapshot
|
||||
roughly 30-60 minutes after starting Element is a good time to establish "normal"
|
||||
memory usage for the app - anything after that is at risk of hiding the memory leak
|
||||
and anything newer is still in the warmup stages of the app.
|
||||
|
||||
**Memory profiles can contain sensitive information.** If you are submitting a memory
|
||||
profile to us for debugging purposes, please pick the appropriate Element developer and
|
||||
send them over an encrypted private message. *Do not share your memory profile in
|
||||
public channels or with people you do not trust.*
|
||||
|
||||
### Taking a memory profile (Firefox)
|
||||
|
||||
1. Press CTRL+SHIFT+I (I as in eye).
|
||||
2. Click the Memory tab.
|
||||
3. Press the camera icon in the top left of the pane.
|
||||
4. Wait a bit (coffee is a good option).
|
||||
5. When the save button appears on the left side of the panel, click it to save the
|
||||
profile locally.
|
||||
6. Compress the file (gzip or regular zip) to make the file smaller.
|
||||
7. Send the compressed file to whoever asked for it (if you trust them).
|
||||
|
||||
While the profile is in progress, the tab might be frozen or unresponsive.
|
||||
|
||||
### Taking a memory profile (Chrome/Desktop)
|
||||
|
||||
1. Press CTRL+SHIFT+I (I as in eye).
|
||||
2. Click the Memory tab.
|
||||
3. Select "Heap Snapshot" and the app.element.io VM instance (not the indexeddb one).
|
||||
4. Click "Take Snapshot".
|
||||
5. Wait a bit (coffee is a good option).
|
||||
6. When the save button appears on the left side of the panel, click it to save the
|
||||
profile locally.
|
||||
7. Compress the file (gzip or regular zip) to make the file smaller.
|
||||
8. Send the compressed file to whoever asked for it (if you trust them).
|
||||
|
||||
While the profile is in progress, the tab might be frozen or unresponsive.
|
||||
@@ -1,60 +0,0 @@
|
||||
# Native Node Modules
|
||||
|
||||
For some features, the desktop version of Element can make use of native Node
|
||||
modules. These allow Riot to integrate with the desktop in ways that a browser
|
||||
cannot.
|
||||
|
||||
While native modules enable powerful new features, they must be complied for
|
||||
each operating system. For official Element releases, we will always build these
|
||||
modules from source to ensure we can trust the compiled output. In the future,
|
||||
we may offer a pre-compiled path for those who want to use these features in a
|
||||
custom build of Element without installing the various build tools required.
|
||||
|
||||
Do note that compiling a module for a particular operating system
|
||||
(Linux/macOS/Windows) will need to be done on that operating system.
|
||||
Cross-compiling from a host OS for a different target OS may be possible, but
|
||||
we don't support this flow with Element dependencies at this time.
|
||||
|
||||
At the moment, we need to make some changes to the Element release process before
|
||||
we can support native Node modules at release time, so these features are
|
||||
currently disabled by default until that is resolved. The following sections
|
||||
explain the manual steps you can use with a custom build of Element to enable
|
||||
these features if you'd like to try them out.
|
||||
|
||||
## Adding Seshat for search in E2E encrypted rooms
|
||||
|
||||
Seshat is a native Node module that adds support for local event indexing and
|
||||
full text search in E2E encrypted rooms.
|
||||
|
||||
Since Seshat is written in Rust, the Rust compiler and related tools need to be
|
||||
installed before installing Seshat itself. To install Rust please consult the
|
||||
official Rust [documentation](https://www.rust-lang.org/tools/install).
|
||||
|
||||
Seshat also depends on the SQLCipher library to store its data in encrypted form
|
||||
on disk. You'll need to install it via your OS package manager.
|
||||
|
||||
After installing the Rust compiler and SQLCipher, Seshat support can be added
|
||||
using yarn inside the `electron_app/` directory:
|
||||
|
||||
yarn add matrix-seshat
|
||||
|
||||
You will have to rebuild the native libraries against electron's version of
|
||||
of node rather than your system node, using the `electron-build-env` tool.
|
||||
This is also needed to when pulling in changes to Seshat using `yarn link`.
|
||||
Again from the `electron_app/` directory:
|
||||
|
||||
yarn add electron-build-env
|
||||
|
||||
Recompiling Seshat itself can be done like so:
|
||||
|
||||
yarn run electron-build-env -- --electron 6.1.1 -- neon build matrix-seshat --release
|
||||
|
||||
Please make sure to include all the `--` as well as the `--release` command line
|
||||
switch at the end. Modify your electron version accordingly depending on the
|
||||
version that is installed on your system.
|
||||
|
||||
After this is done the Electron version of Element can be run from the main folder
|
||||
as usual using:
|
||||
|
||||
yarn electron
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
# Pull Request Previews
|
||||
|
||||
Pull requests to the React SDK layer (and in the future other layers as well)
|
||||
automatically set up a preview site with a full deployment of Element with the
|
||||
changes from the pull request added in so that anyone can easily test and review
|
||||
them. This is especially useful for checking visual and interactive changes.
|
||||
|
||||
To access the preview site, scroll down to the bottom of the PR where the
|
||||
various CI results are displayed:
|
||||
|
||||

|
||||
|
||||
The checks section could be collapsed at first, so you may need to click "Show
|
||||
all checks" to reveal them. Look for an entry that mentions `deploy-preview`. It
|
||||
may be at the end of the list, so you may need scroll a bit to see it. To access
|
||||
the preview site, click the "Details" link in the deploy preview row.
|
||||
|
||||
**Important:** Please always use test accounts when logging into preview sites,
|
||||
as they may contain unreviewed and potentially dangerous code that could damage
|
||||
your account, exfiltrate encryption keys, etc.
|
||||
|
||||
## FAQs
|
||||
|
||||
### Are preview sites created for pull requests from contributors?
|
||||
|
||||
Yes, they are created for all PRs from any author.
|
||||
|
||||
### Do preview sites expire after some time period?
|
||||
|
||||
No, there is no expiry date, so they should remain accessible indefinitely, but
|
||||
of course they obviously aren't meant to live beyond the development workflow,
|
||||
so please don't rely on them for anything important. They may disappear at any
|
||||
time without notice.
|
||||
@@ -1,83 +0,0 @@
|
||||
# Review Guidelines
|
||||
|
||||
The following summarises review guidelines that we follow for pull requests in
|
||||
Element Web and other supporting repos. These are just guidelines (not strict
|
||||
rules) and may be updated over time.
|
||||
|
||||
## Code Review
|
||||
|
||||
When reviewing code, here are some things we look for and also things we avoid:
|
||||
|
||||
### We review for
|
||||
|
||||
* Correctness
|
||||
* Performance
|
||||
* Accessibility
|
||||
* Security
|
||||
* Quality via automated and manual testing
|
||||
* Comments and documentation where needed
|
||||
* Sharing knowledge of different areas among the team
|
||||
* Ensuring it's something we're comfortable maintaining for the long term
|
||||
* Progress indicators and local echo where appropriate with network activity
|
||||
|
||||
### We should avoid
|
||||
|
||||
* Style nits that are already handled by the linter
|
||||
* Dramatically increasing scope
|
||||
|
||||
### Good practices
|
||||
|
||||
* Use empathetic language
|
||||
* See also [Mindful Communication in Code
|
||||
Reviews](https://kickstarter.engineering/a-guide-to-mindful-communication-in-code-reviews-48aab5282e5e)
|
||||
and [How to Do Code Reviews Like a Human](https://mtlynch.io/human-code-reviews-1/)
|
||||
* Authors should prefer smaller commits for easier reviewing and bisection
|
||||
* Reviewers should be explicit about required versus optional changes
|
||||
* Reviews are conversations and the PR author should feel comfortable
|
||||
discussing and pushing back on changes before making them
|
||||
* Reviewers are encouraged to ask for tests where they believe it is reasonable
|
||||
* Core team should lead by example through their tone and language
|
||||
* Take the time to thank and point out good code changes
|
||||
* Using softer language like "please" and "what do you think?" goes a long way
|
||||
towards making others feel like colleagues working towards a common goal
|
||||
|
||||
### Workflow
|
||||
|
||||
* Authors should request review from the element-web team by default (if someone on
|
||||
the team is clearly the expert in an area, a direct review request to them may
|
||||
be more appropriate)
|
||||
* Reviewers should remove the team review request and request review from
|
||||
themselves when starting a review to avoid double review
|
||||
* If there are multiple related PRs authors should reference each of the PRs in
|
||||
the others before requesting review. Reviewers might start reviewing from
|
||||
different places and could miss other required PRs.
|
||||
* Avoid force pushing to a PR after the first round of review
|
||||
* Use the GitHub default of merge commits when landing (avoid alternate options
|
||||
like squash or rebase)
|
||||
* PR author merges after review (assuming they have write access)
|
||||
* Assign issues only when in progress to indicate to others what can be picked
|
||||
up
|
||||
|
||||
## Design and Product Review
|
||||
|
||||
We want to ensure that all changes to Element fit with our design and product
|
||||
vision. We often request review from those teams so they can provide their
|
||||
perspective.
|
||||
|
||||
In more detail, our usual process for changes that affect the UI or alter user
|
||||
functionality is:
|
||||
|
||||
* For changes that will go live when merged, always flag Design and Product
|
||||
teams as appropriate
|
||||
* For changes guarded by a feature flag, Design and Product review is not
|
||||
required (though may still be useful) since we can continue tweaking
|
||||
|
||||
As it can be difficult to review design work from looking at just the changed
|
||||
files in a PR, a [preview site](./pr-previews.md) that includes your changes
|
||||
will be added automatically so that anyone who's interested can try them out
|
||||
easily.
|
||||
|
||||
Before starting work on a feature, it's best to ensure your plan aligns well
|
||||
with our vision for Element. Please chat with the team in
|
||||
[#element-dev:matrix.org](https://matrix.to/#/#element-dev:matrix.org) before you
|
||||
start so we can ensure it's something we'd be willing to merge.
|
||||
@@ -1,68 +0,0 @@
|
||||
== Skinning refactor ==
|
||||
|
||||
matrix-react-sdk
|
||||
- base images
|
||||
- base CSS
|
||||
- all the components needed to build a workable app (including the top layer)
|
||||
|
||||
element-web: the Element skin
|
||||
- Element-specific classes (e.g. login header/footer)
|
||||
- Element-specific themes
|
||||
- light
|
||||
- dark
|
||||
|
||||
i.e. the only things which should go into element-web are bits which apply vector-specific skinning
|
||||
specifically "Stuff that any other brand would not want to use. (e.g. Element logos, links, T&Cs)"
|
||||
- Questions:
|
||||
- Electron app? (should probably be a separate repo in its own right? but might as well go here for now)
|
||||
- index.html & index.js? (should be in matrix-react-sdk, given the SDK is useless without them?)
|
||||
|
||||
ideally matrix-react-sdk itself should ship with a default skin which actually works built in.
|
||||
|
||||
status skin (can go in the same app for now)
|
||||
- has status theme
|
||||
- which inherits from Element light theme
|
||||
- how do we share graphics between skins?
|
||||
- shove them into react-sdk, or...
|
||||
- guess we do ../../vector/img
|
||||
- this means keeping the skin name in the images (unless /img is a shortcut to the right skin's images)
|
||||
|
||||
out of scope:
|
||||
- making the components more independent, so they can be used in isolation.
|
||||
- that said, the bits which should probably be used by being embeded into a different app:
|
||||
- login/reg
|
||||
- RoomView + RoomSettings
|
||||
- MessageComposer
|
||||
- RoomList
|
||||
- MemberList
|
||||
- MemberInfo
|
||||
- Voip UI
|
||||
- UserSettings
|
||||
- sharing different js-sdks between the different isolated modules
|
||||
|
||||
other changes:
|
||||
- how do we handle i18n?
|
||||
- each skin should really be its own i18n project. As long as all the commonality stuff is in matrix-react-sdk this shouldn't be too bad.
|
||||
- ability to associate components with a given skin
|
||||
- skins/vector/src <-- components
|
||||
- skins/vector/css
|
||||
- skins/vector/img
|
||||
- skins/vector/fonts
|
||||
- gather together themes (per skin) into a single place too
|
||||
- skins/vector/themes/foo/css
|
||||
- skins/vector/themes/foo/img
|
||||
- skins/vector/themes/foo/fonts
|
||||
- ideally element-web would contain almost nothing but skins/vector directory.
|
||||
- ability to entirely replace CSS rather than override it for a given theme
|
||||
- e.g. if we replace `Login.js` with `StatusLogin.js`, then we should similarly be able to replace `_Login.scss` with `_StatusLogin.scss`.
|
||||
|
||||
random thoughts;
|
||||
- should we be able to change the entire skin at runtime (more like wordpress) - to the extent of replacing entire components?
|
||||
- might pose security issues if a theme can be swapped out to replace MatrixChat or other fundamental functionality at runtime
|
||||
- if so, perhaps skins & themes should converge...
|
||||
|
||||
-----------------
|
||||
|
||||
Immediate plan for Status:
|
||||
* Implement it as a theme for the Element skin
|
||||
* Ideally move skins to a sensible level (possibly even including src?)
|
||||
@@ -1,21 +1,21 @@
|
||||
Theming Element
|
||||
Theming Riot
|
||||
============
|
||||
|
||||
Themes are a very basic way of providing simple alternative look & feels to the
|
||||
Element app via CSS & custom imagery.
|
||||
riot-web app via CSS & custom imagery.
|
||||
|
||||
They are *NOT* co be confused with 'skins', which describe apps which sit on top
|
||||
of matrix-react-sdk - e.g. in theory Element itself is a react-sdk skin.
|
||||
As of Jan 2017, skins are not fully supported; Element is the only available skin.
|
||||
of matrix-react-sdk - e.g. in theory Riot itself is a react-sdk skin.
|
||||
As of Jan 2017, skins are not fully supported; riot is the only available skin.
|
||||
|
||||
To define a theme for Element:
|
||||
To define a theme for Riot:
|
||||
|
||||
1. Pick a name, e.g. `teal`. at time of writing we have `light` and `dark`.
|
||||
2. Fork `src/skins/vector/css/themes/dark.scss` to be `teal.scss`
|
||||
3. Fork `src/skins/vector/css/themes/_base.scss` to be `_teal.scss`
|
||||
4. Override variables in `_teal.scss` as desired. You may wish to delete ones
|
||||
which don't differ from `_base.scss`, to make it clear which are being
|
||||
overridden. If every single colour is being changed (as per `_dark.scss`)
|
||||
2. Fork `src/skins/vector/css/themes/dark.scss` to be teal.scss
|
||||
3. Fork `src/skins/vector/css/themes/_base.scss` to be _teal.scss
|
||||
4. Override variables in _teal.scss as desired. You may wish to delete ones
|
||||
which don't differ from _base.scss, to make it clear which are being
|
||||
overridden. If every single colour is being changed (as per _dark.scss)
|
||||
then you might as well keep them all.
|
||||
5. Add the theme to the list of entrypoints in webpack.config.js
|
||||
6. Add the theme to the list of themes in matrix-react-sdk's UserSettings.js
|
||||
@@ -23,76 +23,3 @@ To define a theme for Element:
|
||||
|
||||
In future, the assets for a theme will probably be gathered together into a
|
||||
single directory tree.
|
||||
|
||||
Custom Themes
|
||||
=============
|
||||
|
||||
Themes derived from the built in themes may also be defined in settings.
|
||||
|
||||
To avoid name collisions, the internal name of a theme is
|
||||
`custom-${theme.name}`. So if you want to set the custom theme below as the
|
||||
default theme, you would use `default_theme: "custom-Electric Blue"`.
|
||||
|
||||
eg. in config.json:
|
||||
|
||||
```
|
||||
"settingDefaults": {
|
||||
"custom_themes": [
|
||||
{
|
||||
"name": "Electric Blue",
|
||||
"is_dark": false,
|
||||
"fonts": {
|
||||
"faces": [
|
||||
{
|
||||
"font-family": "Inter",
|
||||
"src": [{"url": "/fonts/Inter.ttf", "format": "ttf"}]
|
||||
}
|
||||
],
|
||||
"general": "Inter, sans",
|
||||
"monospace": "'Courier New'"
|
||||
},
|
||||
"colors": {
|
||||
"accent-color": "#3596fc",
|
||||
"primary-color": "#368bd6",
|
||||
"warning-color": "#ff4b55",
|
||||
"sidebar-color": "#27303a",
|
||||
"roomlist-background-color": "#f3f8fd",
|
||||
"roomlist-text-color": "#2e2f32",
|
||||
"roomlist-text-secondary-color": "#61708b",
|
||||
"roomlist-highlights-color": "#ffffff",
|
||||
"roomlist-separator-color": "#e3e8f0",
|
||||
"timeline-background-color": "#ffffff",
|
||||
"timeline-text-color": "#2e2f32",
|
||||
"timeline-text-secondary-color": "#61708b",
|
||||
"timeline-highlights-color": "#f3f8fd",
|
||||
"username-colors": ["#ff0000", ...]
|
||||
"avatar-background-colors": ["#cc0000", ...]
|
||||
}
|
||||
}, {
|
||||
"name": "Deep Purple",
|
||||
"is_dark": true,
|
||||
"colors": {
|
||||
"accent-color": "#6503b3",
|
||||
"primary-color": "#368bd6",
|
||||
"warning-color": "#b30356",
|
||||
"sidebar-color": "#15171B",
|
||||
"roomlist-background-color": "#22262E",
|
||||
"roomlist-text-color": "#A1B2D1",
|
||||
"roomlist-text-secondary-color": "#EDF3FF",
|
||||
"roomlist-highlights-color": "#343A46",
|
||||
"roomlist-separator-color": "#a1b2d1",
|
||||
"timeline-background-color": "#181b21",
|
||||
"timeline-text-color": "#EDF3FF",
|
||||
"timeline-text-secondary-color": "#A1B2D1",
|
||||
"timeline-highlights-color": "#22262E"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
`username-colors` is expected to contain 8 colors. `avatar-background-colors` is expected to contain 3 colors. Both values are optional and have fallbacks from the built-in theme.
|
||||
|
||||
These are exposed as `--username-colors_0`, ... and `--avatar-background-colors_0`, ... respectively in CSS.
|
||||
|
||||
All properties in `fonts` are optional, and will default to the standard Riot fonts.
|
||||
|
||||
@@ -1,63 +1,26 @@
|
||||
# How to translate Element (Dev Guide)
|
||||
# How to translate riot-web (Dev Guide)
|
||||
|
||||
## Requirements
|
||||
|
||||
- A working [Development Setup](../../#setting-up-a-dev-environment)
|
||||
- Including up-to-date versions of matrix-react-sdk and matrix-js-sdk
|
||||
- Latest LTS version of Node.js installed
|
||||
- Be able to understand English
|
||||
- Be able to understand the language you want to translate Element into
|
||||
|
||||
## Translating strings vs. marking strings for translation
|
||||
|
||||
Translating strings are done with the `_t()` function found in matrix-react-sdk/lib/languageHandler.js. It is recommended to call this function wherever you introduce a string constant which should be translated. However, translating can not be performed until after the translation system has been initialized. Thus, sometimes translation must be performed at a different location in the source code than where the string is introduced. This breaks some tooling and makes it difficult to find translatable strings. Therefore, there is the alternative `_td()` function which is used to mark strings for translation, without actually performing the translation (which must still be performed separately, and after the translation system has been initialized).
|
||||
|
||||
Basically, whenever a translatable string is introduced, you should call either `_t()` immediately OR `_td()` and later `_t()`.
|
||||
|
||||
Example:
|
||||
```
|
||||
// Module-level constant
|
||||
const COLORS = {
|
||||
'#f8481c': _td('reddish orange'), // Can't call _t() here yet
|
||||
'#fc2647': _td('pinky red') // Use _td() instead so the text is picked up for translation anyway
|
||||
}
|
||||
|
||||
// Function that is called some time after i18n has been loaded
|
||||
function getColorName(hex) {
|
||||
return _t(COLORS[hex]); // Perform actual translation here
|
||||
}
|
||||
```
|
||||
- Be able to understand the language you want to translate riot-web into
|
||||
|
||||
## Adding new strings
|
||||
|
||||
1. Check if the import ``import { _t } from 'matrix-react-sdk/lib/languageHandler';`` is present. If not add it to the other import statements. Also import `_td` if needed.
|
||||
1. Add ``_t()`` to your string. (Don't forget curly braces when you assign an expression to JSX attributes in the render method). If the string is introduced at a point before the translation system has not yet been initialized, use `_td()` instead, and call `_t()` at the appropriate time.
|
||||
1. Run `yarn i18n` to update ``src/i18n/strings/en_EN.json``
|
||||
1. If you added a string with a plural, you can add other English plural variants to ``src/i18n/strings/en_EN.json`` (remeber to edit the one in the same project as the source file containing your new translation).
|
||||
|
||||
## Editing existing strings
|
||||
|
||||
1. Edit every occurrence of the string inside `_t()` and `_td()` in the JSX files.
|
||||
1. Run `yarn i18n` to update `src/i18n/strings/en_EN.json`. (Be sure to run this in the same project as the JSX files you just edited.)
|
||||
1. Run `yarn prunei18n` to remove the old string from `src/i18n/strings/*.json`.
|
||||
1. Check if the import ``import { _t } from 'matrix-react-sdk/lib/languageHandler';`` is present. If not add it to the other import statements.
|
||||
2. Add ``_t()`` to your string. (Don't forget curly braces when you assign an expression to JSX attributes in the render method)
|
||||
3. Add the String to the ``en_EN.json`` file in ``src/i18n/strings`` (respect which repository you are on).
|
||||
|
||||
## Adding variables inside a string.
|
||||
|
||||
1. Extend your ``_t()`` call. Instead of ``_t(STRING)`` use ``_t(STRING, {})``
|
||||
1. Decide how to name it. Please think about if the person who has to translate it can understand what it does. E.g. using the name 'recipient' is bad, because a translator does not know if it is the name of a person, an email address, a user ID, etc. Rather use e.g. recipientEmailAddress.
|
||||
1. Add it to the array in ``_t`` for example ``_t(STRING, {variable: this.variable})``
|
||||
1. Add the variable inside the string. The syntax for variables is ``%(variable)s``. Please note the _s_ at the end. The name of the variable has to match the previous used name.
|
||||
|
||||
- You can use the special ``count`` variable to choose between multiple versions of the same string, in order to get the correct pluralization. E.g. ``_t('You have %(count)s new messages', { count: 2 })`` would show 'You have 2 new messages', while ``_t('You have %(count)s new messages', { count: 1 })`` would show 'You have one new message' (assuming a singular version of the string has been added to the translation file. See above). Passing in ``count`` is much prefered over having an if-statement choose the correct string to use, because some languages have much more complicated plural rules than english (e.g. they might need a completely different form if there are three things rather than two).
|
||||
- If you want to translate text that includes e.g. hyperlinks or other HTML you have to also use tag substitution, e.g. ``_t('<a>Click here!</a>', {}, { 'a': (sub) => <a>{sub}</a> })``. If you don't do the tag substitution you will end up showing literally '<a>' rather than making a hyperlink.
|
||||
- You can also use React components with normal variable substitution if you want to insert HTML markup, e.g. ``_t('Your email address is %(emailAddress)s', { emailAddress: <i>{userEmailAddress}</i> })``.
|
||||
2. Decide how to name it. Please think about if the person who has to translate it can understand what it does.
|
||||
3. Add it to the array in ``_t`` for example ``_t(STRING, {variable: this.variable})``
|
||||
4. Add the variable inside the string. The syntax for variables is ``%(variable)s``. Please note the s at the end. The name of the variable has to match the previous used name.
|
||||
|
||||
## Things to know/Style Guides
|
||||
|
||||
- Do not use `_t()` inside ``getDefaultProps``: the translations aren't loaded when `getDefaultProps` is called, leading to missing translations. Use `_td()` to indicate that `_t()` will be called on the string later.
|
||||
- If using translated strings as constants, translated strings can't be in constants loaded at class-load time since the translations won't be loaded. Mark the strings using `_td()` instead and perform the actual translation later.
|
||||
- Do not use it inside ``getDefaultProps`` at the point where ``getDefaultProps`` is initialized the translations aren't loaded yet and it causes missing translations.
|
||||
- If using translated strings as constants, translated strings can't be in constants loaded at class-load time since the translations won't be loaded.
|
||||
- If a string is presented in the UI with punctuation like a full stop, include this in the translation strings, since punctuation varies between languages too.
|
||||
- Avoid "translation in parts", i.e. concatenating translated strings or using translated strings in variable substitutions. Context is important for translations, and translating partial strings this way is simply not always possible.
|
||||
- Concatenating strings often also introduces an implicit assumption about word order (e.g. that the subject of the sentence comes first), which is incorrect for many languages.
|
||||
- Translation 'smell test': If you have a string that does not begin with a capital letter (is not the start of a sentence) or it ends with e.g. ':' or a preposition (e.g. 'to') you should recheck that you are not trying to translate a partial sentence.
|
||||
- If you have multiple strings, that are almost identical, except some part (e.g. a word or two) it is still better to translate the full sentence multiple times. It may seem like inefficient repetion, but unlike programming where you try to minimize repetition, translation is much faster if you have many, full, clear, sentences to work with, rather than fewer, but incomplete sentence fragments.
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
# How to translate Element
|
||||
# How to translate riot-web
|
||||
|
||||
## Requirements
|
||||
|
||||
- Web Browser
|
||||
- Be able to understand English
|
||||
- Be able to understand the language you want to translate Element into
|
||||
- Be able to understand the language you want to translate riot-web into
|
||||
|
||||
## Step 0: Join #element-translations:matrix.org
|
||||
## Step 0: Join #riotweb-translations:matrix.org
|
||||
|
||||
1. Come and join https://matrix.to/#/#element-translations:matrix.org
|
||||
1. Come and join https://matrix.to/#/#riotweb-translations:matrix.org
|
||||
2. Read scrollback and/or ask if anyone else is working on your language, and co-ordinate if needed. In general little-or-no coordination is needed though :)
|
||||
|
||||
## Step 1: Preparing your Weblate Profile
|
||||
|
||||
1. Head to https://translate.element.io and register either via Github or email
|
||||
1. Head to https://translate.riot.im and register either via Github or email
|
||||
2. After registering check if you got an email to verify your account and click the link (if there is none head to step 1.4)
|
||||
3. Log into weblate
|
||||
4. Head to https://translate.element.io/accounts/profile/ and select the languages you know and maybe another language you know too.
|
||||
6. Head to https://translate.element.io/accounts/profile/#subscriptions and select Element Web as Project
|
||||
4. Head to https://translate.riot.im/accounts/profile/ and select the languages you know and maybe another language you know too.
|
||||
6. Head to https://translate.riot.im/accounts/profile/#subscriptions and select Riot Web as Project
|
||||
|
||||
## How to check if your language already is being translated
|
||||
|
||||
Go to https://translate.element.io/projects/element-web/ and visit the 2 sub-projects.
|
||||
Go to https://translate.riot.im/projects/riot-web/ and visit the 2 sub-projects.
|
||||
If your language is listed go to Step 2a and if not go to Step 2b
|
||||
|
||||
## Step 2a: Helping on existing languages.
|
||||
|
||||
1. Head to one of the projects listed https://translate.element.io/projects/element-web/
|
||||
1. Head to one of the projects listed https://translate.riot.im/projects/riot-web/
|
||||
2. Click on the ``translate`` button on the right side of your language
|
||||
3. Fill in the translations in the writeable field. You will see the original English string and the string of your second language above.
|
||||
|
||||
@@ -34,8 +34,8 @@ Head to the explanations under Steb 2b
|
||||
|
||||
## Step 2b: Adding a new language
|
||||
|
||||
1. Go to one of the projects listed https://translate.element.io/projects/element-web/
|
||||
2. Click the ``Start new translation`` button at the bottom
|
||||
1. Go to one of the projects listed https://translate.riot.im/projects/riot-web/
|
||||
2. Click the ``Start new language`` button at the bottom
|
||||
3. Select a language
|
||||
4. Start translating like in 2a.3
|
||||
5. Repeat these steps for the other projects which are listed at the link of step 2b.1
|
||||
@@ -50,7 +50,7 @@ The yellow button has to be used if you are unsure about the translation but you
|
||||
|
||||
### What are "%(something)s"?
|
||||
|
||||
These things are variables that are expanded when displayed by Element. They can be room names, usernames or similar. If you find one, you can move to the right place for your language, but not delete it as the variable will be missing if you do.
|
||||
These things are variables that are expanded when displayed by Riot. They can be room names, usernames or similar. If you find one, you can move to the right place for your language, but not delete it as the variable will be missing if you do.
|
||||
|
||||
A special case is `%(urlStart)s` and `%(urlEnd)s` which are used to mark the beginning of a hyperlink (i.e. `<a href="/somewhere">` and `</a>`. You must keep these markers surrounding the equivalent string in your language that needs to be hyperlinked.
|
||||
|
||||
|
||||
BIN
electron_app/build/icon.icns
Normal file
BIN
electron_app/build/icon.ico
Normal file
|
After Width: | Height: | Size: 102 KiB |
BIN
electron_app/build/icons/128x128.png
Normal file
|
After Width: | Height: | Size: 7.2 KiB |
BIN
electron_app/build/icons/16x16.png
Normal file
|
After Width: | Height: | Size: 673 B |
BIN
electron_app/build/icons/24x24.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
electron_app/build/icons/256x256.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
electron_app/build/icons/48x48.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
electron_app/build/icons/512x512.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
electron_app/build/icons/64x64.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
electron_app/build/icons/96x96.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
BIN
electron_app/build/install-spinner.gif
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
electron_app/img/riot.ico
Normal file
|
After Width: | Height: | Size: 102 KiB |
BIN
electron_app/img/riot.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
14
electron_app/package.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "riot-web",
|
||||
"productName": "Riot",
|
||||
"main": "src/electron-main.js",
|
||||
"version": "0.12.0-rc.1",
|
||||
"description": "A feature-rich client for Matrix.org",
|
||||
"author": "Vector Creations Ltd.",
|
||||
"dependencies": {
|
||||
"auto-launch": "^5.0.1",
|
||||
"electron-window-state": "^4.1.0",
|
||||
"minimist": "^1.2.0",
|
||||
"png-to-ico": "^1.0.2"
|
||||
}
|
||||
}
|
||||
4
electron_app/riot.im/README
Normal file
@@ -0,0 +1,4 @@
|
||||
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.
|
||||
20
electron_app/riot.im/config.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"update_base_url": "https://riot.im/download/desktop/update/",
|
||||
"default_hs_url": "https://matrix.org",
|
||||
"default_is_url": "https://vector.im",
|
||||
"brand": "Riot",
|
||||
"integrations_ui_url": "https://scalar.vector.im/",
|
||||
"integrations_rest_url": "https://scalar.vector.im/api",
|
||||
"bug_report_endpoint_url": "https://riot.im/bugreports/submit",
|
||||
"welcomeUserId": "@riot-bot:matrix.org",
|
||||
"enableLabs": true,
|
||||
"roomDirectory": {
|
||||
"servers": [
|
||||
"matrix.org"
|
||||
]
|
||||
},
|
||||
"piwik": {
|
||||
"url": "https://piwik.riot.im/",
|
||||
"siteId": 1
|
||||
}
|
||||
}
|
||||
265
electron_app/src/electron-main.js
Normal file
@@ -0,0 +1,265 @@
|
||||
/*
|
||||
Copyright 2016 Aviral Dasgupta
|
||||
Copyright 2016 OpenMarket Ltd
|
||||
Copyright 2017 Michael Telatynski <7t3chguy@gmail.com>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Squirrel on windows starts the app with various flags
|
||||
// as hooks to tell us when we've been installed/uninstalled
|
||||
// etc.
|
||||
const checkSquirrelHooks = require('./squirrelhooks');
|
||||
if (checkSquirrelHooks()) return;
|
||||
|
||||
const argv = require('minimist')(process.argv);
|
||||
const electron = require('electron');
|
||||
const AutoLaunch = require('auto-launch');
|
||||
|
||||
const tray = require('./tray');
|
||||
const vectorMenu = require('./vectormenu');
|
||||
const webContentsHandler = require('./webcontents-handler');
|
||||
const updater = require('./updater');
|
||||
|
||||
const windowStateKeeper = require('electron-window-state');
|
||||
|
||||
if (argv.profile) {
|
||||
electron.app.setPath('userData', `${electron.app.getPath('userData')}-${argv.profile}`);
|
||||
}
|
||||
|
||||
let vectorConfig = {};
|
||||
try {
|
||||
vectorConfig = require('../../webapp/config.json');
|
||||
} catch (e) {
|
||||
// it would be nice to check the error code here and bail if the config
|
||||
// is unparseable, but we get MODULE_NOT_FOUND in the case of a missing
|
||||
// file or invalid json, so node is just very unhelpful.
|
||||
// Continue with the defaults (ie. an empty config)
|
||||
}
|
||||
|
||||
let mainWindow = null;
|
||||
global.appQuitting = false;
|
||||
|
||||
|
||||
// handle uncaught errors otherwise it displays
|
||||
// stack traces in popup dialogs, which is terrible (which
|
||||
// it will do any time the auto update poke fails, and there's
|
||||
// no other way to catch this error).
|
||||
// Assuming we generally run from the console when developing,
|
||||
// this is far preferable.
|
||||
process.on('uncaughtException', function(error) {
|
||||
console.log('Unhandled exception', error);
|
||||
});
|
||||
|
||||
let focusHandlerAttached = false;
|
||||
electron.ipcMain.on('setBadgeCount', function(ev, count) {
|
||||
electron.app.setBadgeCount(count);
|
||||
if (count === 0) {
|
||||
mainWindow.flashFrame(false);
|
||||
}
|
||||
});
|
||||
|
||||
electron.ipcMain.on('loudNotification', function() {
|
||||
if (process.platform === 'win32' && mainWindow && !mainWindow.isFocused() && !focusHandlerAttached) {
|
||||
mainWindow.flashFrame(true);
|
||||
mainWindow.once('focus', () => {
|
||||
mainWindow.flashFrame(false);
|
||||
focusHandlerAttached = false;
|
||||
});
|
||||
focusHandlerAttached = true;
|
||||
}
|
||||
});
|
||||
|
||||
let powerSaveBlockerId;
|
||||
electron.ipcMain.on('app_onAction', function(ev, payload) {
|
||||
switch (payload.action) {
|
||||
case 'call_state':
|
||||
if (powerSaveBlockerId && powerSaveBlockerId.isStarted(powerSaveBlockerId)) {
|
||||
if (payload.state === 'ended') {
|
||||
electron.powerSaveBlocker.stop(powerSaveBlockerId);
|
||||
}
|
||||
} else {
|
||||
if (payload.state === 'connected') {
|
||||
powerSaveBlockerId = electron.powerSaveBlocker.start('prevent-display-sleep');
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
electron.app.commandLine.appendSwitch('--enable-usermedia-screen-capturing');
|
||||
|
||||
const shouldQuit = electron.app.makeSingleInstance((commandLine, workingDirectory) => {
|
||||
// Someone tried to run a second instance, we should focus our window.
|
||||
if (mainWindow) {
|
||||
if (!mainWindow.isVisible()) mainWindow.show();
|
||||
if (mainWindow.isMinimized()) mainWindow.restore();
|
||||
mainWindow.focus();
|
||||
}
|
||||
});
|
||||
|
||||
if (shouldQuit) {
|
||||
console.log('Other instance detected: exiting');
|
||||
electron.app.exit();
|
||||
}
|
||||
|
||||
|
||||
const launcher = new AutoLaunch({
|
||||
name: vectorConfig.brand || 'Riot',
|
||||
isHidden: true,
|
||||
mac: {
|
||||
useLaunchAgent: true,
|
||||
},
|
||||
});
|
||||
|
||||
const settings = {
|
||||
'auto-launch': {
|
||||
get: launcher.isEnabled,
|
||||
set: function(bool) {
|
||||
if (bool) {
|
||||
return launcher.enable();
|
||||
} else {
|
||||
return launcher.disable();
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
electron.ipcMain.on('settings_get', async function(ev) {
|
||||
const data = {};
|
||||
|
||||
try {
|
||||
await Promise.all(Object.keys(settings).map(async function (setting) {
|
||||
data[setting] = await settings[setting].get();
|
||||
}));
|
||||
|
||||
ev.sender.send('settings', data);
|
||||
} catch(e) { console.error(e); }
|
||||
});
|
||||
|
||||
electron.ipcMain.on('settings_set', function(ev, key, value) {
|
||||
console.log(key, value);
|
||||
if (settings[key] && settings[key].set) {
|
||||
settings[key].set(value);
|
||||
}
|
||||
});
|
||||
|
||||
electron.app.on('ready', () => {
|
||||
|
||||
if (argv.devtools) {
|
||||
try {
|
||||
const { default: installExtension, REACT_DEVELOPER_TOOLS, REACT_PERF } = require('electron-devtools-installer');
|
||||
installExtension(REACT_DEVELOPER_TOOLS)
|
||||
.then((name) => console.log(`Added Extension: ${name}`))
|
||||
.catch((err) => console.log('An error occurred: ', err));
|
||||
installExtension(REACT_PERF)
|
||||
.then((name) => console.log(`Added Extension: ${name}`))
|
||||
.catch((err) => console.log('An error occurred: ', err));
|
||||
} catch(e) {console.log(e);}
|
||||
}
|
||||
|
||||
|
||||
if (vectorConfig.update_base_url) {
|
||||
console.log(`Starting auto update with base URL: ${vectorConfig.update_base_url}`);
|
||||
updater.start(vectorConfig.update_base_url);
|
||||
} else {
|
||||
console.log('No update_base_url is defined: auto update is disabled');
|
||||
}
|
||||
|
||||
const iconPath = `${__dirname}/../img/riot.${process.platform === 'win32' ? 'ico' : 'png'}`;
|
||||
|
||||
// Load the previous window state with fallback to defaults
|
||||
const mainWindowState = windowStateKeeper({
|
||||
defaultWidth: 1024,
|
||||
defaultHeight: 768,
|
||||
});
|
||||
|
||||
mainWindow = global.mainWindow = new electron.BrowserWindow({
|
||||
icon: iconPath,
|
||||
show: false,
|
||||
autoHideMenuBar: true,
|
||||
|
||||
x: mainWindowState.x,
|
||||
y: mainWindowState.y,
|
||||
width: mainWindowState.width,
|
||||
height: mainWindowState.height,
|
||||
});
|
||||
mainWindow.loadURL(`file://${__dirname}/../../webapp/index.html`);
|
||||
electron.Menu.setApplicationMenu(vectorMenu);
|
||||
|
||||
// explicitly hide because setApplicationMenu on Linux otherwise shows...
|
||||
// https://github.com/electron/electron/issues/9621
|
||||
mainWindow.hide();
|
||||
|
||||
// Create trayIcon icon
|
||||
tray.create({
|
||||
icon_path: iconPath,
|
||||
brand: vectorConfig.brand || 'Riot',
|
||||
});
|
||||
|
||||
if (!argv.hidden) {
|
||||
mainWindow.once('ready-to-show', () => {
|
||||
mainWindow.show();
|
||||
});
|
||||
}
|
||||
|
||||
mainWindow.on('closed', () => {
|
||||
mainWindow = global.mainWindow = null;
|
||||
});
|
||||
mainWindow.on('close', (e) => {
|
||||
if (!global.appQuitting && (tray.hasTray() || process.platform === 'darwin')) {
|
||||
// On Mac, closing the window just hides it
|
||||
// (this is generally how single-window Mac apps
|
||||
// behave, eg. Mail.app)
|
||||
e.preventDefault();
|
||||
mainWindow.hide();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
// Handle forward/backward mouse buttons in Windows
|
||||
mainWindow.on('app-command', (e, cmd) => {
|
||||
if (cmd === 'browser-backward' && mainWindow.webContents.canGoBack()) {
|
||||
mainWindow.webContents.goBack();
|
||||
} else if (cmd === 'browser-forward' && mainWindow.webContents.canGoForward()) {
|
||||
mainWindow.webContents.goForward();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
webContentsHandler(mainWindow.webContents);
|
||||
mainWindowState.manage(mainWindow);
|
||||
});
|
||||
|
||||
electron.app.on('window-all-closed', () => {
|
||||
electron.app.quit();
|
||||
});
|
||||
|
||||
electron.app.on('activate', () => {
|
||||
mainWindow.show();
|
||||
});
|
||||
|
||||
electron.app.on('before-quit', () => {
|
||||
global.appQuitting = true;
|
||||
if (mainWindow) {
|
||||
mainWindow.webContents.send('before-quit');
|
||||
}
|
||||
});
|
||||
|
||||
// Set the App User Model ID to match what the squirrel
|
||||
// installer uses for the shortcut icon.
|
||||
// This makes notifications work on windows 8.1 (and is
|
||||
// a noop on other platforms).
|
||||
electron.app.setAppUserModelId('com.squirrel.riot-web.Riot');
|
||||
51
electron_app/src/squirrelhooks.js
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
Copyright 2017 OpenMarket Ltd
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
const path = require('path');
|
||||
const spawn = require('child_process').spawn;
|
||||
const {app} = require('electron');
|
||||
|
||||
function runUpdateExe(args, done) {
|
||||
// Invokes Squirrel's Update.exe which will do things for us like create shortcuts
|
||||
// Note that there's an Update.exe in the app-x.x.x directory and one in the parent
|
||||
// directory: we need to run the one in the parent directory, because it discovers
|
||||
// information about the app by inspecting the directory it's run from.
|
||||
const updateExe = path.resolve(path.dirname(process.execPath), '..', 'Update.exe');
|
||||
console.log(`Spawning '${updateExe}' with args '${args}'`);
|
||||
spawn(updateExe, args, {
|
||||
detached: true,
|
||||
}).on('close', done);
|
||||
}
|
||||
|
||||
function checkSquirrelHooks() {
|
||||
if (process.platform !== 'win32') return false;
|
||||
|
||||
const cmd = process.argv[1];
|
||||
const target = path.basename(process.execPath);
|
||||
if (cmd === '--squirrel-install' || cmd === '--squirrel-updated') {
|
||||
runUpdateExe(['--createShortcut=' + target + ''], app.quit);
|
||||
return true;
|
||||
} else if (cmd === '--squirrel-uninstall') {
|
||||
runUpdateExe(['--removeShortcut=' + target + ''], app.quit);
|
||||
return true;
|
||||
} else if (cmd === '--squirrel-obsolete') {
|
||||
app.quit();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
module.exports = checkSquirrelHooks;
|
||||
99
electron_app/src/tray.js
Normal file
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
Copyright 2017 Karl Glatz <karl@glatz.biz>
|
||||
Copyright 2017 OpenMarket Ltd
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
const {app, Tray, Menu, nativeImage} = require('electron');
|
||||
const pngToIco = require('png-to-ico');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
let trayIcon = null;
|
||||
|
||||
exports.hasTray = function hasTray() {
|
||||
return (trayIcon !== null);
|
||||
};
|
||||
|
||||
exports.create = function(config) {
|
||||
// no trays on darwin
|
||||
if (process.platform === 'darwin' || trayIcon) return;
|
||||
|
||||
const toggleWin = function() {
|
||||
if (global.mainWindow.isVisible() && !global.mainWindow.isMinimized()) {
|
||||
global.mainWindow.hide();
|
||||
} else {
|
||||
if (global.mainWindow.isMinimized()) global.mainWindow.restore();
|
||||
if (!global.mainWindow.isVisible()) global.mainWindow.show();
|
||||
global.mainWindow.focus();
|
||||
}
|
||||
};
|
||||
|
||||
const contextMenu = Menu.buildFromTemplate([
|
||||
{
|
||||
label: `Show/Hide ${config.brand}`,
|
||||
click: toggleWin,
|
||||
},
|
||||
{ type: 'separator' },
|
||||
{
|
||||
label: 'Quit',
|
||||
click: function() {
|
||||
app.quit();
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
const defaultIcon = nativeImage.createFromPath(config.icon_path);
|
||||
|
||||
trayIcon = new Tray(defaultIcon);
|
||||
trayIcon.setToolTip(config.brand);
|
||||
trayIcon.setContextMenu(contextMenu);
|
||||
trayIcon.on('click', toggleWin);
|
||||
|
||||
let lastFavicon = null;
|
||||
global.mainWindow.webContents.on('page-favicon-updated', async function(ev, favicons) {
|
||||
if (!favicons || favicons.length <= 0 || !favicons[0].startsWith('data:')) {
|
||||
if (lastFavicon !== null) {
|
||||
win.setIcon(defaultIcon);
|
||||
trayIcon.setImage(defaultIcon);
|
||||
lastFavicon = null;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// No need to change, shortcut
|
||||
if (favicons[0] === lastFavicon) return;
|
||||
lastFavicon = favicons[0];
|
||||
|
||||
let newFavicon = nativeImage.createFromDataURL(favicons[0]);
|
||||
|
||||
// Windows likes ico's too much.
|
||||
if (process.platform === 'win32') {
|
||||
try {
|
||||
const icoPath = path.join(app.getPath('temp'), 'win32_riot_icon.ico');
|
||||
fs.writeFileSync(icoPath, await pngToIco(newFavicon.toPNG()));
|
||||
newFavicon = nativeImage.createFromPath(icoPath);
|
||||
} catch (e) {
|
||||
console.error("Failed to make win32 ico", e);
|
||||
}
|
||||
}
|
||||
|
||||
trayIcon.setImage(newFavicon);
|
||||
global.mainWindow.setIcon(newFavicon);
|
||||
});
|
||||
|
||||
global.mainWindow.webContents.on('page-title-updated', function(ev, title) {
|
||||
trayIcon.setToolTip(title);
|
||||
});
|
||||
};
|
||||
84
electron_app/src/updater.js
Normal file
@@ -0,0 +1,84 @@
|
||||
const { app, autoUpdater, ipcMain } = require('electron');
|
||||
|
||||
const UPDATE_POLL_INTERVAL_MS = 60 * 60 * 1000;
|
||||
const INITIAL_UPDATE_DELAY_MS = 30 * 1000;
|
||||
|
||||
function installUpdate() {
|
||||
// for some reason, quitAndInstall does not fire the
|
||||
// before-quit event, so we need to set the flag here.
|
||||
global.appQuitting = true;
|
||||
autoUpdater.quitAndInstall();
|
||||
}
|
||||
|
||||
function pollForUpdates() {
|
||||
try {
|
||||
autoUpdater.checkForUpdates();
|
||||
} catch (e) {
|
||||
console.log('Couldn\'t check for update', e);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {};
|
||||
module.exports.start = function startAutoUpdate(updateBaseUrl) {
|
||||
if (updateBaseUrl.slice(-1) !== '/') {
|
||||
updateBaseUrl = updateBaseUrl + '/';
|
||||
}
|
||||
try {
|
||||
let url;
|
||||
// For reasons best known to Squirrel, the way it checks for updates
|
||||
// is completely different between macOS and windows. On macOS, it
|
||||
// hits a URL that either gives it a 200 with some json or
|
||||
// 204 No Content. On windows it takes a base path and looks for
|
||||
// files under that path.
|
||||
if (process.platform === 'darwin') {
|
||||
// include the current version in the URL we hit. Electron doesn't add
|
||||
// it anywhere (apart from the User-Agent) so it's up to us. We could
|
||||
// (and previously did) just use the User-Agent, but this doesn't
|
||||
// rely on NSURLConnection setting the User-Agent to what we expect,
|
||||
// and also acts as a convenient cache-buster to ensure that when the
|
||||
// app updates it always gets a fresh value to avoid update-looping.
|
||||
url = `${updateBaseUrl}macos/?localVersion=${encodeURIComponent(app.getVersion())}`;
|
||||
|
||||
} else if (process.platform === 'win32') {
|
||||
url = `${updateBaseUrl}win32/${process.arch}/`;
|
||||
} else {
|
||||
// Squirrel / electron only supports auto-update on these two platforms.
|
||||
// I'm not even going to try to guess which feed style they'd use if they
|
||||
// implemented it on Linux, or if it would be different again.
|
||||
console.log('Auto update not supported on this platform');
|
||||
}
|
||||
|
||||
if (url) {
|
||||
autoUpdater.setFeedURL(url);
|
||||
// We check for updates ourselves rather than using 'updater' because we need to
|
||||
// do it in the main process (and we don't really need to check every 10 minutes:
|
||||
// every hour should be just fine for a desktop app)
|
||||
// However, we still let the main window listen for the update events.
|
||||
// We also wait a short time before checking for updates the first time because
|
||||
// of squirrel on windows and it taking a small amount of time to release a
|
||||
// lock file.
|
||||
setTimeout(pollForUpdates, INITIAL_UPDATE_DELAY_MS);
|
||||
setInterval(pollForUpdates, UPDATE_POLL_INTERVAL_MS);
|
||||
}
|
||||
} catch (err) {
|
||||
// will fail if running in debug mode
|
||||
console.log('Couldn\'t enable update checking', err);
|
||||
}
|
||||
}
|
||||
|
||||
ipcMain.on('install_update', installUpdate);
|
||||
ipcMain.on('check_updates', pollForUpdates);
|
||||
|
||||
function ipcChannelSendUpdateStatus(status) {
|
||||
if (global.mainWindow) {
|
||||
global.mainWindow.webContents.send('check_updates', status);
|
||||
}
|
||||
}
|
||||
|
||||
autoUpdater.on('update-available', function() {
|
||||
ipcChannelSendUpdateStatus(true);
|
||||
}).on('update-not-available', function() {
|
||||
ipcChannelSendUpdateStatus(false);
|
||||
}).on('error', function(error) {
|
||||
ipcChannelSendUpdateStatus(error.message);
|
||||
});
|
||||
137
electron_app/src/vectormenu.js
Normal file
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
Copyright 2016 OpenMarket Ltd
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
const {app, shell, Menu} = require('electron');
|
||||
|
||||
// Menu template from http://electron.atom.io/docs/api/menu/, edited
|
||||
const template = [
|
||||
{
|
||||
label: 'Edit',
|
||||
submenu: [
|
||||
{ role: 'undo' },
|
||||
{ role: 'redo' },
|
||||
{ type: 'separator' },
|
||||
{ role: 'cut' },
|
||||
{ role: 'copy' },
|
||||
{ role: 'paste' },
|
||||
{ role: 'pasteandmatchstyle' },
|
||||
{ role: 'delete' },
|
||||
{ role: 'selectall' },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'View',
|
||||
submenu: [
|
||||
{ type: 'separator' },
|
||||
{ role: 'resetzoom' },
|
||||
{ role: 'zoomin' },
|
||||
{ role: 'zoomout' },
|
||||
{ type: 'separator' },
|
||||
{ role: 'togglefullscreen' },
|
||||
{ role: 'toggledevtools' },
|
||||
],
|
||||
},
|
||||
{
|
||||
role: 'window',
|
||||
submenu: [
|
||||
{ role: 'minimize' },
|
||||
{ role: 'close' },
|
||||
],
|
||||
},
|
||||
{
|
||||
role: 'help',
|
||||
submenu: [
|
||||
{
|
||||
label: 'riot.im',
|
||||
click() { shell.openExternal('https://riot.im/'); },
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
// macOS has specific menu conventions...
|
||||
if (process.platform === 'darwin') {
|
||||
// first macOS menu is the name of the app
|
||||
const name = app.getName();
|
||||
template.unshift({
|
||||
label: name,
|
||||
submenu: [
|
||||
{ role: 'about' },
|
||||
{ type: 'separator' },
|
||||
{
|
||||
role: 'services',
|
||||
submenu: [],
|
||||
},
|
||||
{ type: 'separator' },
|
||||
{ role: 'hide' },
|
||||
{ role: 'hideothers' },
|
||||
{ role: 'unhide' },
|
||||
{ type: 'separator' },
|
||||
{ role: 'quit' },
|
||||
],
|
||||
});
|
||||
// Edit menu.
|
||||
// This has a 'speech' section on macOS
|
||||
template[1].submenu.push(
|
||||
{ type: 'separator' },
|
||||
{
|
||||
label: 'Speech',
|
||||
submenu: [
|
||||
{ role: 'startspeaking' },
|
||||
{ role: 'stopspeaking' },
|
||||
],
|
||||
});
|
||||
|
||||
// Window menu.
|
||||
// This also has specific functionality on macOS
|
||||
template[3].submenu = [
|
||||
{
|
||||
label: 'Close',
|
||||
accelerator: 'CmdOrCtrl+W',
|
||||
role: 'close',
|
||||
},
|
||||
{
|
||||
label: 'Minimize',
|
||||
accelerator: 'CmdOrCtrl+M',
|
||||
role: 'minimize',
|
||||
},
|
||||
{
|
||||
label: 'Zoom',
|
||||
role: 'zoom',
|
||||
},
|
||||
{
|
||||
type: 'separator',
|
||||
},
|
||||
{
|
||||
label: 'Bring All to Front',
|
||||
role: 'front',
|
||||
},
|
||||
];
|
||||
} else {
|
||||
template.unshift({
|
||||
label: 'File',
|
||||
submenu: [
|
||||
// For some reason, 'about' does not seem to work on windows.
|
||||
/*{
|
||||
role: 'about'
|
||||
},*/
|
||||
{ role: 'quit' },
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = Menu.buildFromTemplate(template);
|
||||
|
||||
122
electron_app/src/webcontents-handler.js
Normal file
@@ -0,0 +1,122 @@
|
||||
const {clipboard, nativeImage, Menu, MenuItem, shell} = require('electron');
|
||||
const url = require('url');
|
||||
|
||||
const PERMITTED_URL_SCHEMES = [
|
||||
'http:',
|
||||
'https:',
|
||||
'mailto:',
|
||||
];
|
||||
|
||||
function safeOpenURL(target) {
|
||||
// openExternal passes the target to open/start/xdg-open,
|
||||
// so put fairly stringent limits on what can be opened
|
||||
// (for instance, open /bin/sh does indeed open a terminal
|
||||
// with a shell, albeit with no arguments)
|
||||
const parsedUrl = url.parse(target);
|
||||
if (PERMITTED_URL_SCHEMES.indexOf(parsedUrl.protocol) > -1) {
|
||||
// explicitly use the URL re-assembled by the url library,
|
||||
// so we know the url parser has understood all the parts
|
||||
// of the input string
|
||||
const newTarget = url.format(parsedUrl);
|
||||
shell.openExternal(newTarget);
|
||||
}
|
||||
}
|
||||
|
||||
function onWindowOrNavigate(ev, target) {
|
||||
// always prevent the default: if something goes wrong,
|
||||
// we don't want to end up opening it in the electron
|
||||
// app, as we could end up opening any sort of random
|
||||
// url in a window that has node scripting access.
|
||||
ev.preventDefault();
|
||||
safeOpenURL(target);
|
||||
}
|
||||
|
||||
function onLinkContextMenu(ev, params) {
|
||||
const url = params.linkURL || params.srcURL;
|
||||
|
||||
const popupMenu = new Menu();
|
||||
popupMenu.append(new MenuItem({
|
||||
label: url,
|
||||
click() {
|
||||
safeOpenURL(url);
|
||||
},
|
||||
}));
|
||||
|
||||
if (params.mediaType && params.mediaType === 'image' && !url.startsWith('file://')) {
|
||||
popupMenu.append(new MenuItem({
|
||||
label: 'Copy Image',
|
||||
click() {
|
||||
if (url.startsWith('data:')) {
|
||||
clipboard.writeImage(nativeImage.createFromDataURL(url));
|
||||
} else {
|
||||
ev.sender.copyImageAt(params.x, params.y);
|
||||
}
|
||||
},
|
||||
}));
|
||||
}
|
||||
|
||||
popupMenu.append(new MenuItem({
|
||||
label: 'Copy Link Address',
|
||||
click() {
|
||||
clipboard.writeText(url);
|
||||
},
|
||||
}));
|
||||
popupMenu.popup();
|
||||
ev.preventDefault();
|
||||
}
|
||||
|
||||
function _CutCopyPasteSelectContextMenus(params) {
|
||||
return [{
|
||||
role: 'cut',
|
||||
enabled: params.editFlags.canCut,
|
||||
}, {
|
||||
role: 'copy',
|
||||
enabled: params.editFlags.canCopy,
|
||||
}, {
|
||||
role: 'paste',
|
||||
enabled: params.editFlags.canPaste,
|
||||
}, {
|
||||
role: 'pasteandmatchstyle',
|
||||
enabled: params.editFlags.canPaste,
|
||||
}, {
|
||||
role: 'selectall',
|
||||
enabled: params.editFlags.canSelectAll,
|
||||
}];
|
||||
}
|
||||
|
||||
function onSelectedContextMenu(ev, params) {
|
||||
const items = _CutCopyPasteSelectContextMenus(params);
|
||||
const popupMenu = Menu.buildFromTemplate(items);
|
||||
|
||||
popupMenu.popup();
|
||||
ev.preventDefault();
|
||||
}
|
||||
|
||||
function onEditableContextMenu(ev, params) {
|
||||
const items = [
|
||||
{ role: 'undo' },
|
||||
{ role: 'redo', enabled: params.editFlags.canRedo },
|
||||
{ type: 'separator' },
|
||||
].concat(_CutCopyPasteSelectContextMenus(params));
|
||||
|
||||
const popupMenu = Menu.buildFromTemplate(items);
|
||||
|
||||
popupMenu.popup();
|
||||
ev.preventDefault();
|
||||
}
|
||||
|
||||
|
||||
module.exports = (webContents) => {
|
||||
webContents.on('new-window', onWindowOrNavigate);
|
||||
webContents.on('will-navigate', onWindowOrNavigate);
|
||||
|
||||
webContents.on('context-menu', function(ev, params) {
|
||||
if (params.linkURL || params.srcURL) {
|
||||
onLinkContextMenu(ev, params);
|
||||
} else if (params.selectionText) {
|
||||
onSelectedContextMenu(ev, params);
|
||||
} else if (params.isEditable) {
|
||||
onEditableContextMenu(ev, params);
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -1,12 +0,0 @@
|
||||
This directory contains the config files and deployment scripts for the official
|
||||
element.io distribution of Element Web.
|
||||
|
||||
You probably do not want to build with this config unless you're building the
|
||||
official element.io distribution, but these files may be useful if you want to
|
||||
inspect the configuration used there.
|
||||
|
||||
Element Desktop uses a separate config (see
|
||||
https://github.com/vector-im/element-desktop/tree/develop/element.io).
|
||||
|
||||
Deployment scripts (such as app/deploy.py) are meant to be run on the web server
|
||||
hosting the Element installation.
|
||||
@@ -1,41 +0,0 @@
|
||||
{
|
||||
"default_server_name": "matrix.org",
|
||||
"brand": "Element",
|
||||
"integrations_ui_url": "https://scalar.vector.im/",
|
||||
"integrations_rest_url": "https://scalar.vector.im/api",
|
||||
"integrations_widgets_urls": [
|
||||
"https://scalar.vector.im/_matrix/integrations/v1",
|
||||
"https://scalar.vector.im/api",
|
||||
"https://scalar-staging.vector.im/_matrix/integrations/v1",
|
||||
"https://scalar-staging.vector.im/api",
|
||||
"https://scalar-staging.riot.im/scalar/api"
|
||||
],
|
||||
"hosting_signup_link": "https://element.io/matrix-services?utm_source=element-web&utm_medium=web",
|
||||
"bug_report_endpoint_url": "https://element.io/bugreports/submit",
|
||||
"showLabsSettings": false,
|
||||
"piwik": {
|
||||
"url": "https://piwik.riot.im/",
|
||||
"siteId": 1,
|
||||
"policyUrl": "https://element.io/cookie-policy"
|
||||
},
|
||||
"roomDirectory": {
|
||||
"servers": [
|
||||
"matrix.org",
|
||||
"gitter.im"
|
||||
]
|
||||
},
|
||||
"enable_presence_by_hs_url": {
|
||||
"https://matrix.org": false,
|
||||
"https://matrix-client.matrix.org": false
|
||||
},
|
||||
"terms_and_conditions_links": [
|
||||
{
|
||||
"url": "https://element.io/privacy",
|
||||
"text": "Privacy Policy"
|
||||
},
|
||||
{
|
||||
"url": "https://element.io/cookie-policy",
|
||||
"text": "Cookie Policy"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,191 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# download and unpack a element-web tarball.
|
||||
#
|
||||
# Allows `bundles` to be extracted to a common directory, and a link to
|
||||
# config.json to be added.
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import os.path
|
||||
import subprocess
|
||||
import sys
|
||||
import tarfile
|
||||
import shutil
|
||||
import glob
|
||||
|
||||
try:
|
||||
# python3
|
||||
from urllib.request import urlretrieve
|
||||
except ImportError:
|
||||
# python2
|
||||
from urllib import urlretrieve
|
||||
|
||||
class DeployException(Exception):
|
||||
pass
|
||||
|
||||
def create_relative_symlink(linkname, target):
|
||||
relpath = os.path.relpath(target, os.path.dirname(linkname))
|
||||
print ("Symlink %s -> %s" % (linkname, relpath))
|
||||
os.symlink(relpath, linkname)
|
||||
|
||||
|
||||
def move_bundles(source, dest):
|
||||
"""Move the contents of the 'bundles' directory to a common dir
|
||||
|
||||
We check that we will not be overwriting anything before we proceed.
|
||||
|
||||
Args:
|
||||
source (str): path to 'bundles' within the extracted tarball
|
||||
dest (str): target common directory
|
||||
"""
|
||||
|
||||
if not os.path.isdir(dest):
|
||||
os.mkdir(dest)
|
||||
|
||||
# build a map from source to destination, checking for non-existence as we go.
|
||||
renames = {}
|
||||
for f in os.listdir(source):
|
||||
dst = os.path.join(dest, f)
|
||||
if os.path.exists(dst):
|
||||
print (
|
||||
"Skipping bundle. The bundle includes '%s' which we have previously deployed."
|
||||
% f
|
||||
)
|
||||
else:
|
||||
renames[os.path.join(source, f)] = dst
|
||||
|
||||
for (src, dst) in renames.iteritems():
|
||||
print ("Move %s -> %s" % (src, dst))
|
||||
os.rename(src, dst)
|
||||
|
||||
class Deployer:
|
||||
def __init__(self):
|
||||
self.packages_path = "."
|
||||
self.bundles_path = None
|
||||
self.should_clean = False
|
||||
# filename -> symlink path e.g 'config.localhost.json' => '../localhost/config.json'
|
||||
self.symlink_paths = {}
|
||||
self.verify_signature = True
|
||||
|
||||
def deploy(self, tarball, extract_path):
|
||||
"""Download a tarball if necessary, and unpack it
|
||||
|
||||
Returns:
|
||||
(str) the path to the unpacked deployment
|
||||
"""
|
||||
print("Deploying %s to %s" % (tarball, extract_path))
|
||||
|
||||
name_str = os.path.basename(tarball).replace(".tar.gz", "")
|
||||
extracted_dir = os.path.join(extract_path, name_str)
|
||||
if os.path.exists(extracted_dir):
|
||||
raise DeployException('Cannot unpack %s: %s already exists' % (
|
||||
tarball, extracted_dir))
|
||||
|
||||
downloaded = False
|
||||
if tarball.startswith("http://") or tarball.startswith("https://"):
|
||||
tarball = self.download_and_verify(tarball)
|
||||
print("Downloaded file: %s" % tarball)
|
||||
downloaded = True
|
||||
|
||||
try:
|
||||
with tarfile.open(tarball) as tar:
|
||||
tar.extractall(extract_path)
|
||||
finally:
|
||||
if self.should_clean and downloaded:
|
||||
os.remove(tarball)
|
||||
|
||||
print ("Extracted into: %s" % extracted_dir)
|
||||
|
||||
if self.symlink_paths:
|
||||
for link_path, file_path in self.symlink_paths.iteritems():
|
||||
create_relative_symlink(
|
||||
target=file_path,
|
||||
linkname=os.path.join(extracted_dir, link_path)
|
||||
)
|
||||
|
||||
if self.bundles_path:
|
||||
extracted_bundles = os.path.join(extracted_dir, 'bundles')
|
||||
move_bundles(source=extracted_bundles, dest=self.bundles_path)
|
||||
|
||||
# replace the extracted_bundles dir (which may not be empty if some
|
||||
# bundles were skipped) with a symlink to the common dir.
|
||||
shutil.rmtree(extracted_bundles)
|
||||
create_relative_symlink(
|
||||
target=self.bundles_path,
|
||||
linkname=extracted_bundles,
|
||||
)
|
||||
return extracted_dir
|
||||
|
||||
def download_and_verify(self, url):
|
||||
tarball = self.download_file(url)
|
||||
|
||||
if self.verify_signature:
|
||||
sigfile = self.download_file(url + ".asc")
|
||||
subprocess.check_call(["gpg", "--verify", sigfile, tarball])
|
||||
|
||||
return tarball
|
||||
|
||||
def download_file(self, url):
|
||||
if not os.path.isdir(self.packages_path):
|
||||
os.mkdir(self.packages_path)
|
||||
local_filename = os.path.join(self.packages_path,
|
||||
url.split('/')[-1])
|
||||
sys.stdout.write("Downloading %s -> %s..." % (url, local_filename))
|
||||
sys.stdout.flush()
|
||||
urlretrieve(url, local_filename)
|
||||
print ("Done")
|
||||
return local_filename
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser("Deploy a Riot build on a web server.")
|
||||
parser.add_argument(
|
||||
"-p", "--packages-dir", default="./packages", help=(
|
||||
"The directory to download the tarball into. (Default: '%(default)s')"
|
||||
)
|
||||
)
|
||||
parser.add_argument(
|
||||
"-e", "--extract-path", default="./deploys", help=(
|
||||
"The location to extract .tar.gz files to. (Default: '%(default)s')"
|
||||
)
|
||||
)
|
||||
parser.add_argument(
|
||||
"-b", "--bundles-dir", nargs='?', default="./bundles", help=(
|
||||
"A directory to move the contents of the 'bundles' directory to. A \
|
||||
symlink to the bundles directory will also be written inside the \
|
||||
extracted tarball. Example: './bundles'. \
|
||||
(Default: '%(default)s')"
|
||||
)
|
||||
)
|
||||
parser.add_argument(
|
||||
"-c", "--clean", action="store_true", default=False, help=(
|
||||
"Remove .tar.gz files after they have been downloaded and extracted. \
|
||||
(Default: %(default)s)"
|
||||
)
|
||||
)
|
||||
parser.add_argument(
|
||||
"--include", nargs='*', default=['./config*.json'], help=(
|
||||
"Symlink these files into the root of the deployed tarball. \
|
||||
Useful for config files and home pages. Supports glob syntax. \
|
||||
(Default: '%(default)s')"
|
||||
)
|
||||
)
|
||||
parser.add_argument(
|
||||
"tarball", help=(
|
||||
"filename of tarball, or URL to download."
|
||||
),
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
deployer = Deployer()
|
||||
deployer.packages_path = args.packages_dir
|
||||
deployer.bundles_path = args.bundles_dir
|
||||
deployer.should_clean = args.clean
|
||||
|
||||
for include in args.include:
|
||||
deployer.symlink_paths.update({ os.path.basename(pth): pth for pth in glob.iglob(include) })
|
||||
|
||||
deployer.deploy(args.tarball, args.extract_path)
|
||||
@@ -1,41 +0,0 @@
|
||||
{
|
||||
"default_server_name": "matrix.org",
|
||||
"brand": "Element",
|
||||
"integrations_ui_url": "https://scalar-staging.vector.im/",
|
||||
"integrations_rest_url": "https://scalar-staging.vector.im/api",
|
||||
"integrations_widgets_urls": [
|
||||
"https://scalar.vector.im/_matrix/integrations/v1",
|
||||
"https://scalar.vector.im/api",
|
||||
"https://scalar-staging.vector.im/_matrix/integrations/v1",
|
||||
"https://scalar-staging.vector.im/api",
|
||||
"https://scalar-staging.riot.im/scalar/api"
|
||||
],
|
||||
"hosting_signup_link": "https://element.io/matrix-services?utm_source=element-web&utm_medium=web",
|
||||
"bug_report_endpoint_url": "https://element.io/bugreports/submit",
|
||||
"showLabsSettings": true,
|
||||
"piwik": {
|
||||
"url": "https://piwik.riot.im/",
|
||||
"siteId": 1,
|
||||
"policyUrl": "https://element.io/cookie-policy"
|
||||
},
|
||||
"roomDirectory": {
|
||||
"servers": [
|
||||
"matrix.org",
|
||||
"gitter.im"
|
||||
]
|
||||
},
|
||||
"enable_presence_by_hs_url": {
|
||||
"https://matrix.org": false,
|
||||
"https://matrix-client.matrix.org": false
|
||||
},
|
||||
"terms_and_conditions_links": [
|
||||
{
|
||||
"url": "https://element.io/privacy",
|
||||
"text": "Privacy Policy"
|
||||
},
|
||||
{
|
||||
"url": "https://element.io/cookie-policy",
|
||||
"text": "Cookie Policy"
|
||||
}
|
||||
]
|
||||
}
|
||||
171
karma.conf.js
Normal file
@@ -0,0 +1,171 @@
|
||||
// karma.conf.js - the config file for karma, which runs our tests.
|
||||
|
||||
var path = require('path');
|
||||
var webpack = require('webpack');
|
||||
var webpack_config = require('./webpack.config');
|
||||
|
||||
/*
|
||||
* We use webpack to build our tests. It's a pain to have to wait for webpack
|
||||
* to build everything; however it's the easiest way to load our dependencies
|
||||
* from node_modules.
|
||||
*
|
||||
* If you run karma in multi-run mode (with `npm run test-multi`), it will watch
|
||||
* the tests for changes, and webpack will rebuild using a cache. This is much quicker
|
||||
* than a clean rebuild.
|
||||
*/
|
||||
|
||||
// the name of the test file. By default, a special file which runs all tests.
|
||||
var testFile = process.env.KARMA_TEST_FILE || 'test/all-tests.js';
|
||||
|
||||
process.env.PHANTOMJS_BIN = 'node_modules/.bin/phantomjs';
|
||||
process.env.Q_DEBUG = 1;
|
||||
|
||||
/* the webpack config is based on the real one, to (a) try to simulate the
|
||||
* deployed environment as closely as possible, and (b) to avoid a shedload of
|
||||
* cut-and-paste.
|
||||
*/
|
||||
|
||||
// find out if we're shipping olm, and where it is, if so.
|
||||
const olm_entry = webpack_config.entry['olm'];
|
||||
|
||||
// remove the default entries - karma provides its own (via the 'files' and
|
||||
// 'preprocessors' config below)
|
||||
delete webpack_config['entry'];
|
||||
|
||||
// add ./test as a search path for js
|
||||
webpack_config.module.loaders.unshift({
|
||||
test: /\.js$/, loader: "babel",
|
||||
include: [path.resolve('./src'), path.resolve('./test')],
|
||||
});
|
||||
|
||||
// disable parsing for sinon, because it
|
||||
// tries to do voodoo with 'require' which upsets
|
||||
// webpack (https://github.com/webpack/webpack/issues/304)
|
||||
webpack_config.module.noParse.push(/sinon\/pkg\/sinon\.js$/);
|
||||
|
||||
// ?
|
||||
webpack_config.resolve.alias['sinon'] = 'sinon/pkg/sinon.js';
|
||||
|
||||
webpack_config.resolve.root = [
|
||||
path.resolve('./test'),
|
||||
];
|
||||
|
||||
webpack_config.devtool = 'inline-source-map';
|
||||
|
||||
module.exports = function (config) {
|
||||
const myconfig = {
|
||||
// frameworks to use
|
||||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
||||
frameworks: ['mocha'],
|
||||
|
||||
// list of files / patterns to load in the browser
|
||||
files: [
|
||||
'node_modules/babel-polyfill/browser.js',
|
||||
testFile,
|
||||
|
||||
// make the images available via our httpd. They will be avaliable
|
||||
// below http://localhost:[PORT]/base/. See also `proxies` which
|
||||
// defines alternative URLs for them.
|
||||
//
|
||||
// This isn't required by any of the tests, but it stops karma
|
||||
// logging warnings when it serves a 404 for them.
|
||||
{
|
||||
pattern: 'src/skins/vector/img/*',
|
||||
watched: false, included: false, served: true, nocache: false,
|
||||
},
|
||||
],
|
||||
|
||||
proxies: {
|
||||
// redirect img links to the karma server. See above.
|
||||
"/img/": "/base/src/skins/vector/img/",
|
||||
},
|
||||
|
||||
// preprocess matching files before serving them to the browser
|
||||
// available preprocessors:
|
||||
// https://npmjs.org/browse/keyword/karma-preprocessor
|
||||
preprocessors: {
|
||||
'{src,test}/**/*.js': ['webpack', 'sourcemap'],
|
||||
},
|
||||
|
||||
// test results reporter to use
|
||||
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
||||
reporters: ['logcapture', 'spec', 'junit', 'summary'],
|
||||
|
||||
specReporter: {
|
||||
suppressErrorSummary: false, // do print error summary
|
||||
suppressFailed: false, // do print information about failed tests
|
||||
suppressPassed: false, // do print information about passed tests
|
||||
showSpecTiming: true, // print the time elapsed for each spec
|
||||
},
|
||||
|
||||
client: {
|
||||
captureLogs: true,
|
||||
},
|
||||
|
||||
// web server port
|
||||
port: 9876,
|
||||
|
||||
// enable / disable colors in the output (reporters and logs)
|
||||
colors: true,
|
||||
|
||||
// level of logging
|
||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR ||
|
||||
// config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||
logLevel: config.LOG_INFO,
|
||||
|
||||
// enable / disable watching file and executing tests whenever any file
|
||||
// changes
|
||||
autoWatch: true,
|
||||
|
||||
// start these browsers
|
||||
// available browser launchers:
|
||||
// https://npmjs.org/browse/keyword/karma-launcher
|
||||
browsers: [
|
||||
'Chrome',
|
||||
//'PhantomJS',
|
||||
//'ChromeHeadless'
|
||||
],
|
||||
|
||||
customLaunchers: {
|
||||
'ChromeHeadless': {
|
||||
base: 'Chrome',
|
||||
flags: [
|
||||
// '--no-sandbox',
|
||||
// See https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md
|
||||
'--headless',
|
||||
'--disable-gpu',
|
||||
// Without a remote debugging port, Google Chrome exits immediately.
|
||||
'--remote-debugging-port=9222',
|
||||
],
|
||||
}
|
||||
},
|
||||
|
||||
// Continuous Integration mode
|
||||
// if true, Karma captures browsers, runs the tests and exits
|
||||
// singleRun: false,
|
||||
|
||||
// Concurrency level
|
||||
// how many browser should be started simultaneous
|
||||
concurrency: Infinity,
|
||||
|
||||
junitReporter: {
|
||||
outputDir: 'karma-reports',
|
||||
},
|
||||
|
||||
webpack: webpack_config,
|
||||
|
||||
webpackMiddleware: {
|
||||
stats: {
|
||||
// don't fill the console up with a mahoosive list of modules
|
||||
chunks: false,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
// include the olm loader if we have it.
|
||||
if (olm_entry) {
|
||||
myconfig.files.unshift(olm_entry);
|
||||
}
|
||||
|
||||
config.set(myconfig);
|
||||
};
|
||||
298
package.json
@@ -1,175 +1,185 @@
|
||||
{
|
||||
"name": "element-web",
|
||||
"version": "1.7.20",
|
||||
"name": "riot-web",
|
||||
"productName": "Riot",
|
||||
"main": "electron_app/src/electron-main.js",
|
||||
"version": "0.12.0-rc.1",
|
||||
"description": "A feature-rich client for Matrix.org",
|
||||
"author": "New Vector Ltd.",
|
||||
"author": "Vector Creations Ltd.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/vector-im/element-web"
|
||||
"url": "https://github.com/vector-im/riot-web"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"files": [
|
||||
"lib",
|
||||
"res",
|
||||
"src",
|
||||
"webpack.config.js",
|
||||
"scripts",
|
||||
"docs",
|
||||
"release.sh",
|
||||
"deploy",
|
||||
"CHANGELOG.md",
|
||||
"CONTRIBUTING.rst",
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"AUTHORS.rst",
|
||||
"package.json",
|
||||
"contribute.json"
|
||||
"CONTRIBUTING.rst",
|
||||
"deploy",
|
||||
"docs",
|
||||
"karma.conf.js",
|
||||
"lib",
|
||||
"release.sh",
|
||||
"scripts",
|
||||
"src",
|
||||
"test",
|
||||
"webpack.config.js"
|
||||
],
|
||||
"style": "bundle.css",
|
||||
"matrix-react-parent": "matrix-react-sdk",
|
||||
"scripts": {
|
||||
"i18n": "matrix-gen-i18n",
|
||||
"prunei18n": "matrix-prune-i18n",
|
||||
"diff-i18n": "cp src/i18n/strings/en_EN.json src/i18n/strings/en_EN_orig.json && yarn i18n && node scripts/compare-file.js src/i18n/strings/en_EN_orig.json src/i18n/strings/en_EN.json",
|
||||
"reskindex": "reskindex -h src/header",
|
||||
"reskindex:watch": "reskindex -h src/header -w",
|
||||
"reskindex:watch-react": "node scripts/yarn-sub.js matrix-react-sdk reskindex:watch",
|
||||
"clean": "rimraf lib webapp",
|
||||
"build": "yarn clean && yarn build:genfiles && yarn build:bundle",
|
||||
"build-stats": "yarn clean && yarn build:genfiles && yarn build:bundle-stats",
|
||||
"build:jitsi": "node scripts/build-jitsi.js",
|
||||
"build:res": "node scripts/copy-res.js",
|
||||
"build:genfiles": "yarn reskindex && yarn build:res && yarn build:jitsi",
|
||||
"build:modernizr": "modernizr -c .modernizr.json -d src/vector/modernizr.js",
|
||||
"build:bundle": "webpack --progress --bail --mode production",
|
||||
"build:bundle-stats": "webpack --progress --bail --mode production --json > webpack-stats.json",
|
||||
"build:compile": "npm run reskindex && babel --source-maps -d lib src",
|
||||
"build:bundle": "cross-env NODE_ENV=production webpack -p --progress --bail",
|
||||
"build:bundle:dev": "webpack --optimize-occurence-order --progress --bail",
|
||||
"build:electron": "npm run clean && npm run build && npm run install:electron && build -wml --ia32 --x64",
|
||||
"build": "npm run reskindex && npm run build:res && npm run build:bundle",
|
||||
"build:dev": "npm run reskindex && npm run build:res && npm run build:bundle:dev",
|
||||
"dist": "scripts/package.sh",
|
||||
"start": "concurrently --kill-others-on-fail --prefix \"{time} [{name}]\" -n reskindex,reskindex-react,res,element-js \"yarn reskindex:watch\" \"yarn reskindex:watch-react\" \"yarn start:res\" \"yarn start:js\"",
|
||||
"start:res": "yarn build:jitsi && node scripts/copy-res.js -w",
|
||||
"start:js": "webpack-dev-server --host=0.0.0.0 --output-filename=bundles/_dev_/[name].js --output-chunk-filename=bundles/_dev_/[name].js -w --progress --mode development",
|
||||
"lint": "yarn lint:types && yarn lint:js && yarn lint:style",
|
||||
"lint:js": "eslint src",
|
||||
"lint:types": "tsc --noEmit --jsx react",
|
||||
"lint:style": "stylelint 'res/css/**/*.scss'",
|
||||
"test": "jest"
|
||||
"install:electron": "install-app-deps",
|
||||
"electron": "npm run install:electron && electron .",
|
||||
"start:res": "node scripts/copy-res.js -w",
|
||||
"start:js": "webpack-dev-server --output-filename=bundles/_dev_/[name].js --output-chunk-file=bundles/_dev_/[name].js -w --progress",
|
||||
"start:js:prod": "cross-env NODE_ENV=production webpack-dev-server -w --progress",
|
||||
"start": "parallelshell \"npm run reskindex:watch\" \"npm run start:res\" \"npm run start:js\"",
|
||||
"start:prod": "parallelshell \"npm run reskindex:watch\" \"npm run start:res\" \"npm run start:js:prod\"",
|
||||
"lint": "eslint src/",
|
||||
"lintall": "eslint src/ test/",
|
||||
"clean": "rimraf lib webapp electron_app/dist",
|
||||
"prepublish": "npm run build:compile",
|
||||
"test": "karma start --single-run=true --autoWatch=false --browsers ChromeHeadless",
|
||||
"test-multi": "karma start"
|
||||
},
|
||||
"dependencies": {
|
||||
"babel-polyfill": "^6.5.0",
|
||||
"babel-runtime": "^6.11.6",
|
||||
"bluebird": "^3.5.0",
|
||||
"browser-request": "^0.3.3",
|
||||
"gfm.css": "^1.1.2",
|
||||
"highlight.js": "^10.5.0",
|
||||
"jsrsasign": "^10.1.5",
|
||||
"katex": "^0.12.0",
|
||||
"matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop",
|
||||
"matrix-react-sdk": "github:matrix-org/matrix-react-sdk#develop",
|
||||
"matrix-widget-api": "^0.1.0-beta.13",
|
||||
"olm": "https://packages.matrix.org/npm/olm/olm-3.2.1.tgz",
|
||||
"prop-types": "^15.7.2",
|
||||
"react": "^16.14.0",
|
||||
"react-dom": "^16.14.0",
|
||||
"sanitize-html": "github:apostrophecms/sanitize-html#3c7f93f2058f696f5359e3e58d464161647226db",
|
||||
"ua-parser-js": "^0.7.23"
|
||||
"classnames": "^2.1.2",
|
||||
"draft-js": "^0.11.0-alpha",
|
||||
"extract-text-webpack-plugin": "^0.9.1",
|
||||
"favico.js": "^0.3.10",
|
||||
"filesize": "3.5.6",
|
||||
"flux": "2.1.1",
|
||||
"gemini-scrollbar": "matrix-org/gemini-scrollbar#b302279",
|
||||
"gfm.css": "^1.1.1",
|
||||
"highlight.js": "^9.0.0",
|
||||
"linkifyjs": "^2.1.3",
|
||||
"matrix-js-sdk": "0.8.0",
|
||||
"matrix-react-sdk": "0.10.0-rc.1",
|
||||
"modernizr": "^3.1.0",
|
||||
"pako": "^1.0.5",
|
||||
"react": "^15.6.0",
|
||||
"react-dnd": "^2.1.4",
|
||||
"react-dnd-html5-backend": "^2.1.2",
|
||||
"react-dom": "^15.6.0",
|
||||
"react-gemini-scrollbar": "matrix-org/react-gemini-scrollbar#5e97aef",
|
||||
"react-sticky": "^6.0.1",
|
||||
"sanitize-html": "^1.11.1",
|
||||
"text-encoding-utf-8": "^1.0.1",
|
||||
"ua-parser-js": "^0.7.10",
|
||||
"url": "^0.11.0",
|
||||
"velocity-vector": "vector-im/velocity#059e3b2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.12.10",
|
||||
"@babel/plugin-proposal-class-properties": "^7.12.1",
|
||||
"@babel/plugin-proposal-decorators": "^7.12.12",
|
||||
"@babel/plugin-proposal-export-default-from": "^7.12.1",
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1",
|
||||
"@babel/plugin-proposal-numeric-separator": "^7.12.7",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.12.1",
|
||||
"@babel/plugin-proposal-optional-chaining": "^7.12.7",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
||||
"@babel/plugin-transform-flow-comments": "^7.12.1",
|
||||
"@babel/plugin-transform-runtime": "^7.12.10",
|
||||
"@babel/preset-env": "^7.12.11",
|
||||
"@babel/preset-flow": "^7.12.1",
|
||||
"@babel/preset-react": "^7.12.10",
|
||||
"@babel/preset-typescript": "^7.12.7",
|
||||
"@babel/register": "^7.12.10",
|
||||
"@babel/runtime": "^7.12.5",
|
||||
"@types/flux": "^3.1.9",
|
||||
"@types/modernizr": "^3.5.3",
|
||||
"@types/node": "^14.14.22",
|
||||
"@types/react": "^16.9",
|
||||
"@types/react-dom": "^16.9.10",
|
||||
"@types/sanitize-html": "^1.27.1",
|
||||
"autoprefixer": "^9.8.6",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"babel-jest": "^26.6.3",
|
||||
"babel-loader": "^8.2.2",
|
||||
"canvas": "^2.6.1",
|
||||
"chokidar": "^3.5.1",
|
||||
"concurrently": "^5.3.0",
|
||||
"cpx": "^1.5.0",
|
||||
"css-loader": "^3.6.0",
|
||||
"eslint": "7.18.0",
|
||||
"eslint-config-matrix-org": "^0.2.0",
|
||||
"eslint-plugin-babel": "^5.3.1",
|
||||
"eslint-plugin-flowtype": "^5.2.0",
|
||||
"eslint-plugin-react": "^7.22.0",
|
||||
"eslint-plugin-react-hooks": "^4.2.0",
|
||||
"extract-text-webpack-plugin": "^4.0.0-beta.0",
|
||||
"fake-indexeddb": "^3.1.2",
|
||||
"file-loader": "^5.1.0",
|
||||
"autoprefixer": "^6.6.0",
|
||||
"babel-cli": "^6.5.2",
|
||||
"babel-core": "^6.14.0",
|
||||
"babel-eslint": "^6.1.0",
|
||||
"babel-loader": "^6.2.5",
|
||||
"babel-plugin-add-module-exports": "^0.2.1",
|
||||
"babel-plugin-transform-async-to-bluebird": "^1.1.1",
|
||||
"babel-plugin-transform-class-properties": "^6.16.0",
|
||||
"babel-plugin-transform-object-rest-spread": "^6.16.0",
|
||||
"babel-plugin-transform-runtime": "^6.15.0",
|
||||
"babel-preset-es2015": "^6.16.0",
|
||||
"babel-preset-es2016": "^6.16.0",
|
||||
"babel-preset-es2017": "^6.16.0",
|
||||
"babel-preset-react": "^6.16.0",
|
||||
"babel-preset-stage-2": "^6.17.0",
|
||||
"chokidar": "^1.6.1",
|
||||
"cpx": "^1.3.2",
|
||||
"cross-env": "^4.0.0",
|
||||
"css-raw-loader": "^0.1.1",
|
||||
"electron-builder": "^11.2.4",
|
||||
"electron-builder-squirrel-windows": "^11.2.1",
|
||||
"electron-devtools-installer": "^2.2.0",
|
||||
"emojione": "^2.2.7",
|
||||
"eslint": "^3.14.0",
|
||||
"eslint-config-google": "^0.7.1",
|
||||
"eslint-plugin-babel": "^4.1.1",
|
||||
"eslint-plugin-flowtype": "^2.30.0",
|
||||
"eslint-plugin-react": "^6.9.0",
|
||||
"expect": "^1.16.0",
|
||||
"fs-extra": "^0.30.0",
|
||||
"html-webpack-plugin": "^3.2.0",
|
||||
"jest": "^26.6.3",
|
||||
"jest-environment-jsdom-sixteen": "^1.0.3",
|
||||
"json-loader": "^0.5.7",
|
||||
"loader-utils": "^1.4.0",
|
||||
"matrix-mock-request": "^1.2.3",
|
||||
"matrix-react-test-utils": "^0.2.2",
|
||||
"mini-css-extract-plugin": "^0.12.0",
|
||||
"minimist": "^1.2.5",
|
||||
"mkdirp": "^1.0.4",
|
||||
"modernizr": "^3.11.4",
|
||||
"node-fetch": "^2.6.1",
|
||||
"optimize-css-assets-webpack-plugin": "^5.0.4",
|
||||
"postcss-calc": "^7.0.5",
|
||||
"postcss-easings": "^2.0.0",
|
||||
"html-webpack-plugin": "^2.24.0",
|
||||
"json-loader": "^0.5.3",
|
||||
"karma": "^1.7.0",
|
||||
"karma-chrome-launcher": "^0.2.3",
|
||||
"karma-cli": "^0.1.2",
|
||||
"karma-junit-reporter": "^0.4.1",
|
||||
"karma-logcapture-reporter": "0.0.1",
|
||||
"karma-mocha": "^0.2.2",
|
||||
"karma-sourcemap-loader": "^0.3.7",
|
||||
"karma-spec-reporter": "0.0.31",
|
||||
"karma-summary-reporter": "^1.3.3",
|
||||
"karma-webpack": "^1.7.0",
|
||||
"matrix-mock-request": "^1.2.0",
|
||||
"matrix-react-test-utils": "^0.2.0",
|
||||
"minimist": "^1.2.0",
|
||||
"mkdirp": "^0.5.1",
|
||||
"mocha": "^2.4.5",
|
||||
"parallelshell": "^1.2.0",
|
||||
"postcss-extend": "^1.0.5",
|
||||
"postcss-hexrgba": "^2.0.1",
|
||||
"postcss-import": "^12.0.1",
|
||||
"postcss-loader": "^3.0.0",
|
||||
"postcss-mixins": "^6.2.3",
|
||||
"postcss-nested": "^4.2.3",
|
||||
"postcss-preset-env": "^6.7.0",
|
||||
"postcss-scss": "^2.1.1",
|
||||
"postcss-simple-vars": "^5.0.2",
|
||||
"postcss-import": "^9.0.0",
|
||||
"postcss-loader": "^1.2.2",
|
||||
"postcss-mixins": "^5.4.1",
|
||||
"postcss-nested": "^1.0.0",
|
||||
"postcss-scss": "^0.4.0",
|
||||
"postcss-simple-vars": "^3.0.0",
|
||||
"postcss-strip-inline-comments": "^0.1.5",
|
||||
"rimraf": "^3.0.2",
|
||||
"shell-escape": "^0.2.0",
|
||||
"simple-proxy-agent": "^1.1.0",
|
||||
"stylelint": "^13.9.0",
|
||||
"terser-webpack-plugin": "^2.3.8",
|
||||
"typescript": "^4.1.3",
|
||||
"webpack": "^4.46.0",
|
||||
"webpack-cli": "^3.3.12",
|
||||
"webpack-dev-server": "^3.11.2"
|
||||
"react-addons-perf": "^15.4.0",
|
||||
"react-addons-test-utils": "^15.6.0",
|
||||
"rimraf": "^2.4.3",
|
||||
"source-map-loader": "^0.1.5",
|
||||
"webpack": "^1.12.14",
|
||||
"webpack-dev-server": "^1.16.2"
|
||||
},
|
||||
"resolutions": {
|
||||
"**/@types/react": "^16.14"
|
||||
"optionalDependencies": {
|
||||
"olm": "https://matrix.org/packages/npm/olm/olm-2.2.1.tgz"
|
||||
},
|
||||
"jest": {
|
||||
"testEnvironment": "jest-environment-jsdom-sixteen",
|
||||
"testMatch": [
|
||||
"<rootDir>/test/**/*-test.js"
|
||||
"build": {
|
||||
"appId": "im.riot.app",
|
||||
"category": "Network",
|
||||
"electronVersion": "1.6.8",
|
||||
"//asar=false": "https://github.com/electron-userland/electron-builder/issues/675",
|
||||
"asar": false,
|
||||
"dereference": true,
|
||||
"//files": "We bundle everything, so we only need to include webapp/",
|
||||
"files": [
|
||||
"node_modules/**",
|
||||
"src/**",
|
||||
"img/**"
|
||||
],
|
||||
"setupFilesAfterEnv": [
|
||||
"<rootDir>/node_modules/matrix-react-sdk/test/setupTests.js"
|
||||
"extraResources": [
|
||||
"webapp/**/*"
|
||||
],
|
||||
"moduleNameMapper": {
|
||||
"\\.(css|scss)$": "<rootDir>/__mocks__/cssMock.js",
|
||||
"\\.(gif|png|svg|ttf|woff2)$": "<rootDir>/node_modules/matrix-react-sdk/__mocks__/imageMock.js",
|
||||
"\\$webapp/i18n/languages.json": "<rootDir>/node_modules/matrix-react-sdk/__mocks__/languages.json",
|
||||
"^browser-request$": "<rootDir>/node_modules/matrix-react-sdk/__mocks__/browser-request.js",
|
||||
"^react$": "<rootDir>/node_modules/react",
|
||||
"^react-dom$": "<rootDir>/node_modules/react-dom",
|
||||
"^matrix-js-sdk$": "<rootDir>/node_modules/matrix-js-sdk/src",
|
||||
"^matrix-react-sdk$": "<rootDir>/node_modules/matrix-react-sdk/src"
|
||||
"linux": {
|
||||
"target": "deb",
|
||||
"category": "Network;InstantMessaging;Chat",
|
||||
"maintainer": "support@riot.im",
|
||||
"desktop": {
|
||||
"StartupWMClass": "riot"
|
||||
}
|
||||
},
|
||||
"transformIgnorePatterns": [
|
||||
"/node_modules/(?!matrix-js-sdk).+$",
|
||||
"/node_modules/(?!matrix-react-sdk).+$"
|
||||
]
|
||||
"win": {
|
||||
"target": "squirrel"
|
||||
},
|
||||
"directories": {
|
||||
"buildResources": "electron_app/build",
|
||||
"output": "electron_app/dist",
|
||||
"app": "electron_app"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
13
postcss.config.js
Normal file
@@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
plugins: [
|
||||
require("postcss-import")(),
|
||||
require("autoprefixer")(),
|
||||
require("postcss-simple-vars")(),
|
||||
require("postcss-extend")(),
|
||||
require("postcss-nested")(),
|
||||
require("postcss-mixins")(),
|
||||
require("postcss-strip-inline-comments")(),
|
||||
],
|
||||
"parser": "postcss-scss",
|
||||
"local-plugins": true,
|
||||
};
|
||||
59
release.sh
@@ -1,68 +1,41 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Script to perform a release of element-web.
|
||||
# Script to perform a release of vector-web.
|
||||
#
|
||||
# Requires github-changelog-generator; to install, do
|
||||
# pip install git+https://github.com/matrix-org/github-changelog-generator.git
|
||||
|
||||
set -e
|
||||
|
||||
orig_args=$@
|
||||
|
||||
# chomp any args starting with '-' as these need to go
|
||||
# through to the release script and otherwise we'll get
|
||||
# confused about what the version arg is.
|
||||
while [[ "$1" == -* ]]; do
|
||||
shift
|
||||
done
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
for i in matrix-js-sdk matrix-react-sdk
|
||||
do
|
||||
echo "Checking version of $i..."
|
||||
depver=`cat package.json | jq -r .dependencies[\"$i\"]`
|
||||
latestver=`yarn info -s $i dist-tags.next`
|
||||
latestver=`npm show $i version`
|
||||
if [ "$depver" != "$latestver" ]
|
||||
then
|
||||
echo "The latest version of $i is $latestver but package.json depends on $depver."
|
||||
echo -n "Type 'u' to auto-upgrade, 'c' to continue anyway, or 'a' to abort:"
|
||||
echo "The latest version of $i is $latestver but package.json depends on $depver"
|
||||
echo -n "Type 'Yes' to continue anyway: "
|
||||
read resp
|
||||
if [ "$resp" != "u" ] && [ "$resp" != "c" ]
|
||||
if [ "$resp" != "Yes" ]
|
||||
then
|
||||
echo "Aborting."
|
||||
echo "OK, never mind."
|
||||
exit 1
|
||||
fi
|
||||
if [ "$resp" == "u" ]
|
||||
then
|
||||
echo "Upgrading $i to $latestver..."
|
||||
yarn add -E $i@$latestver
|
||||
git add -u
|
||||
git commit -m "Upgrade $i to $latestver"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
./node_modules/matrix-js-sdk/release.sh -n -z "$orig_args"
|
||||
|
||||
# bump Electron's package.json first
|
||||
release="${1#v}"
|
||||
tag="v${release}"
|
||||
prerelease=0
|
||||
# We check if this build is a prerelease by looking to
|
||||
# see if the version has a hyphen in it. Crude,
|
||||
# but semver doesn't support postreleases so anything
|
||||
# with a hyphen is a prerelease.
|
||||
echo $release | grep -q '-' && prerelease=1
|
||||
echo "electron npm version"
|
||||
|
||||
if [ $prerelease -eq 0 ]
|
||||
then
|
||||
# For a release, reset SDK deps back to the `develop` branch.
|
||||
for i in matrix-js-sdk matrix-react-sdk
|
||||
do
|
||||
echo "Resetting $i to develop branch..."
|
||||
yarn add github:matrix-org/$i#develop
|
||||
git add -u
|
||||
git commit -m "Reset $i back to develop branch"
|
||||
done
|
||||
git push origin develop
|
||||
fi
|
||||
cd electron_app
|
||||
npm version --no-git-tag-version "$release"
|
||||
git commit package.json -m "$tag"
|
||||
|
||||
|
||||
cd ..
|
||||
|
||||
exec ./node_modules/matrix-js-sdk/release.sh -z "$@"
|
||||
|
||||
@@ -1 +1 @@
|
||||
signing_id: releases@riot.im
|
||||
signing_id: packages@riot.im
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
/*
|
||||
Copyright 2020 New Vector Ltd
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// import font-size variables manually, ideally this scss would get loaded by the theme which has all variables in context
|
||||
@import "../../../node_modules/matrix-react-sdk/res/css/_font-sizes.scss";
|
||||
|
||||
.mx_ErrorView {
|
||||
background: #c5e0f7;
|
||||
background: -moz-linear-gradient(top, #c5e0f7 0%, #ffffff 100%);
|
||||
background: -webkit-linear-gradient(top, #c5e0f7 0%, #ffffff 100%);
|
||||
background: linear-gradient(to bottom, #c5e0f7 0%, #ffffff 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#c5e0f7', endColorstr='#ffffff',GradientType=0 );
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
||||
width: 100%;
|
||||
min-height: 100%;
|
||||
height: auto;
|
||||
color: #000;
|
||||
|
||||
.mx_ErrorView_container {
|
||||
max-width: 680px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.mx_Button {
|
||||
border: 0;
|
||||
border-radius: 4px;
|
||||
font-size: $font-18px;
|
||||
margin-left: 4px;
|
||||
margin-right: 4px;
|
||||
min-width: 80px;
|
||||
background-color: #03B381;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
padding: 12px 22px;
|
||||
word-break: break-word;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.mx_Center {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.mx_HomePage_header {
|
||||
color: #2E2F32;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
font-size: $font-16px;
|
||||
h1 {
|
||||
font-size: $font-32px;
|
||||
}
|
||||
h2 {
|
||||
font-size: $font-24px;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.mx_HomePage_col {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.mx_HomePage_row {
|
||||
flex: 1 1 0;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.mx_HomePage_logo {
|
||||
margin: auto 20px auto 0;
|
||||
}
|
||||
|
||||
h1, h2 {
|
||||
font-weight: 600;
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
.mx_Spacer {
|
||||
margin-top: 24px;
|
||||
}
|
||||
|
||||
.mx_FooterLink {
|
||||
color: #368BD6;
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
/*
|
||||
* Quick-n-dirty algebraic datatypes.
|
||||
*
|
||||
* These let us handle the possibility of failure without having to constantly write code to check for it.
|
||||
* We can apply all of the transformations we need as if the data is present using `map`.
|
||||
* If there's a None, or a FetchError, or a Pending, those are left untouched.
|
||||
*
|
||||
* I've used perhaps an odd bit of terminology from scalaz in `fold`. This is basically a `switch` statement:
|
||||
* You pass it a set of functions to handle the various different states of the datatype, and if it finds the
|
||||
* function it'll call it on its value.
|
||||
*
|
||||
* It's handy to have this in functional style when dealing with React as we can dispatch different ways of rendering
|
||||
* really simply:
|
||||
* ```
|
||||
* bundleFetchStatus.fold({
|
||||
* some: (fetchStatus) => <ProgressBar fetchsStatus={fetchStatus} />,
|
||||
* }),
|
||||
* ```
|
||||
*/
|
||||
|
||||
|
||||
class Optional {
|
||||
static from(value) {
|
||||
return value && Some.of(value) || None;
|
||||
}
|
||||
map(f) {
|
||||
return this;
|
||||
}
|
||||
flatMap(f) {
|
||||
return this;
|
||||
}
|
||||
fold({ none }) {
|
||||
return none && none();
|
||||
}
|
||||
}
|
||||
class Some extends Optional {
|
||||
constructor(value) {
|
||||
super();
|
||||
this.value = value;
|
||||
}
|
||||
map(f) {
|
||||
return Some.of(f(this.value));
|
||||
}
|
||||
flatMap(f) {
|
||||
return f(this.value);
|
||||
}
|
||||
fold({ some }) {
|
||||
return some && some(this.value);
|
||||
}
|
||||
static of(value) {
|
||||
return new Some(value);
|
||||
}
|
||||
}
|
||||
const None = new Optional();
|
||||
|
||||
class FetchStatus {
|
||||
constructor(opt = {}) {
|
||||
this.opt = { at: Date.now(), ...opt };
|
||||
}
|
||||
map(f) {
|
||||
return this;
|
||||
}
|
||||
flatMap(f) {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
class Success extends FetchStatus {
|
||||
static of(value) {
|
||||
return new Success(value);
|
||||
}
|
||||
constructor(value, opt) {
|
||||
super(opt);
|
||||
this.value = value;
|
||||
}
|
||||
map(f) {
|
||||
return new Success(f(this.value), this.opt);
|
||||
}
|
||||
flatMap(f) {
|
||||
return f(this.value, this.opt);
|
||||
}
|
||||
fold({ success }) {
|
||||
return success instanceof Function ? success(this.value, this.opt) : undefined;
|
||||
}
|
||||
}
|
||||
class Pending extends FetchStatus {
|
||||
static of(opt) {
|
||||
return new Pending(opt);
|
||||
}
|
||||
constructor(opt) {
|
||||
super(opt);
|
||||
}
|
||||
fold({ pending }) {
|
||||
return pending instanceof Function ? pending(this.opt) : undefined;
|
||||
}
|
||||
}
|
||||
class FetchError extends FetchStatus {
|
||||
static of(reason, opt) {
|
||||
return new FetchError(reason, opt);
|
||||
}
|
||||
constructor(reason, opt) {
|
||||
super(opt);
|
||||
this.reason = reason;
|
||||
}
|
||||
fold({ error }) {
|
||||
return error instanceof Function ? error(this.reason, this.opt) : undefined;
|
||||
}
|
||||
}
|
||||
@@ -1,336 +0,0 @@
|
||||
class StartupError extends Error {}
|
||||
|
||||
/*
|
||||
* We need to know the bundle path before we can fetch the sourcemap files. In a production environment, we can guess
|
||||
* it using this.
|
||||
*/
|
||||
async function getBundleName(baseUrl) {
|
||||
const res = await fetch(new URL("index.html", baseUrl).toString());
|
||||
if (!res.ok) {
|
||||
throw new StartupError(`Couldn't fetch index.html to prefill bundle; ${res.status} ${res.statusText}`);
|
||||
}
|
||||
const index = await res.text();
|
||||
return index.split("\n").map((line) =>
|
||||
line.match(/<script src="bundles\/([^/]+)\/bundle.js"/),
|
||||
)
|
||||
.filter((result) => result)
|
||||
.map((result) => result[1])[0];
|
||||
}
|
||||
|
||||
function validateBundle(value) {
|
||||
return value.match(/^[0-9a-f]{20}$/) ? Some.of(value) : None;
|
||||
}
|
||||
|
||||
/* A custom fetcher that abandons immediately upon getting a response.
|
||||
* The purpose of this is just to validate that the user entered a real bundle, and provide feedback.
|
||||
*/
|
||||
const bundleCache = new Map();
|
||||
function bundleSubject(baseUrl, bundle) {
|
||||
if (!bundle.match(/^[0-9a-f]{20}$/)) throw new Error("Bad input");
|
||||
if (bundleCache.has(bundle)) {
|
||||
return bundleCache.get(bundle);
|
||||
}
|
||||
const fetcher = new rxjs.BehaviorSubject(Pending.of());
|
||||
bundleCache.set(bundle, fetcher);
|
||||
|
||||
fetch(new URL(`bundles/${bundle}/bundle.js.map`, baseUrl).toString()).then((res) => {
|
||||
res.body.cancel(); /* Bail on the download immediately - it could be big! */
|
||||
const status = res.ok;
|
||||
if (status) {
|
||||
fetcher.next(Success.of());
|
||||
} else {
|
||||
fetcher.next(FetchError.of(`Failed to fetch: ${res.status} ${res.statusText}`));
|
||||
}
|
||||
});
|
||||
|
||||
return fetcher;
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert a ReadableStream of bytes into an Observable of a string
|
||||
* The observable will emit a stream of Pending objects and will concatenate
|
||||
* the number of bytes received with whatever pendingContext has been supplied.
|
||||
* Finally, it will emit a Success containing the result.
|
||||
* You'd use this on a Response.body.
|
||||
*/
|
||||
function observeReadableStream(readableStream, pendingContext = {}) {
|
||||
let bytesReceived = 0;
|
||||
let buffer = "";
|
||||
const pendingSubject = new rxjs.BehaviorSubject(Pending.of({ ...pendingContext, bytesReceived }));
|
||||
const throttledPending = pendingSubject.pipe(rxjs.operators.throttleTime(100));
|
||||
const resultObservable = new rxjs.Subject();
|
||||
const reader = readableStream.getReader();
|
||||
const utf8Decoder = new TextDecoder("utf-8");
|
||||
function readNextChunk() {
|
||||
reader.read().then(({ done, value }) => {
|
||||
if (done) {
|
||||
pendingSubject.complete();
|
||||
resultObservable.next(Success.of(buffer));
|
||||
return;
|
||||
}
|
||||
bytesReceived += value.length;
|
||||
pendingSubject.next(Pending.of({...pendingContext, bytesReceived }));
|
||||
/* string concatenation is apparently the most performant way to do this */
|
||||
buffer += utf8Decoder.decode(value);
|
||||
readNextChunk();
|
||||
});
|
||||
}
|
||||
readNextChunk();
|
||||
return rxjs.concat(throttledPending, resultObservable);
|
||||
}
|
||||
|
||||
/*
|
||||
* A wrapper which converts the browser's `fetch()` mechanism into an Observable. The Observable then provides us with
|
||||
* a stream of datatype values: first, a sequence of Pending objects that keep us up to date with the download progress,
|
||||
* finally followed by either a Success or Failure object. React then just has to render each of these appropriately.
|
||||
*/
|
||||
const fetchCache = new Map();
|
||||
function fetchAsSubject(endpoint) {
|
||||
if (fetchCache.has(endpoint)) {
|
||||
// TODO: expiry/retry logic here?
|
||||
return fetchCache.get(endpoint);
|
||||
}
|
||||
const fetcher = new rxjs.BehaviorSubject(Pending.of());
|
||||
fetchCache.set(endpoint, fetcher);
|
||||
|
||||
fetch(endpoint).then((res) => {
|
||||
if (!res.ok) {
|
||||
fetcher.next(FetchError.of(`Failed to fetch endpoint ${endpoint}: ${res.status} ${res.statusText}`));
|
||||
return;
|
||||
}
|
||||
|
||||
const contentLength = res.headers.get("content-length");
|
||||
const context = contentLength ? { length: parseInt(contentLength) } : {};
|
||||
|
||||
const streamer = observeReadableStream(res.body, context, endpoint);
|
||||
streamer.subscribe((value) => {
|
||||
fetcher.next(value);
|
||||
});
|
||||
});
|
||||
return fetcher;
|
||||
}
|
||||
|
||||
/* ===================== */
|
||||
/* ==== React stuff ==== */
|
||||
/* ===================== */
|
||||
/* Rather than importing an entire build infrastructure, for now we just use React without JSX */
|
||||
const e = React.createElement;
|
||||
|
||||
/*
|
||||
* Provides user feedback given a FetchStatus object.
|
||||
*/
|
||||
function ProgressBar({ fetchStatus }) {
|
||||
return e('span', { className: "progress "},
|
||||
fetchStatus.fold({
|
||||
pending: ({ bytesReceived, length }) => {
|
||||
if (!bytesReceived) {
|
||||
return e('span', { className: "spinner" }, "\u29b5");
|
||||
}
|
||||
const kB = Math.floor(10 * bytesReceived / 1024) / 10;
|
||||
if (!length) {
|
||||
return e('span', null, `Fetching (${kB}kB)`);
|
||||
}
|
||||
const percent = Math.floor(100 * bytesReceived / length);
|
||||
return e('span', null, `Fetching (${kB}kB) ${percent}%`);
|
||||
},
|
||||
success: () => e('span', null, "\u2713"),
|
||||
error: (reason) => {
|
||||
return e('span', { className: 'error'}, `\u2717 ${reason}`);
|
||||
},
|
||||
},
|
||||
));
|
||||
}
|
||||
|
||||
/*
|
||||
* The main component.
|
||||
*/
|
||||
function BundlePicker() {
|
||||
const [baseUrl, setBaseUrl] = React.useState(new URL("..", window.location).toString());
|
||||
const [bundle, setBundle] = React.useState("");
|
||||
const [file, setFile] = React.useState("");
|
||||
const [line, setLine] = React.useState("1");
|
||||
const [column, setColumn] = React.useState("");
|
||||
const [result, setResult] = React.useState(None);
|
||||
const [bundleFetchStatus, setBundleFetchStatus] = React.useState(None);
|
||||
const [fileFetchStatus, setFileFetchStatus] = React.useState(None);
|
||||
|
||||
/* On baseUrl change, try to fill in the bundle name for the user */
|
||||
React.useEffect(() => {
|
||||
console.log("DEBUG", baseUrl);
|
||||
getBundleName(baseUrl).then((name) => {
|
||||
console.log("DEBUG", name);
|
||||
if (bundle === "" && validateBundle(name) !== None) {
|
||||
setBundle(name);
|
||||
}
|
||||
}, console.log.bind(console));
|
||||
}, [baseUrl]);
|
||||
|
||||
/* ------------------------- */
|
||||
/* Follow user state changes */
|
||||
/* ------------------------- */
|
||||
const onBaseUrlChange = React.useCallback((event) => {
|
||||
const value = event.target.value;
|
||||
setBaseUrl(value);
|
||||
}, []);
|
||||
|
||||
const onBundleChange = React.useCallback((event) => {
|
||||
const value = event.target.value;
|
||||
setBundle(value);
|
||||
}, []);
|
||||
|
||||
const onFileChange = React.useCallback((event) => {
|
||||
const value = event.target.value;
|
||||
setFile(value);
|
||||
}, []);
|
||||
|
||||
const onLineChange = React.useCallback((event) => {
|
||||
const value = event.target.value;
|
||||
setLine(value);
|
||||
}, []);
|
||||
|
||||
const onColumnChange = React.useCallback((event) => {
|
||||
const value = event.target.value;
|
||||
setColumn(value);
|
||||
}, []);
|
||||
|
||||
|
||||
/* ------------------------------------------------ */
|
||||
/* Plumb data-fetching observables through to React */
|
||||
/* ------------------------------------------------ */
|
||||
|
||||
/* Whenever a valid bundle name is input, go see if it's a real bundle on the server */
|
||||
React.useEffect(() =>
|
||||
validateBundle(bundle).fold({
|
||||
some: (value) => {
|
||||
const subscription = bundleSubject(baseUrl, value)
|
||||
.pipe(rxjs.operators.map(Some.of))
|
||||
.subscribe(setBundleFetchStatus);
|
||||
return () => subscription.unsubscribe();
|
||||
},
|
||||
none: () => setBundleFetchStatus(None),
|
||||
}),
|
||||
[baseUrl, bundle]);
|
||||
|
||||
/* Whenever a valid javascript file is input, see if it corresponds to a sourcemap file and initiate a fetch
|
||||
* if so. */
|
||||
React.useEffect(() => {
|
||||
if (!file.match(/.\.js$/) || validateBundle(bundle) === None) {
|
||||
setFileFetchStatus(None);
|
||||
return;
|
||||
}
|
||||
const observable = fetchAsSubject(new URL(`bundles/${bundle}/${file}.map`, baseUrl).toString())
|
||||
.pipe(
|
||||
rxjs.operators.map((fetchStatus) => fetchStatus.flatMap(value => {
|
||||
try {
|
||||
return Success.of(JSON.parse(value));
|
||||
} catch (e) {
|
||||
return FetchError.of(e);
|
||||
}
|
||||
})),
|
||||
rxjs.operators.map(Some.of),
|
||||
);
|
||||
const subscription = observable.subscribe(setFileFetchStatus);
|
||||
return () => subscription.unsubscribe();
|
||||
}, [baseUrl, bundle, file]);
|
||||
|
||||
/*
|
||||
* Whenever we have a valid fetched sourcemap, and a valid line, attempt to find the original position from the
|
||||
* sourcemap.
|
||||
*/
|
||||
React.useEffect(() => {
|
||||
// `fold` dispatches on the datatype, like a switch statement
|
||||
fileFetchStatus.fold({
|
||||
some: (fetchStatus) =>
|
||||
// `fold` just returns null for all of the cases that aren't `Success` objects here
|
||||
fetchStatus.fold({
|
||||
success: (value) => {
|
||||
if (!line) return setResult(None);
|
||||
const pLine = parseInt(line);
|
||||
const pCol = parseInt(column);
|
||||
sourceMap.SourceMapConsumer.with(value, undefined, (consumer) =>
|
||||
consumer.originalPositionFor({ line: pLine, column: pCol }),
|
||||
).then((result) => setResult(Some.of(JSON.stringify(result))));
|
||||
},
|
||||
}),
|
||||
none: () => setResult(None),
|
||||
});
|
||||
}, [fileFetchStatus, line, column]);
|
||||
|
||||
|
||||
/* ------ */
|
||||
/* Render */
|
||||
/* ------ */
|
||||
return e('div', {},
|
||||
e('div', { className: 'inputs' },
|
||||
e('div', { className: 'baseUrl' },
|
||||
e('label', { htmlFor: 'baseUrl'}, 'Base URL'),
|
||||
e('input', {
|
||||
name: 'baseUrl',
|
||||
required: true,
|
||||
pattern: ".+",
|
||||
onChange: onBaseUrlChange,
|
||||
value: baseUrl,
|
||||
}),
|
||||
),
|
||||
e('div', { className: 'bundle' },
|
||||
e('label', { htmlFor: 'bundle'}, 'Bundle'),
|
||||
e('input', {
|
||||
name: 'bundle',
|
||||
required: true,
|
||||
pattern: "[0-9a-f]{20}",
|
||||
onChange: onBundleChange,
|
||||
value: bundle,
|
||||
}),
|
||||
bundleFetchStatus.fold({
|
||||
some: (fetchStatus) => e(ProgressBar, { fetchStatus }),
|
||||
none: () => null,
|
||||
}),
|
||||
),
|
||||
e('div', { className: 'file' },
|
||||
e('label', { htmlFor: 'file' }, 'File'),
|
||||
e('input', {
|
||||
name: 'file',
|
||||
required: true,
|
||||
pattern: ".+\\.js",
|
||||
onChange: onFileChange,
|
||||
value: file,
|
||||
}),
|
||||
fileFetchStatus.fold({
|
||||
some: (fetchStatus) => e(ProgressBar, { fetchStatus }),
|
||||
none: () => null,
|
||||
}),
|
||||
),
|
||||
e('div', { className: 'line' },
|
||||
e('label', { htmlFor: 'line' }, 'Line'),
|
||||
e('input', {
|
||||
name: 'line',
|
||||
required: true,
|
||||
pattern: "[0-9]+",
|
||||
onChange: onLineChange,
|
||||
value: line,
|
||||
}),
|
||||
),
|
||||
e('div', { className: 'column' },
|
||||
e('label', { htmlFor: 'column' }, 'Column'),
|
||||
e('input', {
|
||||
name: 'column',
|
||||
required: true,
|
||||
pattern: "[0-9]+",
|
||||
onChange: onColumnChange,
|
||||
value: column,
|
||||
}),
|
||||
),
|
||||
),
|
||||
e('div', null,
|
||||
result.fold({
|
||||
none: () => "Select a bundle, file and line",
|
||||
some: (value) => e('pre', null, value),
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/* Global stuff */
|
||||
window.Decoder = {
|
||||
BundlePicker,
|
||||
};
|
||||
@@ -1,79 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Rageshake decoder ring</title>
|
||||
<script crossorigin src="https://unpkg.com/source-map@0.7.3/dist/source-map.js"></script>
|
||||
<script>
|
||||
sourceMap.SourceMapConsumer.initialize({
|
||||
"lib/mappings.wasm": "https://unpkg.com/source-map@0.7.3/lib/mappings.wasm"
|
||||
});
|
||||
</script>
|
||||
<script crossorigin src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
|
||||
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script>
|
||||
<!--<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
|
||||
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>-->
|
||||
<script crossorigin src="https://unpkg.com/rxjs/bundles/rxjs.umd.min.js"></script>
|
||||
<script src="datatypes.js"></script>
|
||||
<script src="decoder.js"></script>
|
||||
|
||||
<style>
|
||||
@keyframes spin {
|
||||
from {transform:rotate(0deg);}
|
||||
to {transform:rotate(359deg);}
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: sans-serif
|
||||
}
|
||||
|
||||
.spinner {
|
||||
animation: spin 4s infinite linear;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
font-size: larger;
|
||||
}
|
||||
|
||||
.progress {
|
||||
padding-left: 0.5em;
|
||||
padding-right: 0.5em;
|
||||
}
|
||||
|
||||
.bundle input {
|
||||
width: 24ex;
|
||||
}
|
||||
|
||||
.valid::after {
|
||||
content: "✓"
|
||||
}
|
||||
|
||||
label {
|
||||
width: 3em;
|
||||
margin-right: 1em;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
input:valid {
|
||||
border: 1px solid green;
|
||||
}
|
||||
|
||||
.inputs > div {
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header><h2>Decoder ring</h2></header>
|
||||
<content id="main">Waiting for javascript to run...</content>
|
||||
<script type="text/javascript">
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
try {
|
||||
ReactDOM.render(React.createElement(Decoder.BundlePicker), document.getElementById("main"))
|
||||
} catch (e) {
|
||||
const n = document.createElement("div");
|
||||
n.innerText = `Error starting: ${e.message}`;
|
||||
document.getElementById("main").appendChild(n);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
BIN
res/flags/AD.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
res/flags/AE.png
Normal file
|
After Width: | Height: | Size: 1015 B |
BIN
res/flags/AF.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
res/flags/AG.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
res/flags/AI.png
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
BIN
res/flags/AL.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
res/flags/AM.png
Normal file
|
After Width: | Height: | Size: 654 B |
BIN
res/flags/AO.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
res/flags/AQ.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
res/flags/AR.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
res/flags/AS.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
res/flags/AT.png
Normal file
|
After Width: | Height: | Size: 655 B |
BIN
res/flags/AU.png
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
res/flags/AW.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
res/flags/AX.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
res/flags/AZ.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
res/flags/BA.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
res/flags/BB.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
res/flags/BD.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
res/flags/BE.png
Normal file
|
After Width: | Height: | Size: 558 B |
BIN
res/flags/BF.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
res/flags/BG.png
Normal file
|
After Width: | Height: | Size: 659 B |
BIN
res/flags/BH.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
res/flags/BI.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
BIN
res/flags/BJ.png
Normal file
|
After Width: | Height: | Size: 811 B |
BIN
res/flags/BL.png
Normal file
|
After Width: | Height: | Size: 566 B |
BIN
res/flags/BM.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |