diff --git a/.gitignore b/.gitignore index 0978bc56..060ca6e9 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,8 @@ /key.pem /lib /node_modules +/electron_app/node_modules +/electron_app/dist /packages/ /webapp /.npmrc @@ -12,4 +14,6 @@ npm-debug.log electron/dist electron/pub -config.json +/.idea +/config.json +/src/component-index.js diff --git a/.modernizr.json b/.modernizr.json index 29e620a5..06be8b4f 100644 --- a/.modernizr.json +++ b/.modernizr.json @@ -9,6 +9,8 @@ "test/css/flexbox", "test/es5/specification", "test/css/objectfit", - "test/storage/localstorage" + "test/storage/localstorage", + "test/workers/webworkers", + "test/indexeddb" ] -} \ No newline at end of file +} diff --git a/.travis.yml b/.travis.yml index 9720d887..ff58bf37 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,5 @@ language: node_js node_js: - 6 # node v6, to match jenkins install: + - scripts/fetch-develop.deps.sh - npm install - - (cd node_modules/matrix-js-sdk && npm install) - - (cd node_modules/matrix-react-sdk && npm install) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2ed3149..21657005 100644 --- a/CHANGELOG.md +++ b/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) ========================================================================================== [Full Changelog](https://github.com/vector-im/riot-web/compare/v0.9.8-rc.3...v0.9.8) diff --git a/README.md b/README.md index 2d7ab81b..4c5452e1 100644 --- a/README.md +++ b/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. Clone the repo: `git clone https://github.com/vector-im/riot-web.git` 1. Switch to the riot-web directory: `cd riot-web` -1. Install the prerequisites: `npm install` -1. If you are using the `develop` branch of vector-web, you will probably need - to rebuild some of the dependencies, due to - https://github.com/npm/npm/issues/3055: - +1. If you're using the `develop` branch, install the develop versions of the + dependencies, as the released ones will be too old: ``` - (cd node_modules/matrix-js-sdk && npm install) - (cd node_modules/matrix-react-sdk && npm install) + 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 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 node_modules/matrix-js-sdk && npm install) - (cd node_modules/matrix-react-sdk && npm install) + 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 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 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 below for details) 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 - node_modules/.bin/electron . + npm run electron ``` 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. You'll need to do this in each new terminal you open before building Riot. +How to add a new translation? +============================= + +[translationsstatus](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 =============== @@ -292,7 +313,7 @@ bug or feature: * feature bug severity: - + * cosmetic - feature works functionally but UI/UX is broken * critical - whole app doesn't work * major - entire feature doesn't work diff --git a/config.sample.json b/config.sample.json index a65646ac..3c513f7a 100644 --- a/config.sample.json +++ b/config.sample.json @@ -4,7 +4,7 @@ "brand": "Riot", "integrations_ui_url": "https://scalar.vector.im/", "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, "roomDirectory": { "servers": [ diff --git a/docs/translating-dev.md b/docs/translating-dev.md new file mode 100644 index 00000000..80d4b64a --- /dev/null +++ b/docs/translating-dev.md @@ -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. diff --git a/docs/translating.md b/docs/translating.md new file mode 100644 index 00000000..ca9920d3 --- /dev/null +++ b/docs/translating.md @@ -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. `` and ``. 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 diff --git a/electron/img/riot.ico b/electron/img/riot.ico deleted file mode 100644 index 8b681ffb..00000000 Binary files a/electron/img/riot.ico and /dev/null differ diff --git a/electron/img/riot.png b/electron/img/riot.png deleted file mode 100644 index fe13aa99..00000000 Binary files a/electron/img/riot.png and /dev/null differ diff --git a/electron/riot.im/config.json b/electron/riot.im/config.json deleted file mode 100644 index c5bc65e1..00000000 --- a/electron/riot.im/config.json +++ /dev/null @@ -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]+$" - } - } - } -} diff --git a/electron/src/vectormenu.js b/electron/src/vectormenu.js deleted file mode 100644 index 70ed3ac3..00000000 --- a/electron/src/vectormenu.js +++ /dev/null @@ -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) - diff --git a/electron/build/icon.icns b/electron_app/build/icon.icns similarity index 100% rename from electron/build/icon.icns rename to electron_app/build/icon.icns diff --git a/electron/build/icon.ico b/electron_app/build/icon.ico similarity index 100% rename from electron/build/icon.ico rename to electron_app/build/icon.ico diff --git a/electron/build/icons/128x128.png b/electron_app/build/icons/128x128.png similarity index 100% rename from electron/build/icons/128x128.png rename to electron_app/build/icons/128x128.png diff --git a/electron/build/icons/16x16.png b/electron_app/build/icons/16x16.png similarity index 100% rename from electron/build/icons/16x16.png rename to electron_app/build/icons/16x16.png diff --git a/electron/build/icons/24x24.png b/electron_app/build/icons/24x24.png similarity index 100% rename from electron/build/icons/24x24.png rename to electron_app/build/icons/24x24.png diff --git a/electron/build/icons/256x256.png b/electron_app/build/icons/256x256.png similarity index 100% rename from electron/build/icons/256x256.png rename to electron_app/build/icons/256x256.png diff --git a/electron/build/icons/48x48.png b/electron_app/build/icons/48x48.png similarity index 100% rename from electron/build/icons/48x48.png rename to electron_app/build/icons/48x48.png diff --git a/electron/build/icons/512x512.png b/electron_app/build/icons/512x512.png similarity index 100% rename from electron/build/icons/512x512.png rename to electron_app/build/icons/512x512.png diff --git a/electron/build/icons/64x64.png b/electron_app/build/icons/64x64.png similarity index 100% rename from electron/build/icons/64x64.png rename to electron_app/build/icons/64x64.png diff --git a/electron/build/icons/96x96.png b/electron_app/build/icons/96x96.png similarity index 100% rename from electron/build/icons/96x96.png rename to electron_app/build/icons/96x96.png diff --git a/electron/build/install-spinner.gif b/electron_app/build/install-spinner.gif similarity index 100% rename from electron/build/install-spinner.gif rename to electron_app/build/install-spinner.gif diff --git a/electron_app/img/riot.ico b/electron_app/img/riot.ico new file mode 100644 index 00000000..8f8ff94e Binary files /dev/null and b/electron_app/img/riot.ico differ diff --git a/electron_app/img/riot.png b/electron_app/img/riot.png new file mode 100644 index 00000000..85e9f8ca Binary files /dev/null and b/electron_app/img/riot.png differ diff --git a/electron_app/package.json b/electron_app/package.json new file mode 100644 index 00000000..df9c3bd2 --- /dev/null +++ b/electron_app/package.json @@ -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" + } +} diff --git a/electron/riot.im/README b/electron_app/riot.im/README similarity index 100% rename from electron/riot.im/README rename to electron_app/riot.im/README diff --git a/electron_app/riot.im/config.json b/electron_app/riot.im/config.json new file mode 100644 index 00000000..80526f4a --- /dev/null +++ b/electron_app/riot.im/config.json @@ -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" + ] + } +} diff --git a/electron/src/electron-main.js b/electron_app/src/electron-main.js similarity index 64% rename from electron/src/electron-main.js rename to electron_app/src/electron-main.js index e6ffffac..ca8c3a1b 100644 --- a/electron/src/electron-main.js +++ b/electron_app/src/electron-main.js @@ -1,5 +1,3 @@ -// @flow - /* Copyright 2016 Aviral Dasgupta Copyright 2016 OpenMarket Ltd @@ -20,15 +18,16 @@ 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 check_squirrel_hooks = require('./squirrelhooks'); -if (check_squirrel_hooks()) return; +const checkSquirrelHooks = require('./squirrelhooks'); +if (checkSquirrelHooks()) return; const electron = require('electron'); -const url = require('url'); 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 = {}; try { @@ -40,12 +39,6 @@ try { // Continue with the defaults (ie. an empty config) } -const PERMITTED_URL_SCHEMES = [ - 'http:', - 'https:', - 'mailto:', -]; - const UPDATE_POLL_INTERVAL_MS = 60 * 60 * 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 // (for instance, open /bin/sh does indeed open a terminal // with a shell, albeit with no arguments) - const parsed_url = url.parse(target); - if (PERMITTED_URL_SCHEMES.indexOf(parsed_url.protocol) > -1) { + 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 new_target = url.format(parsed_url); - electron.shell.openExternal(new_target); + const newTarget = url.format(parsedUrl); + electron.shell.openExternal(newTarget); } } @@ -77,14 +70,19 @@ function onWindowOrNavigate(ev, target) { } function onLinkContextMenu(ev, params) { - const popup_menu = new electron.Menu(); - popup_menu.append(new electron.MenuItem({ + const popupMenu = new electron.Menu(); + + popupMenu.append(new electron.MenuItem({ label: params.linkURL, - click() { - safeOpenURL(params.linkURL); - }, + click() { 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(); } @@ -99,13 +97,13 @@ function pollForUpdates() { try { electron.autoUpdater.checkForUpdates(); } catch (e) { - console.log("Couldn't check for update", e); + console.log('Couldn\'t check for update', e); } } -function startAutoUpdate(update_base_url) { - if (update_base_url.slice(-1) !== '/') { - update_base_url = update_base_url + '/'; +function startAutoUpdate(updateBaseUrl) { + if (updateBaseUrl.slice(-1) !== '/') { + updateBaseUrl = updateBaseUrl + '/'; } try { // 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 // 204 No Content. On windows it takes a base path and looks for // 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 // 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 @@ -121,16 +119,15 @@ function startAutoUpdate(update_base_url) { // 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. electron.autoUpdater.setFeedURL( - update_base_url + - 'macos/?localVersion=' + encodeURIComponent(electron.app.getVersion()) - ); - } else if (process.platform == 'win32') { - electron.autoUpdater.setFeedURL(update_base_url + 'win32/' + process.arch + '/'); + `${updateBaseUrl}macos/?localVersion=${encodeURIComponent(electron.app.getVersion())}`); + + } else if (process.platform === 'win32') { + electron.autoUpdater.setFeedURL(`${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"); + console.log('Auto update not supported on this platform'); } // 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: @@ -143,7 +140,7 @@ function startAutoUpdate(update_base_url) { setInterval(pollForUpdates, UPDATE_POLL_INTERVAL_MS); } catch (err) { // 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). // Assuming we generally run from the console when developing, // this is far preferable. -process.on('uncaughtException', function (error) { - console.log("Unhandled exception", error); +process.on('uncaughtException', function(error) { + console.log('Unhandled exception', error); }); 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'); const shouldQuit = electron.app.makeSingleInstance((commandLine, workingDirectory) => { @@ -171,34 +205,43 @@ const shouldQuit = electron.app.makeSingleInstance((commandLine, workingDirector }); if (shouldQuit) { - electron.app.quit() + console.log('Other instance detected: exiting'); + electron.app.quit(); } electron.app.on('ready', () => { 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); } 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.` + ( - process.platform == 'win32' ? 'ico' : 'png' - ); + 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 = new electron.BrowserWindow({ - icon: icon_path, - width: 1024, height: 768, + 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); + electron.Menu.setApplicationMenu(vectorMenu); // Create trayIcon icon tray.create(mainWindow, { - icon_path: icon_path, - brand: vectorConfig.brand || 'Riot' + icon_path: iconPath, + brand: vectorConfig.brand || 'Riot', }); if (!process.argv.includes('--hidden')) { @@ -211,7 +254,7 @@ electron.app.on('ready', () => { mainWindow = null; }); 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 // (this is generally how single-window Mac apps // behave, eg. Mail.app) @@ -221,14 +264,8 @@ electron.app.on('ready', () => { } }); - mainWindow.webContents.on('new-window', onWindowOrNavigate); - mainWindow.webContents.on('will-navigate', onWindowOrNavigate); - - mainWindow.webContents.on('context-menu', function(ev, params) { - if (params.linkURL) { - onLinkContextMenu(ev, params); - } - }); + webContentsHandler(mainWindow.webContents); + mainWindowState.manage(mainWindow); }); electron.app.on('window-all-closed', () => { diff --git a/electron/src/squirrelhooks.js b/electron_app/src/squirrelhooks.js similarity index 77% rename from electron/src/squirrelhooks.js rename to electron_app/src/squirrelhooks.js index 15ed670f..728c9cfb 100644 --- a/electron/src/squirrelhooks.js +++ b/electron_app/src/squirrelhooks.js @@ -16,30 +16,30 @@ limitations under the License. const path = require('path'); 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 // 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 `%s` with args `%s`', updateExe, args); + console.log(`Spawning '${updateExe}' with args '${args}'`); spawn(updateExe, args, { - detached: true + detached: true, }).on('close', done); -}; +} -function check_squirrel_hooks() { - if (process.platform != 'win32') return false; +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') { - run_update_exe(['--createShortcut=' + target + ''], app.quit); + runUpdateExe(['--createShortcut=' + target + ''], app.quit); return true; } else if (cmd === '--squirrel-uninstall') { - run_update_exe(['--removeShortcut=' + target + ''], app.quit); + runUpdateExe(['--removeShortcut=' + target + ''], app.quit); return true; } else if (cmd === '--squirrel-obsolete') { app.quit(); @@ -48,4 +48,4 @@ function check_squirrel_hooks() { return false; } -module.exports = check_squirrel_hooks; +module.exports = checkSquirrelHooks; diff --git a/electron/src/tray.js b/electron_app/src/tray.js similarity index 51% rename from electron/src/tray.js rename to electron_app/src/tray.js index 2ccdf40c..9df1a0fb 100644 --- a/electron/src/tray.js +++ b/electron_app/src/tray.js @@ -15,26 +15,19 @@ See the License for the specific language governing permissions and limitations under the License. */ -const path = require('path'); -const electron = require('electron'); - -const app = electron.app; -const Tray = electron.Tray; -const MenuItem = electron.MenuItem; +const {app, Tray, Menu, nativeImage} = require('electron'); let trayIcon = null; exports.hasTray = function hasTray() { return (trayIcon !== null); -} +}; -exports.create = function (win, config) { +exports.create = function(win, config) { // no trays on darwin - if (process.platform === 'darwin' || trayIcon) { - return; - } + if (process.platform === 'darwin' || trayIcon) return; - const toggleWin = function () { + const toggleWin = function() { if (win.isVisible() && !win.isMinimized()) { win.hide(); } else { @@ -44,24 +37,46 @@ exports.create = function (win, config) { } }; - const contextMenu = electron.Menu.buildFromTemplate([ + const contextMenu = Menu.buildFromTemplate([ { - label: 'Show/Hide ' + config.brand, - click: toggleWin - }, - { - type: 'separator' + label: `Show/Hide ${config.brand}`, + click: toggleWin, }, + { type: 'separator' }, { label: 'Quit', - click: function () { + click: function() { app.quit(); - } - } + }, + }, ]); trayIcon = new Tray(config.icon_path); trayIcon.setToolTip(config.brand); trayIcon.setContextMenu(contextMenu); 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); + }); }; diff --git a/electron_app/src/vectormenu.js b/electron_app/src/vectormenu.js new file mode 100644 index 00000000..ab30b376 --- /dev/null +++ b/electron_app/src/vectormenu.js @@ -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); + diff --git a/electron_app/src/webcontents-handler.js b/electron_app/src/webcontents-handler.js new file mode 100644 index 00000000..37416ebe --- /dev/null +++ b/electron_app/src/webcontents-handler.js @@ -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); + } + }); +}; diff --git a/karma.conf.js b/karma.conf.js index b0a48c92..1e043663 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -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.root = [ - path.resolve('./src'), path.resolve('./test'), ]; diff --git a/package.json b/package.json index 843b69dc..29b5beee 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "riot-web", "productName": "Riot", - "main": "electron/src/electron-main.js", - "version": "0.9.8", + "main": "electron_app/src/electron-main.js", + "version": "0.9.10", "description": "A feature-rich client for Matrix.org", "author": "Vector Creations Ltd.", "repository": { @@ -27,20 +27,23 @@ "matrix-react-parent": "matrix-react-sdk", "scripts": { "reskindex": "reskindex -h src/header", + "reskindex:watch": "reskindex -h src/header -w", "build:res": "node scripts/copy-res.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:dev": "webpack --optimize-occurence-order --progress", "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:dev": "node scripts/babelcheck.js && npm run build:res && npm run build:bundle:dev", + "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", + "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": "node scripts/babelcheck.js && parallelshell \"npm run start:res\" \"npm run start:js\"", - "start:prod": "parallelshell \"npm run start:res\" \"npm run start:js:prod\"", + "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/dist", @@ -56,8 +59,9 @@ "draft-js": "^0.8.1", "extract-text-webpack-plugin": "^0.9.1", "favico.js": "^0.3.10", - "filesize": "^3.1.2", + "filesize": "3.5.6", "flux": "~2.0.3", + "gemini-scrollbar": "matrix-org/gemini-scrollbar#b302279", "gfm.css": "^1.1.1", "highlight.js": "^9.0.0", "linkifyjs": "^2.1.3", @@ -70,7 +74,7 @@ "react-dnd": "^2.1.4", "react-dnd-html5-backend": "^2.1.2", "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", "ua-parser-js": "^0.7.10", "url": "^0.11.0" @@ -100,6 +104,7 @@ "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", @@ -139,19 +144,22 @@ "build": { "appId": "im.riot.app", "category": "Network", - "electronVersion": "1.6.2", + "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": [ - "electron/src/**", - "electron/img/**", - "webapp/**", - "package.json" + "node_modules/**", + "src/**", + "img/**" + ], + "extraResources": [ + "webapp/**/*" ], "linux": { "target": "deb", + "category": "Network;InstantMessaging;Chat", "maintainer": "support@riot.im", "desktop": { "StartupWMClass": "riot-web" @@ -159,10 +167,11 @@ }, "win": { "target": "squirrel" + }, + "directories": { + "buildResources": "electron_app/build", + "output": "electron_app/dist", + "app": "electron_app" } - }, - "directories": { - "buildResources": "electron/build", - "output": "electron/dist" } } diff --git a/release.sh b/release.sh index e8c68b90..8ae307f7 100755 --- a/release.sh +++ b/release.sh @@ -1,12 +1,41 @@ -#!/bin/sh +#!/bin/bash # # Script to perform a release of vector-web. # -# Requires github-changelog-generator; to install, do +# Requires github-changelog-generator; to install, do # pip install git+https://github.com/matrix-org/github-changelog-generator.git set -e 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 "$@" diff --git a/res/flags/AD.png b/res/flags/AD.png new file mode 100644 index 00000000..8e777b98 Binary files /dev/null and b/res/flags/AD.png differ diff --git a/res/flags/AE.png b/res/flags/AE.png new file mode 100644 index 00000000..1c4a2bb7 Binary files /dev/null and b/res/flags/AE.png differ diff --git a/res/flags/AF.png b/res/flags/AF.png new file mode 100644 index 00000000..7d369371 Binary files /dev/null and b/res/flags/AF.png differ diff --git a/res/flags/AG.png b/res/flags/AG.png new file mode 100644 index 00000000..78c03626 Binary files /dev/null and b/res/flags/AG.png differ diff --git a/res/flags/AI.png b/res/flags/AI.png new file mode 100644 index 00000000..8a707823 Binary files /dev/null and b/res/flags/AI.png differ diff --git a/res/flags/AL.png b/res/flags/AL.png new file mode 100644 index 00000000..b19c7bc5 Binary files /dev/null and b/res/flags/AL.png differ diff --git a/res/flags/AM.png b/res/flags/AM.png new file mode 100644 index 00000000..b39695fd Binary files /dev/null and b/res/flags/AM.png differ diff --git a/res/flags/AO.png b/res/flags/AO.png new file mode 100644 index 00000000..5aee75af Binary files /dev/null and b/res/flags/AO.png differ diff --git a/res/flags/AQ.png b/res/flags/AQ.png new file mode 100644 index 00000000..fa76fbb2 Binary files /dev/null and b/res/flags/AQ.png differ diff --git a/res/flags/AR.png b/res/flags/AR.png new file mode 100644 index 00000000..28750f42 Binary files /dev/null and b/res/flags/AR.png differ diff --git a/res/flags/AS.png b/res/flags/AS.png new file mode 100644 index 00000000..36ba9b34 Binary files /dev/null and b/res/flags/AS.png differ diff --git a/res/flags/AT.png b/res/flags/AT.png new file mode 100644 index 00000000..487fee82 Binary files /dev/null and b/res/flags/AT.png differ diff --git a/res/flags/AU.png b/res/flags/AU.png new file mode 100644 index 00000000..7004861f Binary files /dev/null and b/res/flags/AU.png differ diff --git a/res/flags/AW.png b/res/flags/AW.png new file mode 100644 index 00000000..238084e4 Binary files /dev/null and b/res/flags/AW.png differ diff --git a/res/flags/AX.png b/res/flags/AX.png new file mode 100644 index 00000000..07ac7742 Binary files /dev/null and b/res/flags/AX.png differ diff --git a/res/flags/AZ.png b/res/flags/AZ.png new file mode 100644 index 00000000..686dbed7 Binary files /dev/null and b/res/flags/AZ.png differ diff --git a/res/flags/BA.png b/res/flags/BA.png new file mode 100644 index 00000000..5cfbb6d6 Binary files /dev/null and b/res/flags/BA.png differ diff --git a/res/flags/BB.png b/res/flags/BB.png new file mode 100644 index 00000000..dcdbae7a Binary files /dev/null and b/res/flags/BB.png differ diff --git a/res/flags/BD.png b/res/flags/BD.png new file mode 100644 index 00000000..3bd977a4 Binary files /dev/null and b/res/flags/BD.png differ diff --git a/res/flags/BE.png b/res/flags/BE.png new file mode 100644 index 00000000..555ac8bb Binary files /dev/null and b/res/flags/BE.png differ diff --git a/res/flags/BF.png b/res/flags/BF.png new file mode 100644 index 00000000..5a80be2a Binary files /dev/null and b/res/flags/BF.png differ diff --git a/res/flags/BG.png b/res/flags/BG.png new file mode 100644 index 00000000..6d8be358 Binary files /dev/null and b/res/flags/BG.png differ diff --git a/res/flags/BH.png b/res/flags/BH.png new file mode 100644 index 00000000..0d98e0e0 Binary files /dev/null and b/res/flags/BH.png differ diff --git a/res/flags/BI.png b/res/flags/BI.png new file mode 100644 index 00000000..e2659e3b Binary files /dev/null and b/res/flags/BI.png differ diff --git a/res/flags/BJ.png b/res/flags/BJ.png new file mode 100644 index 00000000..13fa3c91 Binary files /dev/null and b/res/flags/BJ.png differ diff --git a/res/flags/BL.png b/res/flags/BL.png new file mode 100644 index 00000000..8e50a796 Binary files /dev/null and b/res/flags/BL.png differ diff --git a/res/flags/BM.png b/res/flags/BM.png new file mode 100644 index 00000000..53de7c39 Binary files /dev/null and b/res/flags/BM.png differ diff --git a/res/flags/BN.png b/res/flags/BN.png new file mode 100644 index 00000000..3ed976eb Binary files /dev/null and b/res/flags/BN.png differ diff --git a/res/flags/BO.png b/res/flags/BO.png new file mode 100644 index 00000000..8e20ea8c Binary files /dev/null and b/res/flags/BO.png differ diff --git a/res/flags/BQ.png b/res/flags/BQ.png new file mode 100644 index 00000000..15472266 Binary files /dev/null and b/res/flags/BQ.png differ diff --git a/res/flags/BR.png b/res/flags/BR.png new file mode 100644 index 00000000..7a2bc17a Binary files /dev/null and b/res/flags/BR.png differ diff --git a/res/flags/BS.png b/res/flags/BS.png new file mode 100644 index 00000000..2a152575 Binary files /dev/null and b/res/flags/BS.png differ diff --git a/res/flags/BT.png b/res/flags/BT.png new file mode 100644 index 00000000..4782cf34 Binary files /dev/null and b/res/flags/BT.png differ diff --git a/res/flags/BV.png b/res/flags/BV.png new file mode 100644 index 00000000..991a6cd7 Binary files /dev/null and b/res/flags/BV.png differ diff --git a/res/flags/BW.png b/res/flags/BW.png new file mode 100644 index 00000000..cd788955 Binary files /dev/null and b/res/flags/BW.png differ diff --git a/res/flags/BY.png b/res/flags/BY.png new file mode 100644 index 00000000..40cdd8a7 Binary files /dev/null and b/res/flags/BY.png differ diff --git a/res/flags/BZ.png b/res/flags/BZ.png new file mode 100644 index 00000000..5de79b76 Binary files /dev/null and b/res/flags/BZ.png differ diff --git a/res/flags/CA.png b/res/flags/CA.png new file mode 100644 index 00000000..68bcac99 Binary files /dev/null and b/res/flags/CA.png differ diff --git a/res/flags/CC.png b/res/flags/CC.png new file mode 100644 index 00000000..13fe2b7f Binary files /dev/null and b/res/flags/CC.png differ diff --git a/res/flags/CD.png b/res/flags/CD.png new file mode 100644 index 00000000..c1930409 Binary files /dev/null and b/res/flags/CD.png differ diff --git a/res/flags/CF.png b/res/flags/CF.png new file mode 100644 index 00000000..6df77507 Binary files /dev/null and b/res/flags/CF.png differ diff --git a/res/flags/CG.png b/res/flags/CG.png new file mode 100644 index 00000000..2d37cd50 Binary files /dev/null and b/res/flags/CG.png differ diff --git a/res/flags/CH.png b/res/flags/CH.png new file mode 100644 index 00000000..00d38717 Binary files /dev/null and b/res/flags/CH.png differ diff --git a/res/flags/CI.png b/res/flags/CI.png new file mode 100644 index 00000000..82c7606e Binary files /dev/null and b/res/flags/CI.png differ diff --git a/res/flags/CK.png b/res/flags/CK.png new file mode 100644 index 00000000..26bca5f9 Binary files /dev/null and b/res/flags/CK.png differ diff --git a/res/flags/CL.png b/res/flags/CL.png new file mode 100644 index 00000000..317ec573 Binary files /dev/null and b/res/flags/CL.png differ diff --git a/res/flags/CM.png b/res/flags/CM.png new file mode 100644 index 00000000..c5605d63 Binary files /dev/null and b/res/flags/CM.png differ diff --git a/res/flags/CN.png b/res/flags/CN.png new file mode 100644 index 00000000..1c25ab86 Binary files /dev/null and b/res/flags/CN.png differ diff --git a/res/flags/CO.png b/res/flags/CO.png new file mode 100644 index 00000000..b328c1ea Binary files /dev/null and b/res/flags/CO.png differ diff --git a/res/flags/CR.png b/res/flags/CR.png new file mode 100644 index 00000000..df959197 Binary files /dev/null and b/res/flags/CR.png differ diff --git a/res/flags/CU.png b/res/flags/CU.png new file mode 100644 index 00000000..60f6a8c8 Binary files /dev/null and b/res/flags/CU.png differ diff --git a/res/flags/CV.png b/res/flags/CV.png new file mode 100644 index 00000000..2dfe516d Binary files /dev/null and b/res/flags/CV.png differ diff --git a/res/flags/CW.png b/res/flags/CW.png new file mode 100644 index 00000000..2380de15 Binary files /dev/null and b/res/flags/CW.png differ diff --git a/res/flags/CX.png b/res/flags/CX.png new file mode 100644 index 00000000..49a51c16 Binary files /dev/null and b/res/flags/CX.png differ diff --git a/res/flags/CY.png b/res/flags/CY.png new file mode 100644 index 00000000..08a0e372 Binary files /dev/null and b/res/flags/CY.png differ diff --git a/res/flags/CZ.png b/res/flags/CZ.png new file mode 100644 index 00000000..90ceaa24 Binary files /dev/null and b/res/flags/CZ.png differ diff --git a/res/flags/DE.png b/res/flags/DE.png new file mode 100644 index 00000000..90cab7e9 Binary files /dev/null and b/res/flags/DE.png differ diff --git a/res/flags/DJ.png b/res/flags/DJ.png new file mode 100644 index 00000000..c424a807 Binary files /dev/null and b/res/flags/DJ.png differ diff --git a/res/flags/DK.png b/res/flags/DK.png new file mode 100644 index 00000000..5a3845ad Binary files /dev/null and b/res/flags/DK.png differ diff --git a/res/flags/DM.png b/res/flags/DM.png new file mode 100644 index 00000000..e7fb60c0 Binary files /dev/null and b/res/flags/DM.png differ diff --git a/res/flags/DO.png b/res/flags/DO.png new file mode 100644 index 00000000..03c2f1b9 Binary files /dev/null and b/res/flags/DO.png differ diff --git a/res/flags/DZ.png b/res/flags/DZ.png new file mode 100644 index 00000000..9d63939e Binary files /dev/null and b/res/flags/DZ.png differ diff --git a/res/flags/EC.png b/res/flags/EC.png new file mode 100644 index 00000000..92e2a9e9 Binary files /dev/null and b/res/flags/EC.png differ diff --git a/res/flags/EE.png b/res/flags/EE.png new file mode 100644 index 00000000..08156869 Binary files /dev/null and b/res/flags/EE.png differ diff --git a/res/flags/EG.png b/res/flags/EG.png new file mode 100644 index 00000000..7e9d6c5c Binary files /dev/null and b/res/flags/EG.png differ diff --git a/res/flags/EH.png b/res/flags/EH.png new file mode 100644 index 00000000..f8e59b21 Binary files /dev/null and b/res/flags/EH.png differ diff --git a/res/flags/ER.png b/res/flags/ER.png new file mode 100644 index 00000000..ffeb28da Binary files /dev/null and b/res/flags/ER.png differ diff --git a/res/flags/ES.png b/res/flags/ES.png new file mode 100644 index 00000000..3ce59fe8 Binary files /dev/null and b/res/flags/ES.png differ diff --git a/res/flags/ET.png b/res/flags/ET.png new file mode 100644 index 00000000..f9d92859 Binary files /dev/null and b/res/flags/ET.png differ diff --git a/res/flags/FI.png b/res/flags/FI.png new file mode 100644 index 00000000..0930988c Binary files /dev/null and b/res/flags/FI.png differ diff --git a/res/flags/FJ.png b/res/flags/FJ.png new file mode 100644 index 00000000..2a78075d Binary files /dev/null and b/res/flags/FJ.png differ diff --git a/res/flags/FK.png b/res/flags/FK.png new file mode 100644 index 00000000..52543390 Binary files /dev/null and b/res/flags/FK.png differ diff --git a/res/flags/FM.png b/res/flags/FM.png new file mode 100644 index 00000000..0ba546ed Binary files /dev/null and b/res/flags/FM.png differ diff --git a/res/flags/FO.png b/res/flags/FO.png new file mode 100644 index 00000000..2a0cd645 Binary files /dev/null and b/res/flags/FO.png differ diff --git a/res/flags/FR.png b/res/flags/FR.png new file mode 100644 index 00000000..ef05d74b Binary files /dev/null and b/res/flags/FR.png differ diff --git a/res/flags/GA.png b/res/flags/GA.png new file mode 100644 index 00000000..6539d6dd Binary files /dev/null and b/res/flags/GA.png differ diff --git a/res/flags/GB.png b/res/flags/GB.png new file mode 100644 index 00000000..2938e61b Binary files /dev/null and b/res/flags/GB.png differ diff --git a/res/flags/GD.png b/res/flags/GD.png new file mode 100644 index 00000000..a55638e7 Binary files /dev/null and b/res/flags/GD.png differ diff --git a/res/flags/GE.png b/res/flags/GE.png new file mode 100644 index 00000000..c6cfd2b0 Binary files /dev/null and b/res/flags/GE.png differ diff --git a/res/flags/GF.png b/res/flags/GF.png new file mode 100644 index 00000000..dfc1badf Binary files /dev/null and b/res/flags/GF.png differ diff --git a/res/flags/GG.png b/res/flags/GG.png new file mode 100644 index 00000000..a79f8c1f Binary files /dev/null and b/res/flags/GG.png differ diff --git a/res/flags/GH.png b/res/flags/GH.png new file mode 100644 index 00000000..bda5d6f6 Binary files /dev/null and b/res/flags/GH.png differ diff --git a/res/flags/GI.png b/res/flags/GI.png new file mode 100644 index 00000000..620b50b3 Binary files /dev/null and b/res/flags/GI.png differ diff --git a/res/flags/GL.png b/res/flags/GL.png new file mode 100644 index 00000000..c3d6bcf3 Binary files /dev/null and b/res/flags/GL.png differ diff --git a/res/flags/GM.png b/res/flags/GM.png new file mode 100644 index 00000000..fa2d771e Binary files /dev/null and b/res/flags/GM.png differ diff --git a/res/flags/GN.png b/res/flags/GN.png new file mode 100644 index 00000000..dabe7ce4 Binary files /dev/null and b/res/flags/GN.png differ diff --git a/res/flags/GP.png b/res/flags/GP.png new file mode 100644 index 00000000..7bf76956 Binary files /dev/null and b/res/flags/GP.png differ diff --git a/res/flags/GQ.png b/res/flags/GQ.png new file mode 100644 index 00000000..edae61e9 Binary files /dev/null and b/res/flags/GQ.png differ diff --git a/res/flags/GR.png b/res/flags/GR.png new file mode 100644 index 00000000..5abc59d3 Binary files /dev/null and b/res/flags/GR.png differ diff --git a/res/flags/GS.png b/res/flags/GS.png new file mode 100644 index 00000000..baa930d0 Binary files /dev/null and b/res/flags/GS.png differ diff --git a/res/flags/GT.png b/res/flags/GT.png new file mode 100644 index 00000000..10ef0cdd Binary files /dev/null and b/res/flags/GT.png differ diff --git a/res/flags/GU.png b/res/flags/GU.png new file mode 100644 index 00000000..166c121e Binary files /dev/null and b/res/flags/GU.png differ diff --git a/res/flags/GW.png b/res/flags/GW.png new file mode 100644 index 00000000..fb59de83 Binary files /dev/null and b/res/flags/GW.png differ diff --git a/res/flags/GY.png b/res/flags/GY.png new file mode 100644 index 00000000..65499a7c Binary files /dev/null and b/res/flags/GY.png differ diff --git a/res/flags/HK.png b/res/flags/HK.png new file mode 100644 index 00000000..39588384 Binary files /dev/null and b/res/flags/HK.png differ diff --git a/res/flags/HM.png b/res/flags/HM.png new file mode 100644 index 00000000..26a61cbf Binary files /dev/null and b/res/flags/HM.png differ diff --git a/res/flags/HN.png b/res/flags/HN.png new file mode 100644 index 00000000..bf923cb8 Binary files /dev/null and b/res/flags/HN.png differ diff --git a/res/flags/HR.png b/res/flags/HR.png new file mode 100644 index 00000000..139e143b Binary files /dev/null and b/res/flags/HR.png differ diff --git a/res/flags/HT.png b/res/flags/HT.png new file mode 100644 index 00000000..2583da39 Binary files /dev/null and b/res/flags/HT.png differ diff --git a/res/flags/HU.png b/res/flags/HU.png new file mode 100644 index 00000000..625846af Binary files /dev/null and b/res/flags/HU.png differ diff --git a/res/flags/ID.png b/res/flags/ID.png new file mode 100644 index 00000000..f88d48af Binary files /dev/null and b/res/flags/ID.png differ diff --git a/res/flags/IE.png b/res/flags/IE.png new file mode 100644 index 00000000..17f255fc Binary files /dev/null and b/res/flags/IE.png differ diff --git a/res/flags/IL.png b/res/flags/IL.png new file mode 100644 index 00000000..6c9a6b57 Binary files /dev/null and b/res/flags/IL.png differ diff --git a/res/flags/IM.png b/res/flags/IM.png new file mode 100644 index 00000000..936e801d Binary files /dev/null and b/res/flags/IM.png differ diff --git a/res/flags/IN.png b/res/flags/IN.png new file mode 100644 index 00000000..ecba2f9c Binary files /dev/null and b/res/flags/IN.png differ diff --git a/res/flags/IO.png b/res/flags/IO.png new file mode 100644 index 00000000..b0edb161 Binary files /dev/null and b/res/flags/IO.png differ diff --git a/res/flags/IQ.png b/res/flags/IQ.png new file mode 100644 index 00000000..19055f14 Binary files /dev/null and b/res/flags/IQ.png differ diff --git a/res/flags/IR.png b/res/flags/IR.png new file mode 100644 index 00000000..9056d21e Binary files /dev/null and b/res/flags/IR.png differ diff --git a/res/flags/IS.png b/res/flags/IS.png new file mode 100644 index 00000000..06be01a8 Binary files /dev/null and b/res/flags/IS.png differ diff --git a/res/flags/IT.png b/res/flags/IT.png new file mode 100644 index 00000000..50e17b22 Binary files /dev/null and b/res/flags/IT.png differ diff --git a/res/flags/JE.png b/res/flags/JE.png new file mode 100644 index 00000000..456a1a83 Binary files /dev/null and b/res/flags/JE.png differ diff --git a/res/flags/JM.png b/res/flags/JM.png new file mode 100644 index 00000000..5e4e73d3 Binary files /dev/null and b/res/flags/JM.png differ diff --git a/res/flags/JO.png b/res/flags/JO.png new file mode 100644 index 00000000..5982705b Binary files /dev/null and b/res/flags/JO.png differ diff --git a/res/flags/JP.png b/res/flags/JP.png new file mode 100644 index 00000000..009a990a Binary files /dev/null and b/res/flags/JP.png differ diff --git a/res/flags/KE.png b/res/flags/KE.png new file mode 100644 index 00000000..b5a9f733 Binary files /dev/null and b/res/flags/KE.png differ diff --git a/res/flags/KG.png b/res/flags/KG.png new file mode 100644 index 00000000..acf6646b Binary files /dev/null and b/res/flags/KG.png differ diff --git a/res/flags/KH.png b/res/flags/KH.png new file mode 100644 index 00000000..58ad9c61 Binary files /dev/null and b/res/flags/KH.png differ diff --git a/res/flags/KI.png b/res/flags/KI.png new file mode 100644 index 00000000..49902d25 Binary files /dev/null and b/res/flags/KI.png differ diff --git a/res/flags/KM.png b/res/flags/KM.png new file mode 100644 index 00000000..9fa9a454 Binary files /dev/null and b/res/flags/KM.png differ diff --git a/res/flags/KN.png b/res/flags/KN.png new file mode 100644 index 00000000..3b39f8f7 Binary files /dev/null and b/res/flags/KN.png differ diff --git a/res/flags/KP.png b/res/flags/KP.png new file mode 100644 index 00000000..eacc3ad0 Binary files /dev/null and b/res/flags/KP.png differ diff --git a/res/flags/KR.png b/res/flags/KR.png new file mode 100644 index 00000000..a0df8da0 Binary files /dev/null and b/res/flags/KR.png differ diff --git a/res/flags/KW.png b/res/flags/KW.png new file mode 100644 index 00000000..c6839950 Binary files /dev/null and b/res/flags/KW.png differ diff --git a/res/flags/KY.png b/res/flags/KY.png new file mode 100644 index 00000000..3f82fa74 Binary files /dev/null and b/res/flags/KY.png differ diff --git a/res/flags/KZ.png b/res/flags/KZ.png new file mode 100644 index 00000000..4b436212 Binary files /dev/null and b/res/flags/KZ.png differ diff --git a/res/flags/LA.png b/res/flags/LA.png new file mode 100644 index 00000000..ee9c41ea Binary files /dev/null and b/res/flags/LA.png differ diff --git a/res/flags/LB.png b/res/flags/LB.png new file mode 100644 index 00000000..7b4d6653 Binary files /dev/null and b/res/flags/LB.png differ diff --git a/res/flags/LC.png b/res/flags/LC.png new file mode 100644 index 00000000..d97f8d8d Binary files /dev/null and b/res/flags/LC.png differ diff --git a/res/flags/LI.png b/res/flags/LI.png new file mode 100644 index 00000000..c75a229f Binary files /dev/null and b/res/flags/LI.png differ diff --git a/res/flags/LK.png b/res/flags/LK.png new file mode 100644 index 00000000..2ca1a0c1 Binary files /dev/null and b/res/flags/LK.png differ diff --git a/res/flags/LR.png b/res/flags/LR.png new file mode 100644 index 00000000..41bf4a96 Binary files /dev/null and b/res/flags/LR.png differ diff --git a/res/flags/LS.png b/res/flags/LS.png new file mode 100644 index 00000000..10cf81b0 Binary files /dev/null and b/res/flags/LS.png differ diff --git a/res/flags/LT.png b/res/flags/LT.png new file mode 100644 index 00000000..17a36c71 Binary files /dev/null and b/res/flags/LT.png differ diff --git a/res/flags/LU.png b/res/flags/LU.png new file mode 100644 index 00000000..675a891d Binary files /dev/null and b/res/flags/LU.png differ diff --git a/res/flags/LV.png b/res/flags/LV.png new file mode 100644 index 00000000..763a6120 Binary files /dev/null and b/res/flags/LV.png differ diff --git a/res/flags/LY.png b/res/flags/LY.png new file mode 100644 index 00000000..5211a902 Binary files /dev/null and b/res/flags/LY.png differ diff --git a/res/flags/MA.png b/res/flags/MA.png new file mode 100644 index 00000000..098db500 Binary files /dev/null and b/res/flags/MA.png differ diff --git a/res/flags/MC.png b/res/flags/MC.png new file mode 100644 index 00000000..8d1a9813 Binary files /dev/null and b/res/flags/MC.png differ diff --git a/res/flags/MD.png b/res/flags/MD.png new file mode 100644 index 00000000..6ca6f734 Binary files /dev/null and b/res/flags/MD.png differ diff --git a/res/flags/ME.png b/res/flags/ME.png new file mode 100644 index 00000000..c7fccac3 Binary files /dev/null and b/res/flags/ME.png differ diff --git a/res/flags/MF.png b/res/flags/MF.png new file mode 100644 index 00000000..7f6824e0 Binary files /dev/null and b/res/flags/MF.png differ diff --git a/res/flags/MG.png b/res/flags/MG.png new file mode 100644 index 00000000..55bc8985 Binary files /dev/null and b/res/flags/MG.png differ diff --git a/res/flags/MH.png b/res/flags/MH.png new file mode 100644 index 00000000..44849779 Binary files /dev/null and b/res/flags/MH.png differ diff --git a/res/flags/MK.png b/res/flags/MK.png new file mode 100644 index 00000000..ef8d2e55 Binary files /dev/null and b/res/flags/MK.png differ diff --git a/res/flags/ML.png b/res/flags/ML.png new file mode 100644 index 00000000..b8c5737f Binary files /dev/null and b/res/flags/ML.png differ diff --git a/res/flags/MM.png b/res/flags/MM.png new file mode 100644 index 00000000..afac4940 Binary files /dev/null and b/res/flags/MM.png differ diff --git a/res/flags/MN.png b/res/flags/MN.png new file mode 100644 index 00000000..6e3de338 Binary files /dev/null and b/res/flags/MN.png differ diff --git a/res/flags/MO.png b/res/flags/MO.png new file mode 100644 index 00000000..02118edf Binary files /dev/null and b/res/flags/MO.png differ diff --git a/res/flags/MP.png b/res/flags/MP.png new file mode 100644 index 00000000..a85be51b Binary files /dev/null and b/res/flags/MP.png differ diff --git a/res/flags/MQ.png b/res/flags/MQ.png new file mode 100644 index 00000000..92eb0727 Binary files /dev/null and b/res/flags/MQ.png differ diff --git a/res/flags/MR.png b/res/flags/MR.png new file mode 100644 index 00000000..95a52726 Binary files /dev/null and b/res/flags/MR.png differ diff --git a/res/flags/MS.png b/res/flags/MS.png new file mode 100644 index 00000000..a811c5bd Binary files /dev/null and b/res/flags/MS.png differ diff --git a/res/flags/MT.png b/res/flags/MT.png new file mode 100644 index 00000000..857672bf Binary files /dev/null and b/res/flags/MT.png differ diff --git a/res/flags/MU.png b/res/flags/MU.png new file mode 100644 index 00000000..8f6abb73 Binary files /dev/null and b/res/flags/MU.png differ diff --git a/res/flags/MV.png b/res/flags/MV.png new file mode 100644 index 00000000..bdb8119f Binary files /dev/null and b/res/flags/MV.png differ diff --git a/res/flags/MW.png b/res/flags/MW.png new file mode 100644 index 00000000..c684776a Binary files /dev/null and b/res/flags/MW.png differ diff --git a/res/flags/MX.png b/res/flags/MX.png new file mode 100644 index 00000000..aee282de Binary files /dev/null and b/res/flags/MX.png differ diff --git a/res/flags/MY.png b/res/flags/MY.png new file mode 100644 index 00000000..3941aa8c Binary files /dev/null and b/res/flags/MY.png differ diff --git a/res/flags/MZ.png b/res/flags/MZ.png new file mode 100644 index 00000000..dd497c23 Binary files /dev/null and b/res/flags/MZ.png differ diff --git a/res/flags/NA.png b/res/flags/NA.png new file mode 100644 index 00000000..68e4aeab Binary files /dev/null and b/res/flags/NA.png differ diff --git a/res/flags/NC.png b/res/flags/NC.png new file mode 100644 index 00000000..ffcc2166 Binary files /dev/null and b/res/flags/NC.png differ diff --git a/res/flags/NE.png b/res/flags/NE.png new file mode 100644 index 00000000..08950d2f Binary files /dev/null and b/res/flags/NE.png differ diff --git a/res/flags/NF.png b/res/flags/NF.png new file mode 100644 index 00000000..2728ed54 Binary files /dev/null and b/res/flags/NF.png differ diff --git a/res/flags/NG.png b/res/flags/NG.png new file mode 100644 index 00000000..5812b2d2 Binary files /dev/null and b/res/flags/NG.png differ diff --git a/res/flags/NI.png b/res/flags/NI.png new file mode 100644 index 00000000..d09e1329 Binary files /dev/null and b/res/flags/NI.png differ diff --git a/res/flags/NL.png b/res/flags/NL.png new file mode 100644 index 00000000..f9203282 Binary files /dev/null and b/res/flags/NL.png differ diff --git a/res/flags/NO.png b/res/flags/NO.png new file mode 100644 index 00000000..0bedee3f Binary files /dev/null and b/res/flags/NO.png differ diff --git a/res/flags/NP.png b/res/flags/NP.png new file mode 100644 index 00000000..e7775c25 Binary files /dev/null and b/res/flags/NP.png differ diff --git a/res/flags/NR.png b/res/flags/NR.png new file mode 100644 index 00000000..4760404b Binary files /dev/null and b/res/flags/NR.png differ diff --git a/res/flags/NU.png b/res/flags/NU.png new file mode 100644 index 00000000..7c130d5b Binary files /dev/null and b/res/flags/NU.png differ diff --git a/res/flags/NZ.png b/res/flags/NZ.png new file mode 100644 index 00000000..67c98728 Binary files /dev/null and b/res/flags/NZ.png differ diff --git a/res/flags/OM.png b/res/flags/OM.png new file mode 100644 index 00000000..a6762503 Binary files /dev/null and b/res/flags/OM.png differ diff --git a/res/flags/PA.png b/res/flags/PA.png new file mode 100644 index 00000000..ed18bdda Binary files /dev/null and b/res/flags/PA.png differ diff --git a/res/flags/PE.png b/res/flags/PE.png new file mode 100644 index 00000000..7485279c Binary files /dev/null and b/res/flags/PE.png differ diff --git a/res/flags/PF.png b/res/flags/PF.png new file mode 100644 index 00000000..6623f413 Binary files /dev/null and b/res/flags/PF.png differ diff --git a/res/flags/PG.png b/res/flags/PG.png new file mode 100644 index 00000000..92504c51 Binary files /dev/null and b/res/flags/PG.png differ diff --git a/res/flags/PH.png b/res/flags/PH.png new file mode 100644 index 00000000..d6d67621 Binary files /dev/null and b/res/flags/PH.png differ diff --git a/res/flags/PK.png b/res/flags/PK.png new file mode 100644 index 00000000..f7c8bb94 Binary files /dev/null and b/res/flags/PK.png differ diff --git a/res/flags/PL.png b/res/flags/PL.png new file mode 100644 index 00000000..8303b1ea Binary files /dev/null and b/res/flags/PL.png differ diff --git a/res/flags/PM.png b/res/flags/PM.png new file mode 100644 index 00000000..2507c86e Binary files /dev/null and b/res/flags/PM.png differ diff --git a/res/flags/PN.png b/res/flags/PN.png new file mode 100644 index 00000000..c5e1d884 Binary files /dev/null and b/res/flags/PN.png differ diff --git a/res/flags/PR.png b/res/flags/PR.png new file mode 100644 index 00000000..938c8350 Binary files /dev/null and b/res/flags/PR.png differ diff --git a/res/flags/PS.png b/res/flags/PS.png new file mode 100644 index 00000000..d106ba89 Binary files /dev/null and b/res/flags/PS.png differ diff --git a/res/flags/PT.png b/res/flags/PT.png new file mode 100644 index 00000000..168f0605 Binary files /dev/null and b/res/flags/PT.png differ diff --git a/res/flags/PW.png b/res/flags/PW.png new file mode 100644 index 00000000..2d6e5d5b Binary files /dev/null and b/res/flags/PW.png differ diff --git a/res/flags/PY.png b/res/flags/PY.png new file mode 100644 index 00000000..9cae9a78 Binary files /dev/null and b/res/flags/PY.png differ diff --git a/res/flags/QA.png b/res/flags/QA.png new file mode 100644 index 00000000..ce9d31ed Binary files /dev/null and b/res/flags/QA.png differ diff --git a/res/flags/RE.png b/res/flags/RE.png new file mode 100644 index 00000000..85c25710 Binary files /dev/null and b/res/flags/RE.png differ diff --git a/res/flags/RO.png b/res/flags/RO.png new file mode 100644 index 00000000..e77996d5 Binary files /dev/null and b/res/flags/RO.png differ diff --git a/res/flags/RS.png b/res/flags/RS.png new file mode 100644 index 00000000..fc7a2ab7 Binary files /dev/null and b/res/flags/RS.png differ diff --git a/res/flags/RU.png b/res/flags/RU.png new file mode 100644 index 00000000..8b3df779 Binary files /dev/null and b/res/flags/RU.png differ diff --git a/res/flags/RW.png b/res/flags/RW.png new file mode 100644 index 00000000..87f71867 Binary files /dev/null and b/res/flags/RW.png differ diff --git a/res/flags/SA.png b/res/flags/SA.png new file mode 100644 index 00000000..d93b91c7 Binary files /dev/null and b/res/flags/SA.png differ diff --git a/res/flags/SB.png b/res/flags/SB.png new file mode 100644 index 00000000..e9a2a8f3 Binary files /dev/null and b/res/flags/SB.png differ diff --git a/res/flags/SC.png b/res/flags/SC.png new file mode 100644 index 00000000..488ac3be Binary files /dev/null and b/res/flags/SC.png differ diff --git a/res/flags/SD.png b/res/flags/SD.png new file mode 100644 index 00000000..6ba8c5ca Binary files /dev/null and b/res/flags/SD.png differ diff --git a/res/flags/SE.png b/res/flags/SE.png new file mode 100644 index 00000000..e7bd806f Binary files /dev/null and b/res/flags/SE.png differ diff --git a/res/flags/SG.png b/res/flags/SG.png new file mode 100644 index 00000000..797069fc Binary files /dev/null and b/res/flags/SG.png differ diff --git a/res/flags/SH.png b/res/flags/SH.png new file mode 100644 index 00000000..b2c589d0 Binary files /dev/null and b/res/flags/SH.png differ diff --git a/res/flags/SI.png b/res/flags/SI.png new file mode 100644 index 00000000..be8e7a89 Binary files /dev/null and b/res/flags/SI.png differ diff --git a/res/flags/SJ.png b/res/flags/SJ.png new file mode 100644 index 00000000..1dd7e786 Binary files /dev/null and b/res/flags/SJ.png differ diff --git a/res/flags/SK.png b/res/flags/SK.png new file mode 100644 index 00000000..be3d10f2 Binary files /dev/null and b/res/flags/SK.png differ diff --git a/res/flags/SL.png b/res/flags/SL.png new file mode 100644 index 00000000..b3f997b1 Binary files /dev/null and b/res/flags/SL.png differ diff --git a/res/flags/SM.png b/res/flags/SM.png new file mode 100644 index 00000000..b30f77ad Binary files /dev/null and b/res/flags/SM.png differ diff --git a/res/flags/SN.png b/res/flags/SN.png new file mode 100644 index 00000000..b5cdb210 Binary files /dev/null and b/res/flags/SN.png differ diff --git a/res/flags/SO.png b/res/flags/SO.png new file mode 100644 index 00000000..5f808508 Binary files /dev/null and b/res/flags/SO.png differ diff --git a/res/flags/SR.png b/res/flags/SR.png new file mode 100644 index 00000000..a2d124e9 Binary files /dev/null and b/res/flags/SR.png differ diff --git a/res/flags/SS.png b/res/flags/SS.png new file mode 100644 index 00000000..19c65899 Binary files /dev/null and b/res/flags/SS.png differ diff --git a/res/flags/ST.png b/res/flags/ST.png new file mode 100644 index 00000000..1d2befe4 Binary files /dev/null and b/res/flags/ST.png differ diff --git a/res/flags/SV.png b/res/flags/SV.png new file mode 100644 index 00000000..fc3a9ca4 Binary files /dev/null and b/res/flags/SV.png differ diff --git a/res/flags/SX.png b/res/flags/SX.png new file mode 100644 index 00000000..6051aaa6 Binary files /dev/null and b/res/flags/SX.png differ diff --git a/res/flags/SY.png b/res/flags/SY.png new file mode 100644 index 00000000..0d51d071 Binary files /dev/null and b/res/flags/SY.png differ diff --git a/res/flags/SZ.png b/res/flags/SZ.png new file mode 100644 index 00000000..a7366cb6 Binary files /dev/null and b/res/flags/SZ.png differ diff --git a/res/flags/TC.png b/res/flags/TC.png new file mode 100644 index 00000000..39971bb9 Binary files /dev/null and b/res/flags/TC.png differ diff --git a/res/flags/TD.png b/res/flags/TD.png new file mode 100644 index 00000000..1fb647d4 Binary files /dev/null and b/res/flags/TD.png differ diff --git a/res/flags/TF.png b/res/flags/TF.png new file mode 100644 index 00000000..41bd9334 Binary files /dev/null and b/res/flags/TF.png differ diff --git a/res/flags/TG.png b/res/flags/TG.png new file mode 100644 index 00000000..560fc098 Binary files /dev/null and b/res/flags/TG.png differ diff --git a/res/flags/TH.png b/res/flags/TH.png new file mode 100644 index 00000000..9ee5ce89 Binary files /dev/null and b/res/flags/TH.png differ diff --git a/res/flags/TJ.png b/res/flags/TJ.png new file mode 100644 index 00000000..ca4be077 Binary files /dev/null and b/res/flags/TJ.png differ diff --git a/res/flags/TK.png b/res/flags/TK.png new file mode 100644 index 00000000..88a7eb1a Binary files /dev/null and b/res/flags/TK.png differ diff --git a/res/flags/TL.png b/res/flags/TL.png new file mode 100644 index 00000000..fa6c365b Binary files /dev/null and b/res/flags/TL.png differ diff --git a/res/flags/TM.png b/res/flags/TM.png new file mode 100644 index 00000000..6cc0539d Binary files /dev/null and b/res/flags/TM.png differ diff --git a/res/flags/TN.png b/res/flags/TN.png new file mode 100644 index 00000000..1cc09ec6 Binary files /dev/null and b/res/flags/TN.png differ diff --git a/res/flags/TO.png b/res/flags/TO.png new file mode 100644 index 00000000..44c42ce0 Binary files /dev/null and b/res/flags/TO.png differ diff --git a/res/flags/TR.png b/res/flags/TR.png new file mode 100644 index 00000000..4e63d61b Binary files /dev/null and b/res/flags/TR.png differ diff --git a/res/flags/TT.png b/res/flags/TT.png new file mode 100644 index 00000000..3831347f Binary files /dev/null and b/res/flags/TT.png differ diff --git a/res/flags/TV.png b/res/flags/TV.png new file mode 100644 index 00000000..2f24fbf7 Binary files /dev/null and b/res/flags/TV.png differ diff --git a/res/flags/TW.png b/res/flags/TW.png new file mode 100644 index 00000000..cda05c9b Binary files /dev/null and b/res/flags/TW.png differ diff --git a/res/flags/TZ.png b/res/flags/TZ.png new file mode 100644 index 00000000..a60d5b3f Binary files /dev/null and b/res/flags/TZ.png differ diff --git a/res/flags/UA.png b/res/flags/UA.png new file mode 100644 index 00000000..f62089b6 Binary files /dev/null and b/res/flags/UA.png differ diff --git a/res/flags/UG.png b/res/flags/UG.png new file mode 100644 index 00000000..8fb590e8 Binary files /dev/null and b/res/flags/UG.png differ diff --git a/res/flags/US.png b/res/flags/US.png new file mode 100644 index 00000000..f6b7ab98 Binary files /dev/null and b/res/flags/US.png differ diff --git a/res/flags/UY.png b/res/flags/UY.png new file mode 100644 index 00000000..11abe8c1 Binary files /dev/null and b/res/flags/UY.png differ diff --git a/res/flags/UZ.png b/res/flags/UZ.png new file mode 100644 index 00000000..5d9168a3 Binary files /dev/null and b/res/flags/UZ.png differ diff --git a/res/flags/VA.png b/res/flags/VA.png new file mode 100644 index 00000000..4e5a92bd Binary files /dev/null and b/res/flags/VA.png differ diff --git a/res/flags/VC.png b/res/flags/VC.png new file mode 100644 index 00000000..4a8dfa41 Binary files /dev/null and b/res/flags/VC.png differ diff --git a/res/flags/VE.png b/res/flags/VE.png new file mode 100644 index 00000000..3632def0 Binary files /dev/null and b/res/flags/VE.png differ diff --git a/res/flags/VG.png b/res/flags/VG.png new file mode 100644 index 00000000..15a5e5fa Binary files /dev/null and b/res/flags/VG.png differ diff --git a/res/flags/VI.png b/res/flags/VI.png new file mode 100644 index 00000000..986a53d2 Binary files /dev/null and b/res/flags/VI.png differ diff --git a/res/flags/VN.png b/res/flags/VN.png new file mode 100644 index 00000000..f19db790 Binary files /dev/null and b/res/flags/VN.png differ diff --git a/res/flags/VU.png b/res/flags/VU.png new file mode 100644 index 00000000..a322030a Binary files /dev/null and b/res/flags/VU.png differ diff --git a/res/flags/WF.png b/res/flags/WF.png new file mode 100644 index 00000000..5f6e2bed Binary files /dev/null and b/res/flags/WF.png differ diff --git a/res/flags/WS.png b/res/flags/WS.png new file mode 100644 index 00000000..de43a373 Binary files /dev/null and b/res/flags/WS.png differ diff --git a/res/flags/YE.png b/res/flags/YE.png new file mode 100644 index 00000000..b132bc13 Binary files /dev/null and b/res/flags/YE.png differ diff --git a/res/flags/YT.png b/res/flags/YT.png new file mode 100644 index 00000000..5c450dfb Binary files /dev/null and b/res/flags/YT.png differ diff --git a/res/flags/ZA.png b/res/flags/ZA.png new file mode 100644 index 00000000..adec062d Binary files /dev/null and b/res/flags/ZA.png differ diff --git a/res/flags/ZM.png b/res/flags/ZM.png new file mode 100644 index 00000000..56287f58 Binary files /dev/null and b/res/flags/ZM.png differ diff --git a/res/flags/ZW.png b/res/flags/ZW.png new file mode 100644 index 00000000..e58dff38 Binary files /dev/null and b/res/flags/ZW.png differ diff --git a/res/manifest.json b/res/manifest.json new file mode 100644 index 00000000..75b18212 --- /dev/null +++ b/res/manifest.json @@ -0,0 +1,56 @@ +{ + "name": "Riot - open team collaboration", + "short_name": "Riot", + "display": "standalone", + "theme_color": "#76CFA6", + "start_url": "index.html", + "icons": [ + { + "src": "vector-icons/android-chrome-36x36.png", + "sizes": "36x36", + "type": "image\/png", + "density": "0.75" + }, + { + "src": "vector-icons/android-chrome-48x48.png", + "sizes": "48x48", + "type": "image\/png", + "density": "1.0" + }, + { + "src": "vector-icons/android-chrome-72x72.png", + "sizes": "72x72", + "type": "image\/png", + "density": "1.5" + }, + { + "src": "vector-icons/android-chrome-96x96.png", + "sizes": "96x96", + "type": "image\/png", + "density": "2.0" + }, + { + "src": "vector-icons/android-chrome-144x144.png", + "sizes": "144x144", + "type": "image\/png", + "density": "3.0" + }, + { + "src": "vector-icons/android-chrome-192x192.png", + "sizes": "192x192", + "type": "image\/png", + "density": "4.0" + } + ], + "related_applications": [ + { + "platform": "play", + "url": "https://play.google.com/store/apps/details?id=im.vector.alpha", + "id": "im.vector.alpha" + }, + { + "platform": "itunes", + "url": "https://itunes.apple.com/gb/app/riot-open-source-team-collaboration-via-matrix/id1083446067" + } + ] +} diff --git a/res/vector-icons/manifest.json b/res/vector-icons/manifest.json deleted file mode 100644 index feab1753..00000000 --- a/res/vector-icons/manifest.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "Riot", - "icons": [ - { - "src": "android-chrome-36x36.png", - "sizes": "36x36", - "type": "image\/png", - "density": "0.75" - }, - { - "src": "android-chrome-48x48.png", - "sizes": "48x48", - "type": "image\/png", - "density": "1.0" - }, - { - "src": "android-chrome-72x72.png", - "sizes": "72x72", - "type": "image\/png", - "density": "1.5" - }, - { - "src": "android-chrome-96x96.png", - "sizes": "96x96", - "type": "image\/png", - "density": "2.0" - }, - { - "src": "android-chrome-144x144.png", - "sizes": "144x144", - "type": "image\/png", - "density": "3.0" - }, - { - "src": "android-chrome-192x192.png", - "sizes": "192x192", - "type": "image\/png", - "density": "4.0" - } - ] -} diff --git a/scripts/babelcheck.js b/scripts/babelcheck.js deleted file mode 100644 index 89f5cac5..00000000 --- a/scripts/babelcheck.js +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env node - -var exec = require('child_process').exec; - -// Makes sure the babel executable in the path is babel 6 (or greater), not -// babel 5, which it is if you upgrade from an older version of react-sdk and -// run 'npm install' since the package has changed to babel-cli, so 'babel' -// remains installed and the executable in node_modules/.bin remains as babel -// 5. - -// This script is duplicated from matrix-react-sdk because it can't reliably -// be pulled in from react-sdk while npm install is failing, as it will do -// if the environment is in the erroneous state this script checks for. - -exec("babel -V", function (error, stdout, stderr) { - if ((error && error.code) || parseInt(stdout.substr(0,1), 10) < 6) { - console.log("\033[31m\033[1m"+ - '*****************************************\n'+ - '* vector-web has moved to babel 6 *\n'+ - '* Please "rm -rf node_modules && npm i" *\n'+ - '* then restore links as appropriate *\n'+ - '*****************************************\n'+ - "\033[91m"); - process.exit(1); - } -}); diff --git a/scripts/copy-res.js b/scripts/copy-res.js index 4702d5cf..8554b146 100755 --- a/scripts/copy-res.js +++ b/scripts/copy-res.js @@ -3,20 +3,47 @@ // copies the resources into the webapp directory. // +// Languages are listed manually so we can choose when to include +// a translation in the app (because having a translation with only +// 3 strings translated is just frustrating) +// This could readily be automated, but it's nice to explicitly +// control when we languages are available. +const INCLUDE_LANGS = [ + //'be' Omitted because no translations in react-sdk + 'en_EN', + 'da', + 'de_DE', + 'fr', + 'be', + 'pt', + 'pt_BR', + 'ru', +]; + // cpx includes globbed parts of the filename in the destination, but excludes // common parents. Hence, "res/{a,b}/**": the output will be "dest/a/..." and // "dest/b/...". const COPY_LIST = [ + ["res/manifest.json", "webapp"], ["res/{media,vector-icons}/**", "webapp"], + ["res/flags/*", "webapp/flags/"], ["src/skins/vector/{fonts,img}/**", "webapp"], ["node_modules/emojione/assets/svg/*", "webapp/emojione/svg/"], ["node_modules/emojione/assets/png/*", "webapp/emojione/png/"], - ["./config.json", "webapp", {directwatch: 1}], + ["./config.json", "webapp", { directwatch: 1 }], ]; +INCLUDE_LANGS.forEach(function(l) { + COPY_LIST.push([ + l, "webapp/i18n/", { lang: 1 }, + ]); +}); + const parseArgs = require('minimist'); const Cpx = require('cpx'); const chokidar = require('chokidar'); +const fs = require('fs'); +const rimraf = require('rimraf'); const argv = parseArgs( process.argv.slice(2), {} @@ -32,6 +59,15 @@ function errCheck(err) { } } +// Check if webapp exists +if (!fs.existsSync('webapp')) { + fs.mkdirSync('webapp'); +} +// Check if i18n exists +if (!fs.existsSync('webapp/i18n/')) { + fs.mkdirSync('webapp/i18n/'); +} + function next(i, err) { errCheck(err); @@ -43,10 +79,13 @@ function next(i, err) { const source = ent[0]; const dest = ent[1]; const opts = ent[2] || {}; + let cpx = undefined; - const cpx = new Cpx.Cpx(source, dest); + if (!opts.lang) { + cpx = new Cpx.Cpx(source, dest); + } - if (verbose) { + if (verbose && cpx) { cpx.on("copy", (event) => { console.log(`Copied: ${event.srcPath} --> ${event.dstPath}`); }); @@ -55,7 +94,7 @@ function next(i, err) { }); } - const cb = (err) => {next(i+1, err)}; + const cb = (err) => { next(i + 1, err) }; if (watch) { if (opts.directwatch) { @@ -63,20 +102,74 @@ function next(i, err) { // which in the case of config.json is '.', which inevitably takes // ages to crawl. So we create our own watcher on the files // instead. - const copy = () => {cpx.copy(errCheck)}; + const copy = () => { cpx.copy(errCheck) }; chokidar.watch(source) .on('add', copy) .on('change', copy) .on('ready', cb) .on('error', errCheck); + } else if (opts.lang) { + const reactSdkFile = 'node_modules/matrix-react-sdk/src/i18n/strings/' + source + '.json'; + const riotWebFile = 'src/i18n/strings/' + source + '.json'; + + const translations = {}; + const makeLang = () => { genLangFile(source, dest) }; + [reactSdkFile, riotWebFile].forEach(function(f) { + chokidar.watch(f) + .on('add', makeLang) + .on('change', makeLang) + //.on('ready', cb) We'd have to do this when both files are ready + .on('error', errCheck); + }); + next(i + 1, err); } else { cpx.on('watch-ready', cb); cpx.on("watch-error", cb); cpx.watch(); } + } else if (opts.lang) { + genLangFile(source, dest); + next(i + 1, err); } else { cpx.copy(cb); } } +function genLangFile(lang, dest) { + const reactSdkFile = 'node_modules/matrix-react-sdk/src/i18n/strings/' + lang + '.json'; + const riotWebFile = 'src/i18n/strings/' + lang + '.json'; + + const translations = {}; + [reactSdkFile, riotWebFile].forEach(function(f) { + if (fs.existsSync(f)) { + Object.assign( + translations, + JSON.parse(fs.readFileSync(f).toString()) + ); + } + }); + fs.writeFileSync(dest + lang + '.json', JSON.stringify(translations, null, 4)); + if (verbose) { + console.log("Generated language file: " + lang); + } +} + +function genLangList() { + const languages = {}; + INCLUDE_LANGS.forEach(function(lang) { + const normalizedLanguage = lang.toLowerCase().replace("_", "-"); + const languageParts = normalizedLanguage.split('-'); + if (languageParts.length == 2 && languageParts[0] == languageParts[1]) { + languages[languageParts[0]] = lang + '.json'; + } else { + languages[normalizedLanguage] = lang + '.json'; + } + }); + fs.writeFile('webapp/i18n/languages.json', JSON.stringify(languages, null, 4)); + if (verbose) { + console.log("Generated language list"); + } +} + +genLangList(); next(0); diff --git a/scripts/electron-package.sh b/scripts/electron-package.sh index 87e353f7..973ea45e 100755 --- a/scripts/electron-package.sh +++ b/scripts/electron-package.sh @@ -63,7 +63,7 @@ fi if [ ! -f package.json ]; then echo "No package.json found. This script must be run from" - echo "the vector-web directory." + echo "the riot-web directory." exit fi @@ -90,8 +90,8 @@ npm run build:electron popd -distdir="$builddir/electron/dist" -pubdir="$projdir/electron/pub" +distdir="$builddir/electron_app/dist" +pubdir="$projdir/electron_app/pub" rm -r "$pubdir" || true mkdir -p "$pubdir" @@ -120,11 +120,11 @@ cp $distdir/win/*.nupkg "$pubdir/update/win32/x64/" cp $distdir/win/RELEASES "$pubdir/update/win32/x64/" # Move the debs to the main project dir's dist folder -rm -r "$projdir/electron/dist" || true -mkdir -p "$projdir/electron/dist" -cp $distdir/*.deb "$projdir/electron/dist/" +rm -r "$projdir/electron_app/dist" || true +mkdir -p "$projdir/electron_app/dist" +cp $distdir/*.deb "$projdir/electron_app/dist/" rm -rf "$builddir" echo "Riot Desktop is ready to go in $pubdir: this directory can be hosted on your web server." -echo "deb archives are in electron/dist/ - these should be added into your debian repository" +echo "deb archives are in electron_app/dist/ - these should be added into your debian repository" diff --git a/scripts/fetch-develop.deps.sh b/scripts/fetch-develop.deps.sh new file mode 100755 index 00000000..bbbc8341 --- /dev/null +++ b/scripts/fetch-develop.deps.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +# Fetches the js-sdk and matrix-react-sdk dependencies for development +# or testing purposes +# If there exists a branch of that dependency with the same name as +# the branch the current checkout is on, use that branch. Otherwise, +# use develop. + +# Look in the many different CI env vars for which branch we're +# building +if [[ "$TRAVIS" == true ]]; then + curbranch="${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}" +else + # ghprbSourceBranch for jenkins github pull request builder + # GIT_BRANCH for other jenkins builds + curbranch="${ghprbSourceBranch:-$GIT_BRANCH}" + # Otherwise look at the actual branch we're on + if [ -z "$curbranch" ] + then + curbranch=`git rev-parse --abbrev-ref HEAD` + fi +fi + +echo "Determined branch to be $curbranch" + +function dodep() { + org=$1 + repo=$2 + rm -rf $repo || true + git clone https://github.com/$org/$repo.git $repo + pushd $repo + git checkout $curbranch || git checkout develop + echo "$repo set to branch "`git rev-parse --abbrev-ref HEAD` + popd +} + +dodep matrix-org matrix-js-sdk +dodep matrix-org matrix-react-sdk + +mkdir -p node_modules +cd node_modules + +rm -r matrix-js-sdk 2> /dev/null +ln -s ../matrix-js-sdk ./ +pushd matrix-js-sdk +npm install +popd + +rm -r matrix-react-sdk 2> /dev/null +ln -s ../matrix-react-sdk ./ +pushd matrix-react-sdk +mkdir -p node_modules +cd node_modules +ln -s ../../matrix-js-sdk matrix-js-sdk +cd .. +npm install +popd +# Link the reskindex binary in place: if we used npm link, +# npm would do this for us, but we don't because we'd have +# to define the npm prefix somewhere so it could put the +# intermediate symlinks there. Instead, we do it ourselves. +mkdir -p .bin +ln -sf ../matrix-react-sdk/scripts/reskindex.js .bin/reskindex diff --git a/scripts/genflags.sh b/scripts/genflags.sh new file mode 100755 index 00000000..826a0299 --- /dev/null +++ b/scripts/genflags.sh @@ -0,0 +1,66 @@ +# Copyright 2017 Vector Creations 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. + +# genflags.sh - Generates pngs for use with CountryDropdown.js +# +# Dependencies: +# - imagemagick --with-rsvg (because default imagemagick SVG +# renderer does not produce accurate results) +# +# This will clone the googlei18n flag repo before converting +# all phonenumber.js-supported country flags (as SVGs) into +# PNGs that can be used by CountryDropdown.js. + +# Allow CTRL+C to terminate the script +trap "echo Exited!; exit;" SIGINT SIGTERM + +# git clone the google repo to get flag SVGs +git clone git@github.com:googlei18n/region-flags +for f in region-flags/svg/*.svg; do + # Skip state flags + if [[ $f =~ [A-Z]{2}-[A-Z]{2,3}.svg ]] ; then + echo "Skipping state flag "$f + continue + fi + + # Skip countries not included in phonenumber.js + if [[ $f =~ (AC|CP|DG|EA|EU|IC|TA|UM|UN|XK).svg ]] ; then + echo "Skipping non-phonenumber supported flag "$f + continue + fi + + # Run imagemagick convert + # -background none : transparent background + # -thumbnail 25x15 : resize the flag to have a height of 15. + # By default, aspect ratio is respected so the width will + # be correct and not necessarily 25px. + # -gravity Center : keep the image central when adding an -extent + # -border 1 : add a 1px border around the flag + # -bordercolor : set the border colour + # -extent 27x27 : surround the image with padding so that it + # has the dimensions 27x27. + convert $f -background none -thumbnail 25x15 \ + -gravity Center -border 1 -bordercolor \#e0e0e0 \ + -extent 27x27 $f.png + + # $f.png will be region-flags/svg/XX.svg.png at this point + + # Extract filename from path $f + newname=${f##*/} + # Replace .svg with .png + newname=${newname%.svg}.png + # Move the file to flags directory + mv $f.png res/flags/$newname + echo "Generated res/flags/"$newname +done diff --git a/scripts/issues-burndown.pl b/scripts/issues-burndown.pl old mode 100644 new mode 100755 index 7d0f3409..03af5ed7 --- a/scripts/issues-burndown.pl +++ b/scripts/issues-burndown.pl @@ -4,16 +4,24 @@ use warnings; use strict; use Net::GitHub; -use DateTime; -use DateTime::Format::ISO8601; +use Time::Moment; +use Term::ReadPassword; + +# This version of the script emits the cumulative number of bugs, split into open & closed +# suitable for drawing the 'top' and 'bottom' of a burndown graph. +# +# N.B. this doesn't take into account issues changing priority over time, but only their most recent priority. +# +# If you want instead the number of open issues on a given day, then look at issues-no-state.pl my $gh = Net::GitHub->new( - login => 'ara4n', pass => 'secret' + login => 'ara4n', pass => read_password("github password: "), ); -$gh->set_default_user_repo('vector-im', 'vector-web'); +$gh->set_default_user_repo('vector-im', 'riot-web'); -my @issues = $gh->issue->repos_issues({ state => 'all', milestone => 3 }); +#my @issues = $gh->issue->repos_issues({ state => 'all', milestone => 3 }); +my @issues = $gh->issue->repos_issues({ state => 'all' }); while ($gh->issue->has_next_page) { push @issues, $gh->issue->next_page; } @@ -30,11 +38,11 @@ while ($gh->issue->has_next_page) { my $days = {}; my $schema = {}; -my $now = DateTime->now(); +my $now = Time::Moment->now; foreach my $issue (@issues) { next if ($issue->{pull_request}); - + # use Data::Dumper; # print STDERR Dumper($issue); @@ -56,10 +64,10 @@ foreach my $issue (@issues) { my $priority = &$extract_labels(qw(p1 p2 p3 p4 p5)) || "unprioritised"; my $severity = &$extract_labels(qw(minor major critical cosmetic network)) || "no-severity"; - my $start = DateTime::Format::ISO8601->parse_datetime($issue->{created_at}); + my $start = Time::Moment->from_string($issue->{created_at}); do { - my $ymd = $start->ymd(); + my $ymd = $start->strftime('%F'); $days->{ $ymd }->{ 'created' }->{ $type }->{ $priority }->{ $severity }->{ total }++; $schema->{ 'created' }->{ $type }->{ $priority }->{ $severity }->{ total }++; @@ -68,13 +76,14 @@ foreach my $issue (@issues) { $schema->{ 'created' }->{ $type }->{ $priority }->{ $severity }->{ $_ }++; } - $start = $start->add(days => 1); - } while (DateTime->compare($start, $now) < 0); + $start = $start->plus_days(1); + # print STDERR "^"; + } while ($start->compare($now) < 0); if ($state eq 'closed') { - my $end = DateTime::Format::ISO8601->parse_datetime($issue->{closed_at}); + my $end = Time::Moment->from_string($issue->{closed_at}); do { - my $ymd = $end->ymd(); + my $ymd = $end->strftime('%F'); $days->{ $ymd }->{ 'resolved' }->{ $type }->{ $priority }->{ $severity }->{ total }++; $schema->{ 'resolved' }->{ $type }->{ $priority }->{ $severity }->{ total }++; @@ -83,9 +92,12 @@ foreach my $issue (@issues) { $schema->{ 'resolved' }->{ $type }->{ $priority }->{ $severity }->{ $_ }++; } - $end = $end->add(days => 1); - } while (DateTime->compare($end, $now) < 0); + $end = $end->plus_days(1); + } while ($end->compare($now) < 0); + # print STDERR "v"; } + + # print STDERR "\n"; } print "day,"; diff --git a/scripts/issues-no-state.pl b/scripts/issues-no-state.pl index da12fb22..748809c5 100755 --- a/scripts/issues-no-state.pl +++ b/scripts/issues-no-state.pl @@ -6,14 +6,22 @@ use strict; use Net::GitHub; use DateTime; use DateTime::Format::ISO8601; +use Term::ReadPassword; + +# This version of the script emits the total number of bugs open on a given day, +# split by various tags. +# +# If you want instead the cumulative number of open & closed issues on a given day, +# then look at issues-burndown.pl my $gh = Net::GitHub->new( - login => 'ara4n', pass => 'secret' + login => 'ara4n', pass => read_password("github password: "), ); -$gh->set_default_user_repo('vector-im', 'vector-web'); +$gh->set_default_user_repo('vector-im', 'riot-web'); -my @issues = $gh->issue->repos_issues({ state => 'all', milestone => 3 }); +#my @issues = $gh->issue->repos_issues({ state => 'all', milestone => 3 }); +my @issues = $gh->issue->repos_issues({ state => 'all' }); while ($gh->issue->has_next_page) { push @issues, $gh->issue->next_page; } @@ -34,7 +42,7 @@ my $now = DateTime->now(); foreach my $issue (@issues) { next if ($issue->{pull_request}); - + use Data::Dumper; print STDERR Dumper($issue); diff --git a/scripts/jenkins.sh b/scripts/jenkins.sh index 0d441cdd..4f2e9405 100755 --- a/scripts/jenkins.sh +++ b/scripts/jenkins.sh @@ -8,10 +8,13 @@ nvm use 6 set -x +# check out corresponding branches of dependencies +`dirname $0`/fetch-develop.deps.sh + npm install # apparently npm 3.10.3 on node 6.4.0 doesn't upgrade #develop target with npm install unless explicitly asked. -npm install matrix-react-sdk matrix-js-sdk olm +npm install olm # install olm. A naive 'npm i ./olm/olm-*.tgz' fails because it uses the url # from our package.json (or even matrix-js-sdk's) in preference. @@ -23,24 +26,17 @@ npm install matrix-react-sdk matrix-js-sdk olm #rm -r node_modules/olm #cp -r olm/package node_modules/olm - -# we may be using dev branches of js-sdk and react-sdk, in which case we need to build them -(cd node_modules/matrix-js-sdk && npm install) -(cd node_modules/matrix-react-sdk && npm install) - # run the mocha tests npm run test # run eslint npm run lintall -- -f checkstyle -o eslint.xml || true -rm dist/vector-*.tar.gz || true # rm previous artifacts without failing if it doesn't exist +rm dist/riot-*.tar.gz || true # rm previous artifacts without failing if it doesn't exist - # node_modules deps from 'npm install' don't have a .git dir so can't - # rev-parse; but they do set the commit in package.json under 'gitHead' which - # we're grabbing here. -REACT_SHA=$(grep 'gitHead' node_modules/matrix-react-sdk/package.json | cut -d \" -f 4 | head -c 12) -JSSDK_SHA=$(grep 'gitHead' node_modules/matrix-js-sdk/package.json | cut -d \" -f 4 | head -c 12) +# Since the deps are fetched from git, we can rev-parse +REACT_SHA=$(cd node_modules/matrix-react-sdk; git rev-parse --short=12 HEAD) +JSSDK_SHA=$(cd node_modules/matrix-js-sdk; git rev-parse --short=12 HEAD) VECTOR_SHA=$(git rev-parse --short=12 HEAD) # use the ACTUAL SHA rather than assume develop diff --git a/scripts/make-icons.sh b/scripts/make-icons.sh index c77064ab..19e48895 100755 --- a/scripts/make-icons.sh +++ b/scripts/make-icons.sh @@ -52,7 +52,7 @@ cp "$tmpdir/256.png" "$tmpdir/Riot.iconset/icon_256x256.png" cp "$tmpdir/512.png" "$tmpdir/Riot.iconset/icon_256x256@2x.png" cp "$tmpdir/512.png" "$tmpdir/Riot.iconset/icon_512x512.png" cp "$tmpdir/1024.png" "$tmpdir/Riot.iconset/icon_512x512@2x.png" -iconutil -c icns -o electron/build/icon.icns "$tmpdir/Riot.iconset" +iconutil -c icns -o electron_app/build/icon.icns "$tmpdir/Riot.iconset" cp "$tmpdir/36.png" "res/vector-icons/android-chrome-36x36.png" cp "$tmpdir/48.png" "res/vector-icons/android-chrome-48x48.png" @@ -79,15 +79,17 @@ cp "$tmpdir/144.png" "res/vector-icons/mstile-144x144.png" cp "$tmpdir/150.png" "res/vector-icons/mstile-150x150.png" cp "$tmpdir/310.png" "res/vector-icons/mstile-310x310.png" cp "$tmpdir/310x150.png" "res/vector-icons/mstile-310x150.png" +cp "$tmpdir/180.png" "electron_app/img/riot.png" convert "$tmpdir/16.png" "$tmpdir/32.png" "$tmpdir/64.png" "$tmpdir/128.png" "$tmpdir/256.png" "res/vector-icons/favicon.ico" -cp "res/vector-icons/favicon.ico" "electron/build/icon.ico" +cp "res/vector-icons/favicon.ico" "electron_app/build/icon.ico" +cp "res/vector-icons/favicon.ico" "electron_app/img/riot.ico" # https://github.com/electron-userland/electron-builder/blob/3f97b86993d4ea5172e562b182230a194de0f621/src/targets/LinuxTargetHelper.ts#L127 for i in 24 96 16 48 64 128 256 512 do - cp "$tmpdir/$i.png" "electron/build/icons/${i}x${i}.png" + cp "$tmpdir/$i.png" "electron_app/build/icons/${i}x${i}.png" done rm -r "$tmpdir" diff --git a/scripts/package.sh b/scripts/package.sh index 5c1fdd5e..23d0925b 100755 --- a/scripts/package.sh +++ b/scripts/package.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -e @@ -21,10 +21,17 @@ npm run build$dev cp config.sample.json webapp/ mkdir -p dist -cp -r webapp vector-$version -echo $version > vector-$version/version -tar chvzf dist/vector-$version.tar.gz vector-$version -rm -r vector-$version +cp -r webapp riot-$version + +# if $version looks like semver with leading v, strip it before writing to file +if [[ ${version} =~ ^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+(-.+)?$ ]]; then + echo ${version:1} > riot-$version/version +else + echo ${version} > riot-$version/version +fi + +tar chvzf dist/riot-$version.tar.gz riot-$version +rm -r riot-$version echo -echo "Packaged dist/vector-$version.tar.gz" +echo "Packaged dist/riot-$version.tar.gz" diff --git a/src/component-index.js b/src/component-index.js deleted file mode 100644 index 4bf0b0f9..00000000 --- a/src/component-index.js +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2015, 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. -*/ - -/* - * THIS FILE IS AUTO-GENERATED - * You can edit it you like, but your changes will be overwritten, - * so you'd just be trying to swim upstream like a salmon. - * You are not a salmon. - * - * To update it, run: - * ./reskindex.js -h header - */ - -module.exports.components = require('matrix-react-sdk/lib/component-index').components; - -import structures$BottomLeftMenu from './components/structures/BottomLeftMenu'; -structures$BottomLeftMenu && (module.exports.components['structures.BottomLeftMenu'] = structures$BottomLeftMenu); -import structures$CompatibilityPage from './components/structures/CompatibilityPage'; -structures$CompatibilityPage && (module.exports.components['structures.CompatibilityPage'] = structures$CompatibilityPage); -import structures$HomePage from './components/structures/HomePage'; -structures$HomePage && (module.exports.components['structures.HomePage'] = structures$HomePage); -import structures$LeftPanel from './components/structures/LeftPanel'; -structures$LeftPanel && (module.exports.components['structures.LeftPanel'] = structures$LeftPanel); -import structures$RightPanel from './components/structures/RightPanel'; -structures$RightPanel && (module.exports.components['structures.RightPanel'] = structures$RightPanel); -import structures$RoomDirectory from './components/structures/RoomDirectory'; -structures$RoomDirectory && (module.exports.components['structures.RoomDirectory'] = structures$RoomDirectory); -import structures$RoomSubList from './components/structures/RoomSubList'; -structures$RoomSubList && (module.exports.components['structures.RoomSubList'] = structures$RoomSubList); -import structures$RoomSubListHeader from './components/structures/RoomSubListHeader'; -structures$RoomSubListHeader && (module.exports.components['structures.RoomSubListHeader'] = structures$RoomSubListHeader); -import structures$SearchBox from './components/structures/SearchBox'; -structures$SearchBox && (module.exports.components['structures.SearchBox'] = structures$SearchBox); -import structures$ViewSource from './components/structures/ViewSource'; -structures$ViewSource && (module.exports.components['structures.ViewSource'] = structures$ViewSource); -import views$context_menus$MessageContextMenu from './components/views/context_menus/MessageContextMenu'; -views$context_menus$MessageContextMenu && (module.exports.components['views.context_menus.MessageContextMenu'] = views$context_menus$MessageContextMenu); -import views$context_menus$RoomTileContextMenu from './components/views/context_menus/RoomTileContextMenu'; -views$context_menus$RoomTileContextMenu && (module.exports.components['views.context_menus.RoomTileContextMenu'] = views$context_menus$RoomTileContextMenu); -import views$dialogs$BugReportDialog from './components/views/dialogs/BugReportDialog'; -views$dialogs$BugReportDialog && (module.exports.components['views.dialogs.BugReportDialog'] = views$dialogs$BugReportDialog); -import views$dialogs$ChangelogDialog from './components/views/dialogs/ChangelogDialog'; -views$dialogs$ChangelogDialog && (module.exports.components['views.dialogs.ChangelogDialog'] = views$dialogs$ChangelogDialog); -import views$directory$NetworkDropdown from './components/views/directory/NetworkDropdown'; -views$directory$NetworkDropdown && (module.exports.components['views.directory.NetworkDropdown'] = views$directory$NetworkDropdown); -import views$elements$ImageView from './components/views/elements/ImageView'; -views$elements$ImageView && (module.exports.components['views.elements.ImageView'] = views$elements$ImageView); -import views$elements$Spinner from './components/views/elements/Spinner'; -views$elements$Spinner && (module.exports.components['views.elements.Spinner'] = views$elements$Spinner); -import views$globals$GuestWarningBar from './components/views/globals/GuestWarningBar'; -views$globals$GuestWarningBar && (module.exports.components['views.globals.GuestWarningBar'] = views$globals$GuestWarningBar); -import views$globals$MatrixToolbar from './components/views/globals/MatrixToolbar'; -views$globals$MatrixToolbar && (module.exports.components['views.globals.MatrixToolbar'] = views$globals$MatrixToolbar); -import views$globals$NewVersionBar from './components/views/globals/NewVersionBar'; -views$globals$NewVersionBar && (module.exports.components['views.globals.NewVersionBar'] = views$globals$NewVersionBar); -import views$login$VectorCustomServerDialog from './components/views/login/VectorCustomServerDialog'; -views$login$VectorCustomServerDialog && (module.exports.components['views.login.VectorCustomServerDialog'] = views$login$VectorCustomServerDialog); -import views$login$VectorLoginFooter from './components/views/login/VectorLoginFooter'; -views$login$VectorLoginFooter && (module.exports.components['views.login.VectorLoginFooter'] = views$login$VectorLoginFooter); -import views$login$VectorLoginHeader from './components/views/login/VectorLoginHeader'; -views$login$VectorLoginHeader && (module.exports.components['views.login.VectorLoginHeader'] = views$login$VectorLoginHeader); -import views$messages$DateSeparator from './components/views/messages/DateSeparator'; -views$messages$DateSeparator && (module.exports.components['views.messages.DateSeparator'] = views$messages$DateSeparator); -import views$messages$MessageTimestamp from './components/views/messages/MessageTimestamp'; -views$messages$MessageTimestamp && (module.exports.components['views.messages.MessageTimestamp'] = views$messages$MessageTimestamp); -import views$rooms$DNDRoomTile from './components/views/rooms/DNDRoomTile'; -views$rooms$DNDRoomTile && (module.exports.components['views.rooms.DNDRoomTile'] = views$rooms$DNDRoomTile); -import views$rooms$RoomDropTarget from './components/views/rooms/RoomDropTarget'; -views$rooms$RoomDropTarget && (module.exports.components['views.rooms.RoomDropTarget'] = views$rooms$RoomDropTarget); -import views$rooms$RoomTooltip from './components/views/rooms/RoomTooltip'; -views$rooms$RoomTooltip && (module.exports.components['views.rooms.RoomTooltip'] = views$rooms$RoomTooltip); -import views$rooms$SearchBar from './components/views/rooms/SearchBar'; -views$rooms$SearchBar && (module.exports.components['views.rooms.SearchBar'] = views$rooms$SearchBar); -import views$settings$IntegrationsManager from './components/views/settings/IntegrationsManager'; -views$settings$IntegrationsManager && (module.exports.components['views.settings.IntegrationsManager'] = views$settings$IntegrationsManager); -import views$settings$Notifications from './components/views/settings/Notifications'; -views$settings$Notifications && (module.exports.components['views.settings.Notifications'] = views$settings$Notifications); diff --git a/src/components/structures/BottomLeftMenu.js b/src/components/structures/BottomLeftMenu.js index f378cac6..c8c7ba2c 100644 --- a/src/components/structures/BottomLeftMenu.js +++ b/src/components/structures/BottomLeftMenu.js @@ -18,7 +18,8 @@ limitations under the License. var React = require('react'); var ReactDOM = require('react-dom'); -var sdk = require('matrix-react-sdk') +var sdk = require('matrix-react-sdk'); +import { _t } from 'matrix-react-sdk/lib/languageHandler'; var dis = require('matrix-react-sdk/lib/dispatcher'); var AccessibleButton = require('matrix-react-sdk/lib/components/views/elements/AccessibleButton'); @@ -120,7 +121,7 @@ module.exports = React.createClass({ homeButton = ( - { this.getLabel("Welcome page", this.state.homeHover) } + { this.getLabel(_t("Welcome page"), this.state.homeHover) } ); } @@ -131,19 +132,19 @@ module.exports = React.createClass({ { homeButton } - { this.getLabel("Start chat", this.state.peopleHover) } + { this.getLabel(_t("Start chat"), this.state.peopleHover) } - { this.getLabel("Room directory", this.state.directoryHover) } + { this.getLabel(_t("Room directory"), this.state.directoryHover) } - { this.getLabel("Create new room", this.state.roomsHover) } + { this.getLabel(_t("Create new room"), this.state.roomsHover) } - { this.getLabel("Settings", this.state.settingsHover) } + { this.getLabel(_t("Settings"), this.state.settingsHover) } diff --git a/src/components/structures/LeftPanel.js b/src/components/structures/LeftPanel.js index 2d97313a..a9df37a8 100644 --- a/src/components/structures/LeftPanel.js +++ b/src/components/structures/LeftPanel.js @@ -19,11 +19,9 @@ limitations under the License. var React = require('react'); var DragDropContext = require('react-dnd').DragDropContext; var HTML5Backend = require('react-dnd-html5-backend'); -var KeyCode = require('matrix-react-sdk/lib/KeyCode'); var sdk = require('matrix-react-sdk') var dis = require('matrix-react-sdk/lib/dispatcher'); - var VectorConferenceHandler = require('../../VectorConferenceHandler'); var CallHandler = require("matrix-react-sdk/lib/CallHandler"); @@ -42,10 +40,6 @@ var LeftPanel = React.createClass({ }; }, - componentWillMount: function() { - this.focusedElement = null; - }, - componentDidMount: function() { this.dispatcherRef = dis.register(this.onAction); }, @@ -68,91 +62,6 @@ var LeftPanel = React.createClass({ } }, - _onFocus: function(ev) { - this.focusedElement = ev.target; - }, - - _onBlur: function(ev) { - this.focusedElement = null; - }, - - _onKeyDown: function(ev) { - if (!this.focusedElement) return; - let handled = false; - - switch (ev.keyCode) { - case KeyCode.UP: - this._onMoveFocus(true); - handled = true; - break; - case KeyCode.DOWN: - this._onMoveFocus(false); - handled = true; - break; - } - - if (handled) { - ev.stopPropagation(); - ev.preventDefault(); - } - }, - - _onMoveFocus: function(up) { - var element = this.focusedElement; - - // unclear why this isn't needed - // var descending = (up == this.focusDirection) ? this.focusDescending : !this.focusDescending; - // this.focusDirection = up; - - var descending = false; // are we currently descending or ascending through the DOM tree? - var classes; - - do { - var child = up ? element.lastElementChild : element.firstElementChild; - var sibling = up ? element.previousElementSibling : element.nextElementSibling; - - if (descending) { - if (child) { - element = child; - } - else if (sibling) { - element = sibling; - } - else { - descending = false; - element = element.parentElement; - } - } - else { - if (sibling) { - element = sibling; - descending = true; - } - else { - element = element.parentElement; - } - } - - if (element) { - classes = element.classList; - if (classes.contains("mx_LeftPanel")) { // we hit the top - element = up ? element.lastElementChild : element.firstElementChild; - descending = true; - } - } - - } while(element && !( - classes.contains("mx_RoomTile") || - classes.contains("mx_SearchBox_search") || - classes.contains("mx_RoomSubList_ellipsis"))); - - if (element) { - element.focus(); - this.focusedElement = element; - this.focusedDescending = descending; - } - }, - _recheckCallElement: function(selectedRoomId) { // if we aren't viewing a room with an ongoing call, but there is an // active call, show the call element - we need to do this to make @@ -211,8 +120,7 @@ var LeftPanel = React.createClass({ } return ( -