You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Leonie 1c7a4aaeaa Patch 21/05/2019 3 months ago
.buildkite consistent capitalisation in buildkite pipelines 4 months ago
.github Update issue templates 3 months ago
docs add description of new labs feature for message editing 3 months ago
electron_app v1.1.2 3 months ago
origin_migrator Add tool to migrate logins between origins 8 months ago
res Patch 21/05/2019 3 months ago
scripts remove emojione 3 months ago
src Patch 21/05/2019 3 months ago
test Setup crypto store for restore session tests 4 months ago
.babelrc Fix .babelrc to be the same as react-sdk 3 months ago
.dockerignore Ignore a bunch of files in the docker build to reduce context size 4 months ago
.editorconfig add .editorconfig 2 years ago
.eslintignore Don't lint the autogenned file 2 years ago
.eslintrc.js Add eslint config 2 years ago
.gitignore Remove karma junit output 3 months ago
.modernizr.json oops, rebuild modernizr to pull in new tests 2 years ago
.npmignore Don't include the world in the published packages 2 years ago
AUTHORS.rst Fixes #1953 1 year ago
CHANGELOG.md Prepare changelog for v1.1.2 3 months ago
CONTRIBUTING.rst Link to CONTRIBUTING from JS SDK 8 months ago
Dockerfile Increase timeout for yarn install in Docker builds 3 months ago
LICENSE Basic structure of a react SDK and start of an implementation. 4 years ago
README.md Patch 21/05/2019 3 months ago
config.sample.json Add message editing to sample also 3 months ago
karma.conf.js Remove karma junit output 3 months ago
package.json remove emojione 3 months ago
postcss.config.js Use the postcss-webpack-loader 2 years ago
release.sh yarn neds --new-version to make a new version 5 months ago
release_config.yaml We are now [email protected] 3 months ago
webpack.config.js tell webpack about woff & woff2 files 3 months ago
yarn.lock Patch 21/05/2019 3 months ago

README.md

koyu.space Matrix

koyu.space Matrix (which is forked from Riot.im) is a Matrix web client built using the Matrix React SDK.

koyu.space Matrix is officially supported on the web in modern versions of Chrome, Firefox, and Safari. Other browsers may work, however official support is not provided.

Getting Started

The easiest way to test koyu.space Matrix is to just use the hosted copy at https://chat.koyu.space.

To host your own copy of koyu.space Matrix, the quickest bet is to use a pre-built released version of koyu.space Matrix:

  1. Download the latest version from https://git.koyu.space/koyu/riot-fork
  2. Untar the tarball on your web server
  3. Move (or symlink) the koyu.space Matrix-x.x.x directory to an appropriate name
  4. If desired, copy config.sample.json to config.json and edit it as desired. See below for details.
  5. Enter the URL into your browser and log into koyu.space Matrix!

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 koyu.space Matrix over https.

To install koyu.space Matrix as a desktop application, see Running as a desktop app below.

Building From Source

koyu.space Matrix 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.

Using yarn instead of npm is recommended. Please see the Yarn install guide if you do not have it already.

  1. Install or update node.js so that your node is at least v10.x.
  2. Install yarn if not present already.
  3. Clone the repo: git clone https://git.koyu.space/koyu/riot-fork.
  4. Switch to the riot-fork directory: cd riot-fork.
  5. Install the prerequisites: yarn install.
  6. If you’re using the develop branch then it is recommended to set up a proper development environment (“Setting up a dev environment” below) however one can install the develop versions of the dependencies instead: bash scripts/fetch-develop.deps.sh Whenever you git pull on riot-fork 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: bash cd matrix-js-sdk git pull yarn install # re-run to pull in any new dependencies cd ../matrix-react-sdk git pull yarn install
  7. Configure the app by copying config.sample.json to config.json and modifying it (see below for details).
  8. yarn 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 koyu.space Matrix 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

You can configure the app by copying config.sample.json to config.json and customising it:

