Merge branch 'develop' into travis/redact-to-remove
6
.gitignore
vendored
|
@ -5,6 +5,8 @@
|
||||||
/key.pem
|
/key.pem
|
||||||
/lib
|
/lib
|
||||||
/node_modules
|
/node_modules
|
||||||
|
/electron_app/node_modules
|
||||||
|
/electron_app/dist
|
||||||
/packages/
|
/packages/
|
||||||
/webapp
|
/webapp
|
||||||
/.npmrc
|
/.npmrc
|
||||||
|
@ -12,4 +14,6 @@
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
electron/dist
|
electron/dist
|
||||||
electron/pub
|
electron/pub
|
||||||
config.json
|
/.idea
|
||||||
|
/config.json
|
||||||
|
/src/component-index.js
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
"test/css/flexbox",
|
"test/css/flexbox",
|
||||||
"test/es5/specification",
|
"test/es5/specification",
|
||||||
"test/css/objectfit",
|
"test/css/objectfit",
|
||||||
"test/storage/localstorage"
|
"test/storage/localstorage",
|
||||||
|
"test/workers/webworkers",
|
||||||
|
"test/indexeddb"
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -2,6 +2,5 @@ language: node_js
|
||||||
node_js:
|
node_js:
|
||||||
- 6 # node v6, to match jenkins
|
- 6 # node v6, to match jenkins
|
||||||
install:
|
install:
|
||||||
|
- scripts/fetch-develop.deps.sh
|
||||||
- npm install
|
- npm install
|
||||||
- (cd node_modules/matrix-js-sdk && npm install)
|
|
||||||
- (cd node_modules/matrix-react-sdk && npm install)
|
|
||||||
|
|
129
CHANGELOG.md
|
@ -1,3 +1,132 @@
|
||||||
|
Changes in [0.9.10](https://github.com/vector-im/riot-web/releases/tag/v0.9.10) (2017-05-22)
|
||||||
|
============================================================================================
|
||||||
|
[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.9.10-rc.1...v0.9.10)
|
||||||
|
|
||||||
|
* No changes
|
||||||
|
|
||||||
|
|
||||||
|
Changes in [0.9.10-rc.1](https://github.com/vector-im/riot-web/releases/tag/v0.9.10-rc.1) (2017-05-19)
|
||||||
|
======================================================================================================
|
||||||
|
[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.9.9...v0.9.10-rc.1)
|
||||||
|
|
||||||
|
* CSS for left_aligned Dropdowns, and adjustments for Country dd in Login
|
||||||
|
[\#3959](https://github.com/vector-im/riot-web/pull/3959)
|
||||||
|
* Add square flag pngs /w genflags.sh script
|
||||||
|
[\#3953](https://github.com/vector-im/riot-web/pull/3953)
|
||||||
|
* Add config for riot-bot on desktop app build
|
||||||
|
[\#3954](https://github.com/vector-im/riot-web/pull/3954)
|
||||||
|
* Desktop: 'copy link address'
|
||||||
|
[\#3952](https://github.com/vector-im/riot-web/pull/3952)
|
||||||
|
* Reduce rageshake log size to 1MB
|
||||||
|
[\#3943](https://github.com/vector-im/riot-web/pull/3943)
|
||||||
|
* CSS for putting country dd on same line as phone input
|
||||||
|
[\#3942](https://github.com/vector-im/riot-web/pull/3942)
|
||||||
|
* fix #3894
|
||||||
|
[\#3919](https://github.com/vector-im/riot-web/pull/3919)
|
||||||
|
* change vector->riot on the surface
|
||||||
|
[\#3894](https://github.com/vector-im/riot-web/pull/3894)
|
||||||
|
* move manifest.json outward so it is scoped properly
|
||||||
|
[\#3888](https://github.com/vector-im/riot-web/pull/3888)
|
||||||
|
* add to manifest
|
||||||
|
[\#3799](https://github.com/vector-im/riot-web/pull/3799)
|
||||||
|
* Automatically update component-index
|
||||||
|
[\#3886](https://github.com/vector-im/riot-web/pull/3886)
|
||||||
|
* move electron -> electron_app because npm smart
|
||||||
|
[\#3877](https://github.com/vector-im/riot-web/pull/3877)
|
||||||
|
* Fix bug report endpoint in config.sample.json.
|
||||||
|
[\#3863](https://github.com/vector-im/riot-web/pull/3863)
|
||||||
|
* Update 2 missed icons to the new icon
|
||||||
|
[\#3851](https://github.com/vector-im/riot-web/pull/3851)
|
||||||
|
* Make left panel better for new users (mk II)
|
||||||
|
[\#3804](https://github.com/vector-im/riot-web/pull/3804)
|
||||||
|
* match primary package.json
|
||||||
|
[\#3839](https://github.com/vector-im/riot-web/pull/3839)
|
||||||
|
* Re-add productName
|
||||||
|
[\#3829](https://github.com/vector-im/riot-web/pull/3829)
|
||||||
|
* Remove leading v in /version file, for SemVer and to match Electron ver
|
||||||
|
[\#3683](https://github.com/vector-im/riot-web/pull/3683)
|
||||||
|
* Fix scope of callback
|
||||||
|
[\#3790](https://github.com/vector-im/riot-web/pull/3790)
|
||||||
|
* Remember and Recall window layout/position state
|
||||||
|
[\#3622](https://github.com/vector-im/riot-web/pull/3622)
|
||||||
|
* Remove babelcheck
|
||||||
|
[\#3808](https://github.com/vector-im/riot-web/pull/3808)
|
||||||
|
* Include MXID and device id in rageshakes
|
||||||
|
[\#3809](https://github.com/vector-im/riot-web/pull/3809)
|
||||||
|
* import Modal
|
||||||
|
[\#3791](https://github.com/vector-im/riot-web/pull/3791)
|
||||||
|
* Pin filesize ver to fix break upstream
|
||||||
|
[\#3775](https://github.com/vector-im/riot-web/pull/3775)
|
||||||
|
* Improve Room Directory Look & Feel
|
||||||
|
[\#3751](https://github.com/vector-im/riot-web/pull/3751)
|
||||||
|
* Fix emote RRs alignment
|
||||||
|
[\#3742](https://github.com/vector-im/riot-web/pull/3742)
|
||||||
|
* Remove unused `placeholder` prop on RoomDropTarget
|
||||||
|
[\#3741](https://github.com/vector-im/riot-web/pull/3741)
|
||||||
|
* Modify CSS for matrix-org/matrix-react-sdk#833
|
||||||
|
[\#3732](https://github.com/vector-im/riot-web/pull/3732)
|
||||||
|
* Warn when exiting due to single-instance
|
||||||
|
[\#3727](https://github.com/vector-im/riot-web/pull/3727)
|
||||||
|
* Electron forgets it was maximized when you click on a notification
|
||||||
|
[\#3709](https://github.com/vector-im/riot-web/pull/3709)
|
||||||
|
* CSS to make h1 and h2 the same size as h1.
|
||||||
|
[\#3719](https://github.com/vector-im/riot-web/pull/3719)
|
||||||
|
* Prevent long room names/topics from pushing UI of the screen
|
||||||
|
[\#3721](https://github.com/vector-im/riot-web/pull/3721)
|
||||||
|
* Disable dropdown highlight on focus
|
||||||
|
[\#3717](https://github.com/vector-im/riot-web/pull/3717)
|
||||||
|
* Escape HTML Tags from Linux Notifications (electron)
|
||||||
|
[\#3564](https://github.com/vector-im/riot-web/pull/3564)
|
||||||
|
* styling for spoilerized access token view in Settings
|
||||||
|
[\#3651](https://github.com/vector-im/riot-web/pull/3651)
|
||||||
|
* Fix Webpack conf
|
||||||
|
[\#3690](https://github.com/vector-im/riot-web/pull/3690)
|
||||||
|
* Add config.json to .gitignore
|
||||||
|
[\#3599](https://github.com/vector-im/riot-web/pull/3599)
|
||||||
|
* add command line arg (--hidden) for electron app
|
||||||
|
[\#3641](https://github.com/vector-im/riot-web/pull/3641)
|
||||||
|
* fix ImageView Download functionality
|
||||||
|
[\#3640](https://github.com/vector-im/riot-web/pull/3640)
|
||||||
|
* Add cross-env into the mix
|
||||||
|
[\#3693](https://github.com/vector-im/riot-web/pull/3693)
|
||||||
|
* Remember acceptance for unsupported browsers.
|
||||||
|
[\#3694](https://github.com/vector-im/riot-web/pull/3694)
|
||||||
|
* Cosmetics to go with matrix-org/matrix-react-sdk#811
|
||||||
|
[\#3692](https://github.com/vector-im/riot-web/pull/3692)
|
||||||
|
* Cancel quicksearch on ESC
|
||||||
|
[\#3680](https://github.com/vector-im/riot-web/pull/3680)
|
||||||
|
* Optimise RoomList and implement quick-search functionality on it.
|
||||||
|
[\#3654](https://github.com/vector-im/riot-web/pull/3654)
|
||||||
|
* Progress updates for rageshake uploads
|
||||||
|
[\#3648](https://github.com/vector-im/riot-web/pull/3648)
|
||||||
|
* Factor out rageshake upload to a separate file
|
||||||
|
[\#3645](https://github.com/vector-im/riot-web/pull/3645)
|
||||||
|
* rageshake: fix race when collecting logs
|
||||||
|
[\#3644](https://github.com/vector-im/riot-web/pull/3644)
|
||||||
|
* Fix a flaky test
|
||||||
|
[\#3649](https://github.com/vector-im/riot-web/pull/3649)
|
||||||
|
|
||||||
|
Changes in [0.9.9](https://github.com/vector-im/riot-web/releases/tag/v0.9.9) (2017-04-25)
|
||||||
|
==========================================================================================
|
||||||
|
[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.9.9-rc.2...v0.9.9)
|
||||||
|
|
||||||
|
* No changes
|
||||||
|
|
||||||
|
|
||||||
|
Changes in [0.9.9-rc.2](https://github.com/vector-im/riot-web/releases/tag/v0.9.9-rc.2) (2017-04-24)
|
||||||
|
====================================================================================================
|
||||||
|
[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.9.9-rc.1...v0.9.9-rc.2)
|
||||||
|
|
||||||
|
* Fix bug where links to Riot would fail to open.
|
||||||
|
|
||||||
|
|
||||||
|
Changes in [0.9.9-rc.1](https://github.com/vector-im/riot-web/releases/tag/v0.9.9-rc.1) (2017-04-21)
|
||||||
|
====================================================================================================
|
||||||
|
[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.9.8...v0.9.9-rc.1)
|
||||||
|
|
||||||
|
* Update js-sdk and matrix-react-sdk to fix registration without a captcha (https://github.com/vector-im/riot-web/issues/3621)
|
||||||
|
|
||||||
|
|
||||||
Changes in [0.9.8](https://github.com/vector-im/riot-web/releases/tag/v0.9.8) (2017-04-12)
|
Changes in [0.9.8](https://github.com/vector-im/riot-web/releases/tag/v0.9.8) (2017-04-12)
|
||||||
==========================================================================================
|
==========================================================================================
|
||||||
[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.9.8-rc.3...v0.9.8)
|
[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.9.8-rc.3...v0.9.8)
|
||||||
|
|
45
README.md
|
@ -58,27 +58,35 @@ to build.
|
||||||
1. Install or update `node.js` so that your `npm` is at least at version `2.0.0`
|
1. Install or update `node.js` so that your `npm` is at least at version `2.0.0`
|
||||||
1. Clone the repo: `git clone https://github.com/vector-im/riot-web.git`
|
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. Switch to the riot-web directory: `cd riot-web`
|
||||||
1. Install the prerequisites: `npm install`
|
1. If you're using the `develop` branch, install the develop versions of the
|
||||||
1. If you are using the `develop` branch of vector-web, you will probably need
|
dependencies, as the released ones will be too old:
|
||||||
to rebuild some of the dependencies, due to
|
|
||||||
https://github.com/npm/npm/issues/3055:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
(cd node_modules/matrix-js-sdk && npm install)
|
scripts/fetch-develop-deps.sh
|
||||||
(cd node_modules/matrix-react-sdk && npm install)
|
|
||||||
```
|
```
|
||||||
Whenever you git pull on riot-web you will also probably need to force an update
|
Whenever you git pull on riot-web you will also probably need to force an update
|
||||||
to these dependencies - the easiest way is probably:
|
to these dependencies - the simplest way is to re-run the script, but you can also
|
||||||
|
manually update and reuild them:
|
||||||
```
|
```
|
||||||
rm -rf node_modules/matrjx-{js,react}-sdk && npm i
|
cd matrix-js-sdk
|
||||||
(cd node_modules/matrix-js-sdk && npm install)
|
git pull
|
||||||
(cd node_modules/matrix-react-sdk && npm install)
|
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
|
However, we recommend setting up a proper development environment (see "Setting
|
||||||
up a development environment" below) if you want to run your own copy of the
|
up a development environment" below) if you want to run your own copy of the
|
||||||
`develop` branch, as it makes it much easier to keep these dependencies
|
`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
|
up-to-date. Or just use https://riot.im/develop - the continuous integration
|
||||||
release of the develop branch.
|
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
|
1. Configure the app by copying `config.sample.json` to `config.json` and
|
||||||
modifying it (see below for details)
|
modifying it (see below for details)
|
||||||
1. `npm run dist` to build a tarball to deploy. Untaring this file will give
|
1. `npm run dist` to build a tarball to deploy. Untaring this file will give
|
||||||
|
@ -135,7 +143,7 @@ To run as a desktop app:
|
||||||
|
|
||||||
```
|
```
|
||||||
npm install electron
|
npm install electron
|
||||||
node_modules/.bin/electron .
|
npm run electron
|
||||||
```
|
```
|
||||||
|
|
||||||
To build packages, use electron-builder. This is configured to output:
|
To build packages, use electron-builder. This is configured to output:
|
||||||
|
@ -273,6 +281,19 @@ If any of these steps error with, `file table overflow`, you are probably on a m
|
||||||
which has a very low limit on max open files. Run `ulimit -Sn 1024` and try again.
|
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 Riot.
|
You'll need to do this in each new terminal you open before building Riot.
|
||||||
|
|
||||||
|
How to add a new translation?
|
||||||
|
=============================
|
||||||
|
|
||||||
|
[<img src="https://translate.nordgedanken.de/widgets/riot-web/-/multi-auto.svg" alt="translationsstatus" width="340">](https://translate.nordgedanken.de/engage/riot-web/?utm_source=widget)
|
||||||
|
|
||||||
|
|
||||||
|
Head to the [translating doc](docs/translating.md)
|
||||||
|
|
||||||
|
Adding Strings to the translations (Developer Guide)
|
||||||
|
====================================================
|
||||||
|
|
||||||
|
Head to the [translating dev doc](docs/translating-dev.md)
|
||||||
|
|
||||||
Triaging issues
|
Triaging issues
|
||||||
===============
|
===============
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"brand": "Riot",
|
"brand": "Riot",
|
||||||
"integrations_ui_url": "https://scalar.vector.im/",
|
"integrations_ui_url": "https://scalar.vector.im/",
|
||||||
"integrations_rest_url": "https://scalar.vector.im/api",
|
"integrations_rest_url": "https://scalar.vector.im/api",
|
||||||
"bug_report_endpoint_url": "https://vector.im/bugs",
|
"bug_report_endpoint_url": "https://riot.im/bugreports/submit",
|
||||||
"enableLabs": true,
|
"enableLabs": true,
|
||||||
"roomDirectory": {
|
"roomDirectory": {
|
||||||
"servers": [
|
"servers": [
|
||||||
|
|
26
docs/translating-dev.md
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
# How to translate riot-web (Dev Guide)
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
- A working [Development Setup](../../#setting-up-a-dev-environment)
|
||||||
|
- Be able to understand English
|
||||||
|
- Be able to understand the language you want to translate riot-web into
|
||||||
|
|
||||||
|
## Adding new strings
|
||||||
|
|
||||||
|
1. Check if the import ``import _t from 'counterpart-riot'`` 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`` or if you are working in matrix-react-sdk you can find the json file in ``src/i18n/strings``
|
||||||
|
|
||||||
|
## Adding variables inside a string.
|
||||||
|
|
||||||
|
1. Extend your ``_t()`` call. Instead of ``_t(STRING)`` use ``_t(STRING, {})``
|
||||||
|
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 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.
|
64
docs/translating.md
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
# How to translate riot-web
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
- Web Browser
|
||||||
|
- Be able to understand English
|
||||||
|
- Be able to understand the language you want to translate riot-web into
|
||||||
|
|
||||||
|
## Step 0: Join #riotweb-translations:matrix.org
|
||||||
|
|
||||||
|
1. Come and join https://riot.im/develop/#/room/#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.nordgedanken.de 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.nordgedanken.de/accounts/profile/ and select the languages you know and maybe another language you know too.
|
||||||
|
6. Head to https://translate.nordgedanken.de/accounts/profile/#subscriptions and select Riot Web as Project
|
||||||
|
|
||||||
|
## How to check if your language already is being translated
|
||||||
|
|
||||||
|
Go to https://translate.nordgedanken.de/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.nordgedanken.de/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.
|
||||||
|
|
||||||
|
Head to the explanations under Steb 2b
|
||||||
|
|
||||||
|
## Step 2b: Adding a new language
|
||||||
|
|
||||||
|
1. Go to one of the projects listed https://translate.nordgedanken.de/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
|
||||||
|
|
||||||
|
### What means the green button under the text field?
|
||||||
|
|
||||||
|
The green button let you save our translations directly. Please only use it if you are 100% sure about that translation. If you do not know a translation please DO NOT click that button. Use the arrows above the translations field and click to the right.
|
||||||
|
|
||||||
|
### What means the yellow button under the text field?
|
||||||
|
|
||||||
|
The yellow button has to be used if you are unsure about the translation but you have a rough idea. It adds a new suggestion to the string which can than be reviewed by others.
|
||||||
|
|
||||||
|
### What are "%(something)s"?
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
### "I want to come back to this string. How?"
|
||||||
|
|
||||||
|
You can use inside the translation field "Review needed" checkbox. It will be shown as Strings that need to be reviewed.
|
||||||
|
|
||||||
|
|
||||||
|
### Further reading
|
||||||
|
|
||||||
|
The official Weblate doc provides some more in-deepth explanation on how to do translations and talks about do and don'ts. You can find it at: https://docs.weblate.org/en/latest/user/translating.html
|
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 14 KiB |
|
@ -1,73 +0,0 @@
|
||||||
{
|
|
||||||
"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",
|
|
||||||
"enableLabs": true,
|
|
||||||
"roomDirectory": {
|
|
||||||
"servers": [
|
|
||||||
"matrix.org"
|
|
||||||
],
|
|
||||||
"serverConfig": {
|
|
||||||
"matrix.org": {
|
|
||||||
"networks": [
|
|
||||||
"_matrix",
|
|
||||||
"gitter",
|
|
||||||
"irc:freenode",
|
|
||||||
"irc:mozilla",
|
|
||||||
"irc:snoonet",
|
|
||||||
"irc:oftc"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"networks": {
|
|
||||||
"gitter": {
|
|
||||||
"protocol": "gitter",
|
|
||||||
"portalRoomPattern": "#gitter_.*:matrix.org",
|
|
||||||
"name": "Gitter",
|
|
||||||
"icon": "https://gitter.im/favicon.ico",
|
|
||||||
"example": "org/community",
|
|
||||||
"nativePattern": "[^\\s]+/[^\\s]+$"
|
|
||||||
},
|
|
||||||
"irc:freenode": {
|
|
||||||
"protocol": "irc",
|
|
||||||
"domain": "chat.freenode.net",
|
|
||||||
"portalRoomPattern": "#freenode_.*:matrix.org",
|
|
||||||
"name": "Freenode",
|
|
||||||
"icon": "https://matrix.org/_matrix/media/v1/download/matrix.org/DHLHpDDgWNNejFmrewvwEAHX",
|
|
||||||
"example": "#channel",
|
|
||||||
"nativePattern": "^#[^\\s]+$"
|
|
||||||
},
|
|
||||||
"irc:mozilla": {
|
|
||||||
"protocol": "irc",
|
|
||||||
"domain": "chat.freenode.net",
|
|
||||||
"portalRoomPattern": "#mozilla_.*:matrix.org",
|
|
||||||
"name": "Mozilla",
|
|
||||||
"icon": "https://matrix.org/_matrix/media/v1/download/matrix.org/DHLHpDDgWNNejFmrewvwEAHX",
|
|
||||||
"example": "#channel",
|
|
||||||
"nativePattern": "^#[^\\s]+$"
|
|
||||||
},
|
|
||||||
"irc:snoonet": {
|
|
||||||
"protocol": "irc",
|
|
||||||
"domain": "ipv6-irc.snoonet.org",
|
|
||||||
"portalRoomPattern": "#_snoonet_.*:matrix.org",
|
|
||||||
"name": "Snoonet",
|
|
||||||
"icon": "https://matrix.org/_matrix/media/v1/download/matrix.org/DHLHpDDgWNNejFmrewvwEAHX",
|
|
||||||
"example": "#channel",
|
|
||||||
"nativePattern": "^#[^\\s]+$"
|
|
||||||
},
|
|
||||||
"irc:oftc": {
|
|
||||||
"protocol": "irc",
|
|
||||||
"domain": "irc.oftc.net",
|
|
||||||
"portalRoomPattern": "#_oftc_.*:matrix.org",
|
|
||||||
"name": "OFTC",
|
|
||||||
"icon": "https://matrix.org/_matrix/media/v1/download/matrix.org/DHLHpDDgWNNejFmrewvwEAHX",
|
|
||||||
"example": "#channel",
|
|
||||||
"nativePattern": "^#[^\\s]+$"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,197 +0,0 @@
|
||||||
/*
|
|
||||||
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 electron = 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 () { electron.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 = electron.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 = electron.Menu.buildFromTemplate(template)
|
|
||||||
|
|
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 102 KiB |
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 673 B After Width: | Height: | Size: 673 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 4.4 KiB 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 |
11
electron_app/package.json
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"name": "riot-web",
|
||||||
|
"productName": "Riot",
|
||||||
|
"main": "src/electron-main.js",
|
||||||
|
"version": "0.9.10",
|
||||||
|
"description": "A feature-rich client for Matrix.org",
|
||||||
|
"author": "Vector Creations Ltd.",
|
||||||
|
"dependencies": {
|
||||||
|
"electron-window-state": "^4.1.0"
|
||||||
|
}
|
||||||
|
}
|
16
electron_app/riot.im/config.json
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"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"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,3 @@
|
||||||
// @flow
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2016 Aviral Dasgupta
|
Copyright 2016 Aviral Dasgupta
|
||||||
Copyright 2016 OpenMarket Ltd
|
Copyright 2016 OpenMarket Ltd
|
||||||
|
@ -20,15 +18,16 @@ limitations under the License.
|
||||||
// Squirrel on windows starts the app with various flags
|
// Squirrel on windows starts the app with various flags
|
||||||
// as hooks to tell us when we've been installed/uninstalled
|
// as hooks to tell us when we've been installed/uninstalled
|
||||||
// etc.
|
// etc.
|
||||||
const check_squirrel_hooks = require('./squirrelhooks');
|
const checkSquirrelHooks = require('./squirrelhooks');
|
||||||
if (check_squirrel_hooks()) return;
|
if (checkSquirrelHooks()) return;
|
||||||
|
|
||||||
const electron = require('electron');
|
const electron = require('electron');
|
||||||
const url = require('url');
|
|
||||||
|
|
||||||
const tray = require('./tray');
|
const tray = require('./tray');
|
||||||
|
const vectorMenu = require('./vectormenu');
|
||||||
|
const webContentsHandler = require('./webcontents-handler');
|
||||||
|
|
||||||
const VectorMenu = require('./vectormenu');
|
const windowStateKeeper = require('electron-window-state');
|
||||||
|
|
||||||
let vectorConfig = {};
|
let vectorConfig = {};
|
||||||
try {
|
try {
|
||||||
|
@ -40,12 +39,6 @@ try {
|
||||||
// Continue with the defaults (ie. an empty config)
|
// Continue with the defaults (ie. an empty config)
|
||||||
}
|
}
|
||||||
|
|
||||||
const PERMITTED_URL_SCHEMES = [
|
|
||||||
'http:',
|
|
||||||
'https:',
|
|
||||||
'mailto:',
|
|
||||||
];
|
|
||||||
|
|
||||||
const UPDATE_POLL_INTERVAL_MS = 60 * 60 * 1000;
|
const UPDATE_POLL_INTERVAL_MS = 60 * 60 * 1000;
|
||||||
const INITIAL_UPDATE_DELAY_MS = 30 * 1000;
|
const INITIAL_UPDATE_DELAY_MS = 30 * 1000;
|
||||||
|
|
||||||
|
@ -57,13 +50,13 @@ function safeOpenURL(target) {
|
||||||
// so put fairly stringent limits on what can be opened
|
// so put fairly stringent limits on what can be opened
|
||||||
// (for instance, open /bin/sh does indeed open a terminal
|
// (for instance, open /bin/sh does indeed open a terminal
|
||||||
// with a shell, albeit with no arguments)
|
// with a shell, albeit with no arguments)
|
||||||
const parsed_url = url.parse(target);
|
const parsedUrl = url.parse(target);
|
||||||
if (PERMITTED_URL_SCHEMES.indexOf(parsed_url.protocol) > -1) {
|
if (PERMITTED_URL_SCHEMES.indexOf(parsedUrl.protocol) > -1) {
|
||||||
// explicitly use the URL re-assembled by the url library,
|
// explicitly use the URL re-assembled by the url library,
|
||||||
// so we know the url parser has understood all the parts
|
// so we know the url parser has understood all the parts
|
||||||
// of the input string
|
// of the input string
|
||||||
const new_target = url.format(parsed_url);
|
const newTarget = url.format(parsedUrl);
|
||||||
electron.shell.openExternal(new_target);
|
electron.shell.openExternal(newTarget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,14 +70,19 @@ function onWindowOrNavigate(ev, target) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onLinkContextMenu(ev, params) {
|
function onLinkContextMenu(ev, params) {
|
||||||
const popup_menu = new electron.Menu();
|
const popupMenu = new electron.Menu();
|
||||||
popup_menu.append(new electron.MenuItem({
|
|
||||||
|
popupMenu.append(new electron.MenuItem({
|
||||||
label: params.linkURL,
|
label: params.linkURL,
|
||||||
click() {
|
click() { safeOpenURL(params.linkURL); },
|
||||||
safeOpenURL(params.linkURL);
|
|
||||||
},
|
|
||||||
}));
|
}));
|
||||||
popup_menu.popup();
|
|
||||||
|
popupMenu.append(new electron.MenuItem({
|
||||||
|
label: 'Copy Link Address',
|
||||||
|
click() { electron.clipboard.writeText(params.linkURL); },
|
||||||
|
}));
|
||||||
|
|
||||||
|
popupMenu.popup();
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,13 +97,13 @@ function pollForUpdates() {
|
||||||
try {
|
try {
|
||||||
electron.autoUpdater.checkForUpdates();
|
electron.autoUpdater.checkForUpdates();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("Couldn't check for update", e);
|
console.log('Couldn\'t check for update', e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function startAutoUpdate(update_base_url) {
|
function startAutoUpdate(updateBaseUrl) {
|
||||||
if (update_base_url.slice(-1) !== '/') {
|
if (updateBaseUrl.slice(-1) !== '/') {
|
||||||
update_base_url = update_base_url + '/';
|
updateBaseUrl = updateBaseUrl + '/';
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// For reasons best known to Squirrel, the way it checks for updates
|
// For reasons best known to Squirrel, the way it checks for updates
|
||||||
|
@ -113,7 +111,7 @@ function startAutoUpdate(update_base_url) {
|
||||||
// hits a URL that either gives it a 200 with some json or
|
// 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
|
// 204 No Content. On windows it takes a base path and looks for
|
||||||
// files under that path.
|
// files under that path.
|
||||||
if (process.platform == 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
// include the current version in the URL we hit. Electron doesn't add
|
// 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
|
// 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
|
// (and previously did) just use the User-Agent, but this doesn't
|
||||||
|
@ -121,16 +119,15 @@ function startAutoUpdate(update_base_url) {
|
||||||
// and also acts as a convenient cache-buster to ensure that when the
|
// 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.
|
// app updates it always gets a fresh value to avoid update-looping.
|
||||||
electron.autoUpdater.setFeedURL(
|
electron.autoUpdater.setFeedURL(
|
||||||
update_base_url +
|
`${updateBaseUrl}macos/?localVersion=${encodeURIComponent(electron.app.getVersion())}`);
|
||||||
'macos/?localVersion=' + encodeURIComponent(electron.app.getVersion())
|
|
||||||
);
|
} else if (process.platform === 'win32') {
|
||||||
} else if (process.platform == 'win32') {
|
electron.autoUpdater.setFeedURL(`${updateBaseUrl}win32/${process.arch}/`);
|
||||||
electron.autoUpdater.setFeedURL(update_base_url + 'win32/' + process.arch + '/');
|
|
||||||
} else {
|
} else {
|
||||||
// Squirrel / electron only supports auto-update on these two platforms.
|
// 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
|
// 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.
|
// implemented it on Linux, or if it would be different again.
|
||||||
console.log("Auto update not supported on this platform");
|
console.log('Auto update not supported on this platform');
|
||||||
}
|
}
|
||||||
// We check for updates ourselves rather than using 'updater' because we need to
|
// 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:
|
// do it in the main process (and we don't really need to check every 10 minutes:
|
||||||
|
@ -143,7 +140,7 @@ function startAutoUpdate(update_base_url) {
|
||||||
setInterval(pollForUpdates, UPDATE_POLL_INTERVAL_MS);
|
setInterval(pollForUpdates, UPDATE_POLL_INTERVAL_MS);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// will fail if running in debug mode
|
// will fail if running in debug mode
|
||||||
console.log("Couldn't enable update checking", err);
|
console.log('Couldn\'t enable update checking', err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,12 +150,49 @@ function startAutoUpdate(update_base_url) {
|
||||||
// no other way to catch this error).
|
// no other way to catch this error).
|
||||||
// Assuming we generally run from the console when developing,
|
// Assuming we generally run from the console when developing,
|
||||||
// this is far preferable.
|
// this is far preferable.
|
||||||
process.on('uncaughtException', function (error) {
|
process.on('uncaughtException', function(error) {
|
||||||
console.log("Unhandled exception", error);
|
console.log('Unhandled exception', error);
|
||||||
});
|
});
|
||||||
|
|
||||||
electron.ipcMain.on('install_update', installUpdate);
|
electron.ipcMain.on('install_update', installUpdate);
|
||||||
|
|
||||||
|
let focusHandlerAttached = false;
|
||||||
|
electron.ipcMain.on('setBadgeCount', function(ev, count) {
|
||||||
|
electron.app.setBadgeCount(count);
|
||||||
|
if (process.platform === 'win32' && mainWindow && !mainWindow.isFocused()) {
|
||||||
|
if (count > 0) {
|
||||||
|
if (!focusHandlerAttached) {
|
||||||
|
mainWindow.once('focus', () => {
|
||||||
|
mainWindow.flashFrame(false);
|
||||||
|
focusHandlerAttached = false;
|
||||||
|
});
|
||||||
|
focusHandlerAttached = true;
|
||||||
|
}
|
||||||
|
mainWindow.flashFrame(true);
|
||||||
|
} else {
|
||||||
|
mainWindow.flashFrame(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
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');
|
electron.app.commandLine.appendSwitch('--enable-usermedia-screen-capturing');
|
||||||
|
|
||||||
const shouldQuit = electron.app.makeSingleInstance((commandLine, workingDirectory) => {
|
const shouldQuit = electron.app.makeSingleInstance((commandLine, workingDirectory) => {
|
||||||
|
@ -171,34 +205,43 @@ const shouldQuit = electron.app.makeSingleInstance((commandLine, workingDirector
|
||||||
});
|
});
|
||||||
|
|
||||||
if (shouldQuit) {
|
if (shouldQuit) {
|
||||||
electron.app.quit()
|
console.log('Other instance detected: exiting');
|
||||||
|
electron.app.quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
electron.app.on('ready', () => {
|
electron.app.on('ready', () => {
|
||||||
if (vectorConfig.update_base_url) {
|
if (vectorConfig.update_base_url) {
|
||||||
console.log("Starting auto update with base URL: " + vectorConfig.update_base_url);
|
console.log(`Starting auto update with base URL: ${vectorConfig.update_base_url}`);
|
||||||
startAutoUpdate(vectorConfig.update_base_url);
|
startAutoUpdate(vectorConfig.update_base_url);
|
||||||
} else {
|
} else {
|
||||||
console.log("No update_base_url is defined: auto update is disabled");
|
console.log('No update_base_url is defined: auto update is disabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
const icon_path = `${__dirname}/../img/riot.` + (
|
const iconPath = `${__dirname}/../img/riot.${process.platform === 'win32' ? 'ico' : 'png'}`;
|
||||||
process.platform == 'win32' ? 'ico' : 'png'
|
|
||||||
);
|
// Load the previous window state with fallback to defaults
|
||||||
|
const mainWindowState = windowStateKeeper({
|
||||||
|
defaultWidth: 1024,
|
||||||
|
defaultHeight: 768,
|
||||||
|
});
|
||||||
|
|
||||||
mainWindow = new electron.BrowserWindow({
|
mainWindow = new electron.BrowserWindow({
|
||||||
icon: icon_path,
|
icon: iconPath,
|
||||||
width: 1024, height: 768,
|
|
||||||
show: false,
|
show: false,
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
|
|
||||||
|
x: mainWindowState.x,
|
||||||
|
y: mainWindowState.y,
|
||||||
|
width: mainWindowState.width,
|
||||||
|
height: mainWindowState.height,
|
||||||
});
|
});
|
||||||
mainWindow.loadURL(`file://${__dirname}/../../webapp/index.html`);
|
mainWindow.loadURL(`file://${__dirname}/../../webapp/index.html`);
|
||||||
electron.Menu.setApplicationMenu(VectorMenu);
|
electron.Menu.setApplicationMenu(vectorMenu);
|
||||||
|
|
||||||
// Create trayIcon icon
|
// Create trayIcon icon
|
||||||
tray.create(mainWindow, {
|
tray.create(mainWindow, {
|
||||||
icon_path: icon_path,
|
icon_path: iconPath,
|
||||||
brand: vectorConfig.brand || 'Riot'
|
brand: vectorConfig.brand || 'Riot',
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!process.argv.includes('--hidden')) {
|
if (!process.argv.includes('--hidden')) {
|
||||||
|
@ -211,7 +254,7 @@ electron.app.on('ready', () => {
|
||||||
mainWindow = null;
|
mainWindow = null;
|
||||||
});
|
});
|
||||||
mainWindow.on('close', (e) => {
|
mainWindow.on('close', (e) => {
|
||||||
if (!appQuitting && (tray.hasTray() || process.platform == 'darwin')) {
|
if (!appQuitting && (tray.hasTray() || process.platform === 'darwin')) {
|
||||||
// On Mac, closing the window just hides it
|
// On Mac, closing the window just hides it
|
||||||
// (this is generally how single-window Mac apps
|
// (this is generally how single-window Mac apps
|
||||||
// behave, eg. Mail.app)
|
// behave, eg. Mail.app)
|
||||||
|
@ -221,14 +264,8 @@ electron.app.on('ready', () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mainWindow.webContents.on('new-window', onWindowOrNavigate);
|
webContentsHandler(mainWindow.webContents);
|
||||||
mainWindow.webContents.on('will-navigate', onWindowOrNavigate);
|
mainWindowState.manage(mainWindow);
|
||||||
|
|
||||||
mainWindow.webContents.on('context-menu', function(ev, params) {
|
|
||||||
if (params.linkURL) {
|
|
||||||
onLinkContextMenu(ev, params);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
electron.app.on('window-all-closed', () => {
|
electron.app.on('window-all-closed', () => {
|
|
@ -16,30 +16,30 @@ limitations under the License.
|
||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const spawn = require('child_process').spawn;
|
const spawn = require('child_process').spawn;
|
||||||
const app = require('electron').app;
|
const {app} = require('electron');
|
||||||
|
|
||||||
function run_update_exe(args, done) {
|
function runUpdateExe(args, done) {
|
||||||
// Invokes Squirrel's Update.exe which will do things for us like create shortcuts
|
// 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
|
// 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
|
// 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.
|
// information about the app by inspecting the directory it's run from.
|
||||||
const updateExe = path.resolve(path.dirname(process.execPath), '..', 'Update.exe');
|
const updateExe = path.resolve(path.dirname(process.execPath), '..', 'Update.exe');
|
||||||
console.log('Spawning `%s` with args `%s`', updateExe, args);
|
console.log(`Spawning '${updateExe}' with args '${args}'`);
|
||||||
spawn(updateExe, args, {
|
spawn(updateExe, args, {
|
||||||
detached: true
|
detached: true,
|
||||||
}).on('close', done);
|
}).on('close', done);
|
||||||
};
|
}
|
||||||
|
|
||||||
function check_squirrel_hooks() {
|
function checkSquirrelHooks() {
|
||||||
if (process.platform != 'win32') return false;
|
if (process.platform !== 'win32') return false;
|
||||||
|
|
||||||
const cmd = process.argv[1];
|
const cmd = process.argv[1];
|
||||||
const target = path.basename(process.execPath);
|
const target = path.basename(process.execPath);
|
||||||
if (cmd === '--squirrel-install' || cmd === '--squirrel-updated') {
|
if (cmd === '--squirrel-install' || cmd === '--squirrel-updated') {
|
||||||
run_update_exe(['--createShortcut=' + target + ''], app.quit);
|
runUpdateExe(['--createShortcut=' + target + ''], app.quit);
|
||||||
return true;
|
return true;
|
||||||
} else if (cmd === '--squirrel-uninstall') {
|
} else if (cmd === '--squirrel-uninstall') {
|
||||||
run_update_exe(['--removeShortcut=' + target + ''], app.quit);
|
runUpdateExe(['--removeShortcut=' + target + ''], app.quit);
|
||||||
return true;
|
return true;
|
||||||
} else if (cmd === '--squirrel-obsolete') {
|
} else if (cmd === '--squirrel-obsolete') {
|
||||||
app.quit();
|
app.quit();
|
||||||
|
@ -48,4 +48,4 @@ function check_squirrel_hooks() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = check_squirrel_hooks;
|
module.exports = checkSquirrelHooks;
|
|
@ -15,26 +15,19 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const path = require('path');
|
const {app, Tray, Menu, nativeImage} = require('electron');
|
||||||
const electron = require('electron');
|
|
||||||
|
|
||||||
const app = electron.app;
|
|
||||||
const Tray = electron.Tray;
|
|
||||||
const MenuItem = electron.MenuItem;
|
|
||||||
|
|
||||||
let trayIcon = null;
|
let trayIcon = null;
|
||||||
|
|
||||||
exports.hasTray = function hasTray() {
|
exports.hasTray = function hasTray() {
|
||||||
return (trayIcon !== null);
|
return (trayIcon !== null);
|
||||||
}
|
};
|
||||||
|
|
||||||
exports.create = function (win, config) {
|
exports.create = function(win, config) {
|
||||||
// no trays on darwin
|
// no trays on darwin
|
||||||
if (process.platform === 'darwin' || trayIcon) {
|
if (process.platform === 'darwin' || trayIcon) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const toggleWin = function () {
|
const toggleWin = function() {
|
||||||
if (win.isVisible() && !win.isMinimized()) {
|
if (win.isVisible() && !win.isMinimized()) {
|
||||||
win.hide();
|
win.hide();
|
||||||
} else {
|
} else {
|
||||||
|
@ -44,24 +37,46 @@ exports.create = function (win, config) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const contextMenu = electron.Menu.buildFromTemplate([
|
const contextMenu = Menu.buildFromTemplate([
|
||||||
{
|
{
|
||||||
label: 'Show/Hide ' + config.brand,
|
label: `Show/Hide ${config.brand}`,
|
||||||
click: toggleWin
|
click: toggleWin,
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'separator'
|
|
||||||
},
|
},
|
||||||
|
{ type: 'separator' },
|
||||||
{
|
{
|
||||||
label: 'Quit',
|
label: 'Quit',
|
||||||
click: function () {
|
click: function() {
|
||||||
app.quit();
|
app.quit();
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
trayIcon = new Tray(config.icon_path);
|
trayIcon = new Tray(config.icon_path);
|
||||||
trayIcon.setToolTip(config.brand);
|
trayIcon.setToolTip(config.brand);
|
||||||
trayIcon.setContextMenu(contextMenu);
|
trayIcon.setContextMenu(contextMenu);
|
||||||
trayIcon.on('click', toggleWin);
|
trayIcon.on('click', toggleWin);
|
||||||
|
|
||||||
|
let lastFavicon = null;
|
||||||
|
win.webContents.on('page-favicon-updated', function(ev, favicons) {
|
||||||
|
let newFavicon = config.icon_path;
|
||||||
|
if (favicons && favicons.length > 0 && favicons[0].startsWith('data:')) {
|
||||||
|
newFavicon = favicons[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
// No need to change, shortcut
|
||||||
|
if (newFavicon === lastFavicon) return;
|
||||||
|
lastFavicon = newFavicon;
|
||||||
|
|
||||||
|
// if its not default we have to construct into nativeImage
|
||||||
|
if (newFavicon !== config.icon_path) {
|
||||||
|
newFavicon = nativeImage.createFromDataURL(favicons[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
trayIcon.setImage(newFavicon);
|
||||||
|
win.setIcon(newFavicon);
|
||||||
|
});
|
||||||
|
|
||||||
|
win.webContents.on('page-title-updated', function(ev, title) {
|
||||||
|
trayIcon.setToolTip(title);
|
||||||
|
});
|
||||||
};
|
};
|
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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
|
@ -47,7 +47,6 @@ webpack_config.module.noParse.push(/sinon\/pkg\/sinon\.js$/);
|
||||||
webpack_config.resolve.alias['sinon'] = 'sinon/pkg/sinon.js';
|
webpack_config.resolve.alias['sinon'] = 'sinon/pkg/sinon.js';
|
||||||
|
|
||||||
webpack_config.resolve.root = [
|
webpack_config.resolve.root = [
|
||||||
path.resolve('./src'),
|
|
||||||
path.resolve('./test'),
|
path.resolve('./test'),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
45
package.json
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"name": "riot-web",
|
"name": "riot-web",
|
||||||
"productName": "Riot",
|
"productName": "Riot",
|
||||||
"main": "electron/src/electron-main.js",
|
"main": "electron_app/src/electron-main.js",
|
||||||
"version": "0.9.8",
|
"version": "0.9.10",
|
||||||
"description": "A feature-rich client for Matrix.org",
|
"description": "A feature-rich client for Matrix.org",
|
||||||
"author": "Vector Creations Ltd.",
|
"author": "Vector Creations Ltd.",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -27,20 +27,23 @@
|
||||||
"matrix-react-parent": "matrix-react-sdk",
|
"matrix-react-parent": "matrix-react-sdk",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"reskindex": "reskindex -h src/header",
|
"reskindex": "reskindex -h src/header",
|
||||||
|
"reskindex:watch": "reskindex -h src/header -w",
|
||||||
"build:res": "node scripts/copy-res.js",
|
"build:res": "node scripts/copy-res.js",
|
||||||
"build:modernizr": "modernizr -c .modernizr.json -d src/vector/modernizr.js",
|
"build:modernizr": "modernizr -c .modernizr.json -d src/vector/modernizr.js",
|
||||||
"build:compile": "babel --source-maps -d lib src",
|
"build:compile": "npm run reskindex && babel --source-maps -d lib src",
|
||||||
"build:bundle": "cross-env NODE_ENV=production webpack -p --progress",
|
"build:bundle": "cross-env NODE_ENV=production webpack -p --progress",
|
||||||
"build:bundle:dev": "webpack --optimize-occurence-order --progress",
|
"build:bundle:dev": "webpack --optimize-occurence-order --progress",
|
||||||
"build:electron": "npm run clean && npm run build && build -wml --ia32 --x64",
|
"build:electron": "npm run clean && npm run build && build -wml --ia32 --x64",
|
||||||
"build": "node scripts/babelcheck.js && npm run build:res && npm run build:bundle",
|
"build": "npm run reskindex && npm run build:res && npm run build:bundle",
|
||||||
"build:dev": "node scripts/babelcheck.js && npm run build:res && npm run build:bundle:dev",
|
"build:dev": "npm run reskindex && npm run build:res && npm run build:bundle:dev",
|
||||||
"dist": "scripts/package.sh",
|
"dist": "scripts/package.sh",
|
||||||
|
"install:electron": "install-app-deps",
|
||||||
|
"electron": "npm run install:electron && electron .",
|
||||||
"start:res": "node scripts/copy-res.js -w",
|
"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": "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:js:prod": "cross-env NODE_ENV=production webpack-dev-server -w --progress",
|
||||||
"start": "node scripts/babelcheck.js && parallelshell \"npm run start:res\" \"npm run start:js\"",
|
"start": "parallelshell \"npm run reskindex:watch\" \"npm run start:res\" \"npm run start:js\"",
|
||||||
"start:prod": "parallelshell \"npm run start:res\" \"npm run start:js:prod\"",
|
"start:prod": "parallelshell \"npm run reskindex:watch\" \"npm run start:res\" \"npm run start:js:prod\"",
|
||||||
"lint": "eslint src/",
|
"lint": "eslint src/",
|
||||||
"lintall": "eslint src/ test/",
|
"lintall": "eslint src/ test/",
|
||||||
"clean": "rimraf lib webapp electron/dist",
|
"clean": "rimraf lib webapp electron/dist",
|
||||||
|
@ -56,8 +59,9 @@
|
||||||
"draft-js": "^0.8.1",
|
"draft-js": "^0.8.1",
|
||||||
"extract-text-webpack-plugin": "^0.9.1",
|
"extract-text-webpack-plugin": "^0.9.1",
|
||||||
"favico.js": "^0.3.10",
|
"favico.js": "^0.3.10",
|
||||||
"filesize": "^3.1.2",
|
"filesize": "3.5.6",
|
||||||
"flux": "~2.0.3",
|
"flux": "~2.0.3",
|
||||||
|
"gemini-scrollbar": "matrix-org/gemini-scrollbar#b302279",
|
||||||
"gfm.css": "^1.1.1",
|
"gfm.css": "^1.1.1",
|
||||||
"highlight.js": "^9.0.0",
|
"highlight.js": "^9.0.0",
|
||||||
"linkifyjs": "^2.1.3",
|
"linkifyjs": "^2.1.3",
|
||||||
|
@ -70,7 +74,7 @@
|
||||||
"react-dnd": "^2.1.4",
|
"react-dnd": "^2.1.4",
|
||||||
"react-dnd-html5-backend": "^2.1.2",
|
"react-dnd-html5-backend": "^2.1.2",
|
||||||
"react-dom": "^15.4.0",
|
"react-dom": "^15.4.0",
|
||||||
"react-gemini-scrollbar": "matrix-org/react-gemini-scrollbar#39d858c",
|
"react-gemini-scrollbar": "matrix-org/react-gemini-scrollbar#5e97aef",
|
||||||
"sanitize-html": "^1.11.1",
|
"sanitize-html": "^1.11.1",
|
||||||
"ua-parser-js": "^0.7.10",
|
"ua-parser-js": "^0.7.10",
|
||||||
"url": "^0.11.0"
|
"url": "^0.11.0"
|
||||||
|
@ -100,6 +104,7 @@
|
||||||
"emojione": "^2.2.7",
|
"emojione": "^2.2.7",
|
||||||
"eslint": "^3.14.0",
|
"eslint": "^3.14.0",
|
||||||
"eslint-config-google": "^0.7.1",
|
"eslint-config-google": "^0.7.1",
|
||||||
|
"eslint-plugin-babel": "^4.1.1",
|
||||||
"eslint-plugin-flowtype": "^2.30.0",
|
"eslint-plugin-flowtype": "^2.30.0",
|
||||||
"eslint-plugin-react": "^6.9.0",
|
"eslint-plugin-react": "^6.9.0",
|
||||||
"expect": "^1.16.0",
|
"expect": "^1.16.0",
|
||||||
|
@ -139,19 +144,22 @@
|
||||||
"build": {
|
"build": {
|
||||||
"appId": "im.riot.app",
|
"appId": "im.riot.app",
|
||||||
"category": "Network",
|
"category": "Network",
|
||||||
"electronVersion": "1.6.2",
|
"electronVersion": "1.6.8",
|
||||||
"//asar=false": "https://github.com/electron-userland/electron-builder/issues/675",
|
"//asar=false": "https://github.com/electron-userland/electron-builder/issues/675",
|
||||||
"asar": false,
|
"asar": false,
|
||||||
"dereference": true,
|
"dereference": true,
|
||||||
"//files": "We bundle everything, so we only need to include webapp/",
|
"//files": "We bundle everything, so we only need to include webapp/",
|
||||||
"files": [
|
"files": [
|
||||||
"electron/src/**",
|
"node_modules/**",
|
||||||
"electron/img/**",
|
"src/**",
|
||||||
"webapp/**",
|
"img/**"
|
||||||
"package.json"
|
],
|
||||||
|
"extraResources": [
|
||||||
|
"webapp/**/*"
|
||||||
],
|
],
|
||||||
"linux": {
|
"linux": {
|
||||||
"target": "deb",
|
"target": "deb",
|
||||||
|
"category": "Network;InstantMessaging;Chat",
|
||||||
"maintainer": "support@riot.im",
|
"maintainer": "support@riot.im",
|
||||||
"desktop": {
|
"desktop": {
|
||||||
"StartupWMClass": "riot-web"
|
"StartupWMClass": "riot-web"
|
||||||
|
@ -159,10 +167,11 @@
|
||||||
},
|
},
|
||||||
"win": {
|
"win": {
|
||||||
"target": "squirrel"
|
"target": "squirrel"
|
||||||
|
},
|
||||||
|
"directories": {
|
||||||
|
"buildResources": "electron_app/build",
|
||||||
|
"output": "electron_app/dist",
|
||||||
|
"app": "electron_app"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"directories": {
|
|
||||||
"buildResources": "electron/build",
|
|
||||||
"output": "electron/dist"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
31
release.sh
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# Script to perform a release of vector-web.
|
# Script to perform a release of vector-web.
|
||||||
#
|
#
|
||||||
|
@ -9,4 +9,33 @@ set -e
|
||||||
|
|
||||||
cd `dirname $0`
|
cd `dirname $0`
|
||||||
|
|
||||||
|
for i in matrix-js-sdk matrix-react-sdk
|
||||||
|
do
|
||||||
|
depver=`cat package.json | jq -r .dependencies.\"$i\"`
|
||||||
|
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 'Yes' to continue anyway: "
|
||||||
|
read resp
|
||||||
|
if [ "$resp" != "Yes" ]
|
||||||
|
then
|
||||||
|
echo "OK, never mind."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# bump Electron's package.json first
|
||||||
|
release="${1#v}"
|
||||||
|
tag="v${release}"
|
||||||
|
echo "electron npm version"
|
||||||
|
|
||||||
|
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 "$@"
|
exec ./node_modules/matrix-js-sdk/release.sh -z "$@"
|
||||||
|
|
BIN
res/flags/AD.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
res/flags/AE.png
Normal file
After Width: | Height: | Size: 841 B |
BIN
res/flags/AF.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
res/flags/AG.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
res/flags/AI.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
res/flags/AL.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
res/flags/AM.png
Normal file
After Width: | Height: | Size: 744 B |
BIN
res/flags/AO.png
Normal file
After Width: | Height: | Size: 1 KiB |
BIN
res/flags/AQ.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
res/flags/AR.png
Normal file
After Width: | Height: | Size: 955 B |
BIN
res/flags/AS.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
res/flags/AT.png
Normal file
After Width: | Height: | Size: 701 B |
BIN
res/flags/AU.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
res/flags/AW.png
Normal file
After Width: | Height: | Size: 938 B |
BIN
res/flags/AX.png
Normal file
After Width: | Height: | Size: 900 B |
BIN
res/flags/AZ.png
Normal file
After Width: | Height: | Size: 978 B |
BIN
res/flags/BA.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
res/flags/BB.png
Normal file
After Width: | Height: | Size: 1 KiB |
BIN
res/flags/BD.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
res/flags/BE.png
Normal file
After Width: | Height: | Size: 689 B |
BIN
res/flags/BF.png
Normal file
After Width: | Height: | Size: 954 B |
BIN
res/flags/BG.png
Normal file
After Width: | Height: | Size: 737 B |
BIN
res/flags/BH.png
Normal file
After Width: | Height: | Size: 842 B |
BIN
res/flags/BI.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
res/flags/BJ.png
Normal file
After Width: | Height: | Size: 777 B |
BIN
res/flags/BL.png
Normal file
After Width: | Height: | Size: 692 B |
BIN
res/flags/BM.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
res/flags/BN.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
res/flags/BO.png
Normal file
After Width: | Height: | Size: 733 B |
BIN
res/flags/BQ.png
Normal file
After Width: | Height: | Size: 726 B |
BIN
res/flags/BR.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
res/flags/BS.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
res/flags/BT.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
res/flags/BV.png
Normal file
After Width: | Height: | Size: 866 B |
BIN
res/flags/BW.png
Normal file
After Width: | Height: | Size: 697 B |
BIN
res/flags/BY.png
Normal file
After Width: | Height: | Size: 950 B |
BIN
res/flags/BZ.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
res/flags/CA.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
res/flags/CC.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
res/flags/CD.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
res/flags/CF.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
res/flags/CG.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
res/flags/CH.png
Normal file
After Width: | Height: | Size: 800 B |
BIN
res/flags/CI.png
Normal file
After Width: | Height: | Size: 692 B |
BIN
res/flags/CK.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
res/flags/CL.png
Normal file
After Width: | Height: | Size: 964 B |
BIN
res/flags/CM.png
Normal file
After Width: | Height: | Size: 908 B |
BIN
res/flags/CN.png
Normal file
After Width: | Height: | Size: 1 KiB |
BIN
res/flags/CO.png
Normal file
After Width: | Height: | Size: 726 B |
BIN
res/flags/CR.png
Normal file
After Width: | Height: | Size: 734 B |
BIN
res/flags/CU.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
res/flags/CV.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
res/flags/CW.png
Normal file
After Width: | Height: | Size: 970 B |
BIN
res/flags/CX.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
res/flags/CY.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
res/flags/CZ.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
res/flags/DE.png
Normal file
After Width: | Height: | Size: 734 B |
BIN
res/flags/DJ.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
res/flags/DK.png
Normal file
After Width: | Height: | Size: 797 B |
BIN
res/flags/DM.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
res/flags/DO.png
Normal file
After Width: | Height: | Size: 946 B |
BIN
res/flags/DZ.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
res/flags/EC.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
res/flags/EE.png
Normal file
After Width: | Height: | Size: 723 B |