For a good example, see https://chat.koyu.space/config.json.

  1. default_server_name sets the default server name to use for authentication. This will trigger koyu.space Matrix to ask https://<server_name>/.well-known/matrix/client for the homeserver and identity server URLs to use. This is the recommended approach for setting a default server. However, it is also possible to use the following to directly configure each of the URLs:
    • default_hs_url sets the default homeserver URL.
    • default_is_url sets 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 the future, identity servers will be decentralised.
    • koyu.space Matrix will report an error if you accidentally configure both default_server_name and default_hs_url since it’s unclear which should take priority.
  2. features: Lookup of optional features that may be enabled, disabled, or exposed to the user in the labs section of settings. The available optional experimental features vary from release to release.
  3. 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.
  4. branding: Configures various branding and logo details, such as:
    1. welcomeBackgroundUrl: An image to use as a wallpaper outside the app during authentication flows
    2. authHeaderLogoUrl: An logo image that is shown in the header during authentication flows
    3. authFooterLinks: a list of links to show in the authentication page footer: [{"text": "Link text", "url": "https://link.target"}, {"text": "Other link", ...}]
  5. integrations_ui_url: URL to the web interface for the integrations server. The integrations server is not koyu.space Matrix and normally not your homeserver either. The integration server settings may be left blank to disable integrations.
  6. integrations_rest_url: URL to the REST interface for the integrations server.
  7. integrations_widgets_urls: list of URLs to the REST interface for the widget integrations server.
  8. 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 by leaving the bug_report_endpoint_url out of your config file.
  9. roomDirectory: config for the public room directory. This section is optional.
  10. roomDirectory.servers: List of other homeservers’ directories to include in the drop down list. Optional.
  11. default_theme: name of theme to use by default (e.g. ‘light’)
  12. 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).
  13. 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: https://usercontent.riot.im/v1.html. This needs to contain v1.html from https://github.com/matrix-org/usercontent/blob/master/v1.html
  14. 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
    2. whitelistedHSUrls: a list of HS URLs to not redact from the analytics
    3. whitelistedISUrls: a list of IS URLs to not redact from the analytics
    4. siteId: The Piwik Site ID to use when sending analytics to the Piwik server configured above
  15. welcomeUserId: the user ID of a bot to invite whenever users register that can give them a tour
  16. embeddedPages: Configures the pages displayed in portions of koyu.space Matrix 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 koyu.space Matrix.
    2. 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.

Note that index.html also has an og:image meta tag that is set to an image hosted on koyu.space Matrix.im. This is the image used if links to your copy of koyu.space Matrix appear in some websites like Facebook, and indeed koyu.space Matrix 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 koyu.space Matrix as above, but run koyu.space Matrix_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 koyu.space Matrix.

Running as a Desktop app

koyu.space Matrix can also be run as a desktop app, wrapped in electron.

To build it yourself, follow the instructions below.

  1. Follow the instructions in ‘Building From Source’ above, but run yarn build instead of yarn dist (since we don’t need the tarball).
  2. Install electron and run it:
   yarn electron

To build packages, use electron-builder. This is configured to output:

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:

brew install wine --without-x11
brew install mono
brew install gnu-tar
yarn install
yarn 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_app/dist/

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™
yarn global add nativefier
nativefier https://matrix.koyu.space

Desktop app configuration

To run multiple instances of the desktop app for different accounts, you can launch the executable with the --profile argument followed by a unique identifier, e.g riot-fork --profile Work for it to run a separate profile and not interfere with the default one.

Alternatively, a custom location for the profile data can be specified using the --profile-dir flag followed by the desired path.

To change the config.json for the desktop app, create a config file which will be used to override values in the config which ships in the package:

  • %APPDATA%\$NAME\config.json on Windows
  • $XDG_CONFIG_HOME\$NAME\config.json or ~/.config/$NAME/config.json on Linux
  • ~Library/Application Support/$NAME/config.json on macOS

In the paths above, $NAME is typically koyu.space Matrix, unless you use --profile $PROFILE in which case it becomes koyu.space Matrix-$PROFILE.

Running from Docker

To build the image yourself:

git clone https://git.koyu.space/koyu/riot-fork
cd riot-fork
git checkout master
docker build -t koyuawsmbrtn/riot-fork .

Labs Features

Some features of koyu.space Matrix may be enabled by flags in the Labs section of the settings. Some of these features are described in labs.md.

Development

Before attempting to develop on koyu.space Matrix you must read the developer guide for matrix-react-sdk, which also defines the design, architecture and style for koyu.space Matrix too.

You should also familiarise yourself with the “Here be Dragons” guide to the tame & not-so-tame dragons (gotchas) which exist in the codebase.

The idea of koyu.space Matrix 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).

Please note that koyu.space Matrix 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 koyu.space Matrix itself.

Setting up a dev environment

Much of the functionality in koyu.space Matrix 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:

git clone https://github.com/matrix-org/matrix-js-sdk.git
pushd matrix-js-sdk
git checkout develop
yarn link
yarn install
popd

Then similarly with matrix-react-sdk:

git clone https://github.com/matrix-org/matrix-react-sdk.git
pushd matrix-react-sdk
git checkout develop
yarn link
yarn link matrix-js-sdk
yarn install
popd

Finally, build and start koyu.space Matrix itself:

git clone https://git.koyu.pace/koyu/riot-fork
cd riot-fork
git checkout develop
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

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.

Open http://127.0.0.1:8080/ in your browser to see your newly built koyu.space Matrix.


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 koyu.space Matrix skin, you will need to rebuild the skin’s index by running, yarn 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 koyu.space Matrix.

Running the tests

There are a number of application-level tests in the tests directory; these are designed to run in a browser instance under the control of karma. To run them:

  • 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

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