diff --git a/.gitignore b/.gitignore index c28df64c..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,3 +14,6 @@ npm-debug.log electron/dist electron/pub +/.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..e020ba7d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,22 @@ language: node_js node_js: - - 6 # node v6, to match jenkins + # make sure we work with a range of node versions. + # As of the time of writing: + # - 4.x is still in LTS (until April 2018), but some of our deps (notably + # extract-zip) don't work with it + # - 5.x has been EOLed for nearly a year. + # - 6.x is the current 'LTS' version + # - 7.x is the current 'current' version (until October 2017) + # + # see: https://github.com/nodejs/LTS/ + # + # anything before 6.3 ships with npm 3.9 or earlier, which had problems + # with symlinks in node_modules (see + # https://github.com/npm/npm/releases/tag/v3.10.0 'FIXES AND REFACTORING'). + - 6.3 + - 6 + - 7 install: - - npm install - - (cd node_modules/matrix-js-sdk && npm install) - - (cd node_modules/matrix-react-sdk && npm install) + # clone the deps with depth 1: we know we will only ever need that one + # commit. + - scripts/fetch-develop.deps.sh --depth 1 && npm install diff --git a/CHANGELOG.md b/CHANGELOG.md index ea63ee66..28b978c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,358 @@ +Changes in [0.11.0](https://github.com/vector-im/riot-web/releases/tag/v0.11.0) (2017-06-12) +============================================================================================ +[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.11.0-rc.2...v0.11.0) + + * More translations & minor fixes + +Changes in [0.11.0-rc.2](https://github.com/vector-im/riot-web/releases/tag/v0.11.0-rc.2) (2017-06-09) +====================================================================================================== +[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.11.0-rc.1...v0.11.0-rc.2) + + * Update to matrix-react-sdk rc.2 which fixes the flux + dependency version and an issue with the conference + call bar translation. + + +Changes in [0.11.0-rc.1](https://github.com/vector-im/riot-web/releases/tag/v0.11.0-rc.1) (2017-06-09) +====================================================================================================== +[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.10.2...v0.11.0-rc.1) + + * Update from Weblate. + [\#4258](https://github.com/vector-im/riot-web/pull/4258) + * Update from Weblate. + [\#4254](https://github.com/vector-im/riot-web/pull/4254) + * Update from Weblate. + [\#4253](https://github.com/vector-im/riot-web/pull/4253) + * Expect to see HTTP /join/#some:alias when we the view knows it + [\#4252](https://github.com/vector-im/riot-web/pull/4252) + * Update from Weblate. + [\#4250](https://github.com/vector-im/riot-web/pull/4250) + * add explicit import to utf8 polyfill and rip out unused imports + [\#4169](https://github.com/vector-im/riot-web/pull/4169) + * Added styling for copy to clipboard button + [\#4204](https://github.com/vector-im/riot-web/pull/4204) + * Update from Weblate. + [\#4231](https://github.com/vector-im/riot-web/pull/4231) + * Update from Weblate. + [\#4218](https://github.com/vector-im/riot-web/pull/4218) + * Update CSS for ChatInviteDialog + [\#4226](https://github.com/vector-im/riot-web/pull/4226) + * change electron -> electron_app which was previously missed + [\#4212](https://github.com/vector-im/riot-web/pull/4212) + * New guest access + [\#4039](https://github.com/vector-im/riot-web/pull/4039) + * Align message timestamp centrally about the avatar mid-point + [\#4219](https://github.com/vector-im/riot-web/pull/4219) + * Remove '/' from homepage URL + [\#4221](https://github.com/vector-im/riot-web/pull/4221) + * Chop off 'origin/' + [\#4220](https://github.com/vector-im/riot-web/pull/4220) + * Update from Weblate. + [\#4214](https://github.com/vector-im/riot-web/pull/4214) + * adjust alignment of message menu button in compact layout + [\#4211](https://github.com/vector-im/riot-web/pull/4211) + * Update from Weblate. + [\#4207](https://github.com/vector-im/riot-web/pull/4207) + * Fix Tests in ILAG + [\#4209](https://github.com/vector-im/riot-web/pull/4209) + * Update from Weblate. + [\#4197](https://github.com/vector-im/riot-web/pull/4197) + * Fix tests for new-guest-access + [\#4201](https://github.com/vector-im/riot-web/pull/4201) + * i18n for SetPasswordDialog + [\#4198](https://github.com/vector-im/riot-web/pull/4198) + * Update from Weblate. + [\#4193](https://github.com/vector-im/riot-web/pull/4193) + * to make the windows volume mixer not explode as it can't resize icons. + [\#4183](https://github.com/vector-im/riot-web/pull/4183) + * provide react devtools in electron dev runs + [\#4186](https://github.com/vector-im/riot-web/pull/4186) + * Fix DeprecationWarning + [\#4184](https://github.com/vector-im/riot-web/pull/4184) + * room link should be a matrix.to one + [\#4178](https://github.com/vector-im/riot-web/pull/4178) + * Update home.html + [\#4163](https://github.com/vector-im/riot-web/pull/4163) + * Add missing translation for room directory + [\#4160](https://github.com/vector-im/riot-web/pull/4160) + * i18n welcome + [\#4129](https://github.com/vector-im/riot-web/pull/4129) + * Tom welcome page + [\#4038](https://github.com/vector-im/riot-web/pull/4038) + * Fix some tests that expect Directory (they should expect HomePage) + [\#4076](https://github.com/vector-im/riot-web/pull/4076) + * Add "Login" button to RHS when user is a guest + [\#4037](https://github.com/vector-im/riot-web/pull/4037) + * Rejig the PaswordNagBar + [\#4026](https://github.com/vector-im/riot-web/pull/4026) + * Allow team server config to be missing + [\#4024](https://github.com/vector-im/riot-web/pull/4024) + * Remove GuestWarningBar + [\#4020](https://github.com/vector-im/riot-web/pull/4020) + * Make left panel better for new users (mk III) + [\#4023](https://github.com/vector-im/riot-web/pull/4023) + * Implement default welcome page and allow custom URL /w config + [\#4015](https://github.com/vector-im/riot-web/pull/4015) + * Add warm-fuzzy for successful password entry + [\#3989](https://github.com/vector-im/riot-web/pull/3989) + * autoFocus new password input in SetPasswordDialog + [\#3982](https://github.com/vector-im/riot-web/pull/3982) + * Implement dialog to set password + [\#3921](https://github.com/vector-im/riot-web/pull/3921) + * Replace NeedToRegister with SetMxId dialog + [\#3924](https://github.com/vector-im/riot-web/pull/3924) + * Add welcomeUserId to sample config + [\#3906](https://github.com/vector-im/riot-web/pull/3906) + * CSS for mxIdDialog redesign + [\#3885](https://github.com/vector-im/riot-web/pull/3885) + * Implement PasswordNagBar + [\#3817](https://github.com/vector-im/riot-web/pull/3817) + * CSS for new SetMxIdDialog + [\#3762](https://github.com/vector-im/riot-web/pull/3762) + +Changes in [0.10.2](https://github.com/vector-im/riot-web/releases/tag/v0.10.2) (2017-06-06) +============================================================================================ +[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.10.1...v0.10.2) + + * Hotfix for bugs where navigating straight to a URL like /#/login and + and /#/forgot_password + + +Changes in [0.10.1](https://github.com/vector-im/riot-web/releases/tag/v0.10.1) (2017-06-02) +============================================================================================ +[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.10.0...v0.10.1) + + * Update to matrix-react-sdk 0.9.1 to fix i18n error which broke start chat in some circumstances + +Changes in [0.10.0](https://github.com/vector-im/riot-web/releases/tag/v0.10.0) (2017-06-02) +============================================================================================ +[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.10.0-rc.2...v0.10.0) + + * Update from Weblate. + [\#4152](https://github.com/vector-im/riot-web/pull/4152) + +Changes in [0.10.0-rc.2](https://github.com/vector-im/riot-web/releases/tag/v0.10.0-rc.2) (2017-06-02) +====================================================================================================== +[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.10.0-rc.1...v0.10.0-rc.2) + + * Update from Weblate. + [\#4150](https://github.com/vector-im/riot-web/pull/4150) + * styling for webrtc settings + [\#4019](https://github.com/vector-im/riot-web/pull/4019) + * Update from Weblate. + [\#4140](https://github.com/vector-im/riot-web/pull/4140) + * add styles for compact layout + [\#4132](https://github.com/vector-im/riot-web/pull/4132) + * Various tweaks to fetch-develop-deps + [\#4147](https://github.com/vector-im/riot-web/pull/4147) + * Don't try to build with node 6.0 + [\#4145](https://github.com/vector-im/riot-web/pull/4145) + * Support 12hr time on DateSeparator + [\#4143](https://github.com/vector-im/riot-web/pull/4143) + * Update from Weblate. + [\#4137](https://github.com/vector-im/riot-web/pull/4137) + * Update from Weblate. + [\#4105](https://github.com/vector-im/riot-web/pull/4105) + * Update from Weblate. + [\#4094](https://github.com/vector-im/riot-web/pull/4094) + * Update from Weblate. + [\#4091](https://github.com/vector-im/riot-web/pull/4091) + * Update from Weblate. + [\#4089](https://github.com/vector-im/riot-web/pull/4089) + * Update from Weblate. + [\#4083](https://github.com/vector-im/riot-web/pull/4083) + +Changes in [0.10.0-rc.1](https://github.com/vector-im/riot-web/releases/tag/v0.10.0-rc.1) (2017-06-01) +====================================================================================================== +[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.9.10...v0.10.0-rc.1) + + * basic electron profile support + [\#4030](https://github.com/vector-im/riot-web/pull/4030) + * Finish translations for vector-im/riot-web + [\#4122](https://github.com/vector-im/riot-web/pull/4122) + * Translate src/vector + [\#4119](https://github.com/vector-im/riot-web/pull/4119) + * electron flashFrame was way too annoying + [\#4128](https://github.com/vector-im/riot-web/pull/4128) + * auto-launch support [Electron] + [\#4012](https://github.com/vector-im/riot-web/pull/4012) + * Show 12hr time on hover too + [\#4092](https://github.com/vector-im/riot-web/pull/4092) + * Translate src/notifications + [\#4087](https://github.com/vector-im/riot-web/pull/4087) + * Translate src/components/structures + [\#4084](https://github.com/vector-im/riot-web/pull/4084) + * Smaller font size on timestamp to better fit in the available space + [\#4085](https://github.com/vector-im/riot-web/pull/4085) + * Make travis run the build with several versions of node + [\#4079](https://github.com/vector-im/riot-web/pull/4079) + * Piwik Analytics + [\#4056](https://github.com/vector-im/riot-web/pull/4056) + * Update from Weblate. + [\#4077](https://github.com/vector-im/riot-web/pull/4077) + * managed to eat the eventStatus check, can't redact a local-echo etc + [\#4078](https://github.com/vector-im/riot-web/pull/4078) + * show redact in context menu only if has PL to/sent message + [\#3925](https://github.com/vector-im/riot-web/pull/3925) + * Update from Weblate. + [\#4064](https://github.com/vector-im/riot-web/pull/4064) + * Change redact -> remove to improve clarity + [\#3722](https://github.com/vector-im/riot-web/pull/3722) + * Update from Weblate. + [\#4058](https://github.com/vector-im/riot-web/pull/4058) + * Message Forwarding + [\#3688](https://github.com/vector-im/riot-web/pull/3688) + * Update from Weblate. + [\#4057](https://github.com/vector-im/riot-web/pull/4057) + * Fixed an input field's background color in dark theme + [\#4053](https://github.com/vector-im/riot-web/pull/4053) + * Update from Weblate. + [\#4051](https://github.com/vector-im/riot-web/pull/4051) + * Update from Weblate. + [\#4049](https://github.com/vector-im/riot-web/pull/4049) + * Update from Weblate. + [\#4048](https://github.com/vector-im/riot-web/pull/4048) + * Update from Weblate. + [\#4040](https://github.com/vector-im/riot-web/pull/4040) + * Update translating.md: Minor suggestions + [\#4041](https://github.com/vector-im/riot-web/pull/4041) + * tidy electron files, they weren't pwetty + [\#3993](https://github.com/vector-im/riot-web/pull/3993) + * Prevent Power Save when in call (Electron) + [\#3992](https://github.com/vector-im/riot-web/pull/3992) + * Translations! + [\#4035](https://github.com/vector-im/riot-web/pull/4035) + * Kieran gould/12hourtimestamp + [\#3961](https://github.com/vector-im/riot-web/pull/3961) + * Don't include src in the test resolve root + [\#4033](https://github.com/vector-im/riot-web/pull/4033) + * add moar context menus [Electron] + [\#4021](https://github.com/vector-im/riot-web/pull/4021) + * Add `Chat` to Linux app categories + [\#4022](https://github.com/vector-im/riot-web/pull/4022) + * add menu category for linux build of app + [\#3975](https://github.com/vector-im/riot-web/pull/3975) + * Electron Tray Improvements + [\#3909](https://github.com/vector-im/riot-web/pull/3909) + * More riot-web test deflakification + [\#3966](https://github.com/vector-im/riot-web/pull/3966) + * Script to fetch corresponding branches of dependent projects + [\#3945](https://github.com/vector-im/riot-web/pull/3945) + * Add type="text/css" to SVG logos + [\#3964](https://github.com/vector-im/riot-web/pull/3964) + * Fix some setState-after-unmount in roomdirectory + [\#3958](https://github.com/vector-im/riot-web/pull/3958) + * Attempt to deflakify joining test + [\#3956](https://github.com/vector-im/riot-web/pull/3956) + +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) diff --git a/README.md b/README.md index 2d7ab81b..89f2148f 100644 --- a/README.md +++ b/README.md @@ -55,32 +55,41 @@ Building From Source Riot is a modular webapp built with modern ES6 and requires a npm build system 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. Install or update `node.js` so that your `node` is at least v6.3.0 (and `npm` + is at least v3.10.x). +1. Clone the repo: `git clone https://github.com/vector-im/riot-web.git`. +1. Switch to the riot-web directory: `cd riot-web`. +1. If you're using the `develop` branch, install the develop versions of the + dependencies, as the released ones will be too old: ``` - (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 rebuild 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) + modifying it (see below for details). 1. `npm run dist` to build a tarball to deploy. Untaring this file will give a version-specific directory containing all the files that need to go on your web server. @@ -125,7 +134,7 @@ Running as a Desktop app Riot can also be run as a desktop app, wrapped in electron. You can download a pre-built version from https://riot.im/desktop.html or, if you prefer, -built it yourself. +build it yourself. Requires Electron >=1.6.0 To run as a desktop app: @@ -135,7 +144,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 +282,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.riot.im/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 +314,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..7f2c97f9 100644 --- a/config.sample.json +++ b/config.sample.json @@ -4,11 +4,16 @@ "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": [ "matrix.org" ] + }, + "welcomeUserId": "@riot-bot:matrix.org", + "piwik": { + "url": "https://piwik.riot.im/", + "siteId": 1 } } diff --git a/docs/translating-dev.md b/docs/translating-dev.md new file mode 100644 index 00000000..55ba34be --- /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 'matrix-react-sdk/lib/languageHandler';`` is present. If not add it to the other import statements. +2. Add ``_t()`` to your string. (Don't forget curly braces when you assign an expression to JSX attributes in the render method) +3. Add the String to the ``en_EN.json`` file in ``src/i18n/strings`` (respect which repository you are on). + +## Adding variables inside a string. + +1. Extend your ``_t()`` call. Instead of ``_t(STRING)`` use ``_t(STRING, {})`` +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..3fd0731d --- /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://matrix.to/#/#riotweb-translations:matrix.org +2. Read scrollback and/or ask if anyone else is working on your language, and co-ordinate if needed. In general little-or-no coordination is needed though :) + +## Step 1: Preparing your Weblate Profile + +1. Head to https://translate.riot.im and register either via Github or email +2. After registering check if you got an email to verify your account and click the link (if there is none head to step 1.4) +3. Log into weblate +4. Head to https://translate.riot.im/accounts/profile/ and select the languages you know and maybe another language you know too. +6. Head to https://translate.riot.im/accounts/profile/#subscriptions and select Riot Web as Project + +## How to check if your language already is being translated + +Go to https://translate.riot.im/projects/riot-web/ and visit the 2 sub-projects. +If your language is listed go to Step 2a and if not go to Step 2b + +## Step 2a: Helping on existing languages. + +1. Head to one of the projects listed https://translate.riot.im/projects/riot-web/ +2. Click on the ``translate`` button on the right side of your language +3. Fill in the translations in the writeable field. You will see the original English string and the string of your second language above. + +Head to the explanations under Steb 2b + +## Step 2b: Adding a new language + +1. Go to one of the projects listed https://translate.riot.im/projects/riot-web/ +2. Click the ``Start new language`` button at the bottom +3. Select a language +4. Start translating like in 2a.3 +5. Repeat these steps for the other projects which are listed at the link of step 2b.1 + +### 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/tray.js b/electron/src/tray.js deleted file mode 100644 index 2ccdf40c..00000000 --- a/electron/src/tray.js +++ /dev/null @@ -1,67 +0,0 @@ -/* -Copyright 2017 Karl Glatz -Copyright 2017 OpenMarket Ltd - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -const path = require('path'); -const electron = require('electron'); - -const app = electron.app; -const Tray = electron.Tray; -const MenuItem = electron.MenuItem; - -let trayIcon = null; - -exports.hasTray = function hasTray() { - return (trayIcon !== null); -} - -exports.create = function (win, config) { - // no trays on darwin - if (process.platform === 'darwin' || trayIcon) { - return; - } - - const toggleWin = function () { - if (win.isVisible() && !win.isMinimized()) { - win.hide(); - } else { - if (win.isMinimized()) win.restore(); - if (!win.isVisible()) win.show(); - win.focus(); - } - }; - - const contextMenu = electron.Menu.buildFromTemplate([ - { - label: 'Show/Hide ' + config.brand, - click: toggleWin - }, - { - type: 'separator' - }, - { - label: 'Quit', - click: function () { - app.quit(); - } - } - ]); - - trayIcon = new Tray(config.icon_path); - trayIcon.setToolTip(config.brand); - trayIcon.setContextMenu(contextMenu); - trayIcon.on('click', toggleWin); -}; 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..0e08efd5 --- /dev/null +++ b/electron_app/package.json @@ -0,0 +1,14 @@ +{ + "name": "riot-web", + "productName": "Riot", + "main": "src/electron-main.js", + "version": "0.11.0", + "description": "A feature-rich client for Matrix.org", + "author": "Vector Creations Ltd.", + "dependencies": { + "auto-launch": "^5.0.1", + "electron-window-state": "^4.1.0", + "minimist": "^1.2.0", + "png-to-ico": "^1.0.2" + } +} 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..1303985e --- /dev/null +++ b/electron_app/riot.im/config.json @@ -0,0 +1,20 @@ +{ + "update_base_url": "https://riot.im/download/desktop/update/", + "default_hs_url": "https://matrix.org", + "default_is_url": "https://vector.im", + "brand": "Riot", + "integrations_ui_url": "https://scalar.vector.im/", + "integrations_rest_url": "https://scalar.vector.im/api", + "bug_report_endpoint_url": "https://riot.im/bugreports/submit", + "welcomeUserId": "@riot-bot:matrix.org", + "enableLabs": true, + "roomDirectory": { + "servers": [ + "matrix.org" + ] + }, + "piwik": { + "url": "https://piwik.riot.im/", + "siteId": 1 + } +} diff --git a/electron/src/electron-main.js b/electron_app/src/electron-main.js similarity index 52% rename from electron/src/electron-main.js rename to electron_app/src/electron-main.js index 33b44ce9..3491ce0f 100644 --- a/electron/src/electron-main.js +++ b/electron_app/src/electron-main.js @@ -1,8 +1,7 @@ -// @flow - /* Copyright 2016 Aviral Dasgupta Copyright 2016 OpenMarket Ltd +Copyright 2017 Michael Telatynski <7t3chguy@gmail.com> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,15 +19,22 @@ 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 argv = require('minimist')(process.argv); const electron = require('electron'); -const url = require('url'); +const AutoLaunch = require('auto-launch'); const tray = require('./tray'); +const vectorMenu = require('./vectormenu'); +const webContentsHandler = require('./webcontents-handler'); -const VectorMenu = require('./vectormenu'); +const windowStateKeeper = require('electron-window-state'); + +if (argv.profile) { + electron.app.setPath('userData', `${electron.app.getPath('userData')}-${argv.profile}`); +} let vectorConfig = {}; try { @@ -40,54 +46,12 @@ 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; let mainWindow = null; let appQuitting = false; -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 parsed_url = url.parse(target); - if (PERMITTED_URL_SCHEMES.indexOf(parsed_url.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); - } -} - -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 popup_menu = new electron.Menu(); - popup_menu.append(new electron.MenuItem({ - label: params.linkURL, - click() { - safeOpenURL(params.linkURL); - }, - })); - popup_menu.popup(); - ev.preventDefault(); -} - function installUpdate() { // for some reason, quitAndInstall does not fire the // before-quit event, so we need to set the flag here. @@ -99,13 +63,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 +77,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 +85,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 +106,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 +116,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 (count === 0) { + mainWindow.flashFrame(false); + } +}); + +electron.ipcMain.on('loudNotification', function() { + if (process.platform === 'win32' && mainWindow && !mainWindow.isFocused() && !focusHandlerAttached) { + mainWindow.flashFrame(true); + mainWindow.once('focus', () => { + mainWindow.flashFrame(false); + focusHandlerAttached = false; + }); + focusHandlerAttached = true; + } +}); + +let powerSaveBlockerId; +electron.ipcMain.on('app_onAction', function(ev, payload) { + switch (payload.action) { + case 'call_state': + if (powerSaveBlockerId && powerSaveBlockerId.isStarted(powerSaveBlockerId)) { + if (payload.state === 'ended') { + electron.powerSaveBlocker.stop(powerSaveBlockerId); + } + } else { + if (payload.state === 'connected') { + powerSaveBlockerId = electron.powerSaveBlocker.start('prevent-display-sleep'); + } + } + break; + } +}); + + electron.app.commandLine.appendSwitch('--enable-usermedia-screen-capturing'); const shouldQuit = electron.app.makeSingleInstance((commandLine, workingDirectory) => { @@ -171,44 +171,115 @@ const shouldQuit = electron.app.makeSingleInstance((commandLine, workingDirector }); if (shouldQuit) { - electron.app.quit() + console.log('Other instance detected: exiting'); + electron.app.exit(); } + +const launcher = new AutoLaunch({ + name: vectorConfig.brand || 'Riot', + isHidden: true, + mac: { + useLaunchAgent: true, + }, +}); + +const settings = { + 'auto-launch': { + get: launcher.isEnabled, + set: function(bool) { + if (bool) { + return launcher.enable(); + } else { + return launcher.disable(); + } + }, + }, +}; + +electron.ipcMain.on('settings_get', async function(ev) { + const data = {}; + + try { + await Promise.all(Object.keys(settings).map(async function (setting) { + data[setting] = await settings[setting].get(); + })); + + ev.sender.send('settings', data); + } catch(e) { console.error(e); } +}); + +electron.ipcMain.on('settings_set', function(ev, key, value) { + console.log(key, value); + if (settings[key] && settings[key].set) { + settings[key].set(value); + } +}); + electron.app.on('ready', () => { - if (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"); + + if (argv.devtools) { + try { + const { default: installExtension, REACT_DEVELOPER_TOOLS, REACT_PERF } = require('electron-devtools-installer'); + installExtension(REACT_DEVELOPER_TOOLS) + .then((name) => console.log(`Added Extension: ${name}`)) + .catch((err) => console.log('An error occurred: ', err)); + installExtension(REACT_PERF) + .then((name) => console.log(`Added Extension: ${name}`)) + .catch((err) => console.log('An error occurred: ', err)); + } catch(e) {console.log(e);} } - const icon_path = `${__dirname}/../img/riot.` + ( - process.platform == 'win32' ? 'ico' : 'png' - ); + + if (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'); + } + + 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); + + // explicitly hide because setApplicationMenu on Linux otherwise shows... + // https://github.com/electron/electron/issues/9621 + mainWindow.hide(); // Create trayIcon icon tray.create(mainWindow, { - icon_path: icon_path, - brand: vectorConfig.brand || 'Riot' + icon_path: iconPath, + brand: vectorConfig.brand || 'Riot', }); - mainWindow.once('ready-to-show', () => { - mainWindow.show(); - }); + if (!argv.hidden) { + mainWindow.once('ready-to-show', () => { + mainWindow.show(); + }); + } + mainWindow.on('closed', () => { 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) @@ -218,14 +289,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_app/src/tray.js b/electron_app/src/tray.js new file mode 100644 index 00000000..039e7133 --- /dev/null +++ b/electron_app/src/tray.js @@ -0,0 +1,94 @@ +/* +Copyright 2017 Karl Glatz +Copyright 2017 OpenMarket Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +const {app, Tray, Menu, nativeImage} = require('electron'); +const pngToIco = require('png-to-ico'); +const path = require('path'); +const fs = require('fs'); + +let trayIcon = null; + +exports.hasTray = function hasTray() { + return (trayIcon !== null); +}; + +exports.create = function(win, config) { + // no trays on darwin + if (process.platform === 'darwin' || trayIcon) return; + + const toggleWin = function() { + if (win.isVisible() && !win.isMinimized()) { + win.hide(); + } else { + if (win.isMinimized()) win.restore(); + if (!win.isVisible()) win.show(); + win.focus(); + } + }; + + const contextMenu = Menu.buildFromTemplate([ + { + label: `Show/Hide ${config.brand}`, + click: toggleWin, + }, + { type: 'separator' }, + { + label: 'Quit', + 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', async 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]); + + if (process.platform === 'win32') { + try { + const icoPath = path.join(app.getPath('temp'), 'win32_riot_icon.ico') + const icoBuf = await pngToIco(newFavicon.toPNG()); + fs.writeFileSync(icoPath, icoBuf); + newFavicon = icoPath; + } catch (e) {console.error(e);} + } + } + + 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 340ee805..51c366b1 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.9", + "main": "electron_app/src/electron-main.js", + "version": "0.11.0", "description": "A feature-rich client for Matrix.org", "author": "Vector Creations Ltd.", "repository": { @@ -27,23 +27,26 @@ "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:bundle": "NODE_ENV=production webpack -p --progress", + "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:electron": "npm run clean && npm run build && npm run install:electron && build -wml --ia32 --x64", + "build": "npm run reskindex && npm run build:res && npm run build:bundle", + "build:dev": "npm run reskindex && npm run build:res && npm run build:bundle:dev", "dist": "scripts/package.sh", + "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": "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:js:prod": "cross-env NODE_ENV=production webpack-dev-server -w --progress", + "start": "parallelshell \"npm run reskindex:watch\" \"npm run start:res\" \"npm run start:js\"", + "start:prod": "parallelshell \"npm run reskindex:watch\" \"npm run start:res\" \"npm run start:js:prod\"", "lint": "eslint src/", "lintall": "eslint src/ test/", - "clean": "rimraf lib webapp electron/dist", + "clean": "rimraf lib webapp electron_app/dist", "prepublish": "npm run build:compile", "test": "karma start --single-run=true --autoWatch=false --browsers PhantomJS --colors=false", "test-multi": "karma start" @@ -56,15 +59,16 @@ "draft-js": "^0.8.1", "extract-text-webpack-plugin": "^0.9.1", "favico.js": "^0.3.10", - "filesize": "^3.1.2", - "flux": "~2.0.3", + "filesize": "3.5.6", + "flux": "2.1.1", "gemini-scrollbar": "matrix-org/gemini-scrollbar#b302279", "gfm.css": "^1.1.1", "highlight.js": "^9.0.0", "linkifyjs": "^2.1.3", - "matrix-js-sdk": "0.7.7", - "matrix-react-sdk": "0.8.8", + "matrix-js-sdk": "0.7.11", + "matrix-react-sdk": "0.9.3", "modernizr": "^3.1.0", + "pako": "^1.0.5", "q": "^1.4.1", "react": "^15.4.0", "react-dnd": "^2.1.4", @@ -72,8 +76,10 @@ "react-dom": "^15.4.0", "react-gemini-scrollbar": "matrix-org/react-gemini-scrollbar#5e97aef", "sanitize-html": "^1.11.1", + "text-encoding-utf-8": "^1.0.1", "ua-parser-js": "^0.7.10", - "url": "^0.11.0" + "url": "^0.11.0", + "velocity-vector": "vector-im/velocity#059e3b2" }, "devDependencies": { "autoprefixer": "^6.6.0", @@ -93,12 +99,15 @@ "babel-preset-stage-2": "^6.17.0", "chokidar": "^1.6.1", "cpx": "^1.3.2", + "cross-env": "^4.0.0", "css-raw-loader": "^0.1.1", "electron-builder": "^11.2.4", "electron-builder-squirrel-windows": "^11.2.1", + "electron-devtools-installer": "^2.2.0", "emojione": "^2.2.7", "eslint": "^3.14.0", "eslint-config-google": "^0.7.1", + "eslint-plugin-babel": "^4.1.1", "eslint-plugin-flowtype": "^2.30.0", "eslint-plugin-react": "^6.9.0", "expect": "^1.16.0", @@ -138,30 +147,34 @@ "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" + "StartupWMClass": "riot" } }, "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..d5d59645 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..05c7418a 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..bc7cef09 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..d48facad 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..8fd27cd3 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..883835ff 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..b1bb36b9 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..ae68b12c 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..146e9c0a 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..8142adfc 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..cc5bf30d 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..e32414bd 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..8d1e1437 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..6ec17884 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..ba269c04 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..2bf3c746 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..3e3ec3fc 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..694050ca 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..6de2cde8 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..742ba923 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..17f9f67d 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..b01d3ff5 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..d0f82e82 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..21865ac7 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..a7c60914 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..6d50a0f5 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..310a25ea 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..bc4da8d9 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..144b8d32 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..08979437 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..02784925 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..2b05a8fc 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..1f031df0 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..aafb0f17 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..30840167 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..ce9de9c9 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..33620c3f 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..4bbf8b11 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..fd40fc8a 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..230aacd4 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..c58ed4f7 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..6c2441e3 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..9fd87167 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..9741b9b1 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..6cca3596 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..13b993d1 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..bca5730f 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..e086855c 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..65c0aba4 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..b351c67a 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..e7a25c60 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..f249bbaa 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..e02cacd3 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..3ea21422 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..3182f48b 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..54623346 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..93e26916 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..243bb739 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..fc74cc39 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..c3a0e9d1 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..5c4a004f 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..1589d0cc 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..4c53dead 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..3668de79 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..66ec709d 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..148be93c 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..7cb84415 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..aae73b6f 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..7b420f02 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..42f64bf3 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..cecc683c 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..6074fea0 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..45fdb664 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..d8fd75c6 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..6d50a0f5 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..3808a61f 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..589be700 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..babe1e4c 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..d34cddec 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..98828a59 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..aec8969b 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..70b1a623 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..9aa58327 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..cf1645c2 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..ec374fb3 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..46874b4d 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..81b7abdf 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..7fd1015e 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..101de51e 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..772c2cbe 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..d5bd8c1e 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..8923085d 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..20c268ce 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..86f56635 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..907dc596 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..8d1e1437 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..4cf8c311 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..413ceb15 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..097abeb4 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..23499bf6 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..80200657 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..63f22201 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..02688263 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..c777acc4 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..85fa9bfe 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..1675d8e7 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..f2c21f72 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..0b8e6750 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..5ee3e63c 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..53b967be 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..a1437aba 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..0d462fa3 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..8934db7e 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..6f92d523 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..866b3f15 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..56b433c7 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..e1ddd5f8 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..8b7c54bc 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..227a3b33 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..bc6189be 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..c92248b9 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..ab1cb949 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..0b41c7a5 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..7af5290d 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..e10a1255 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..6ad67d42 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..865df57a 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..e83a2d08 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..57034d36 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..6e7ad582 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..46c3b84a 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..79b505d4 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..7740cdc0 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..8f383e67 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..a0f36d89 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..2884c4c0 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..1f76cfc9 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..06fc2ad1 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..8e54c2b8 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..97424d4e 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..6d50a0f5 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..28bfccc9 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..e482a659 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..84e2e65e 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..38fec347 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..70a03c6b 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..1e1bbe60 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..3833d683 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..63119096 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..9cab441a 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..c144de17 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..12217070 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..7963aa61 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..d5d4d400 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..0f2ecb43 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..d0a5d24f 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..096cb111 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..17f18ac5 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..66be6563 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..7ecfd317 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..11126ade 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..d584fa84 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..c0540425 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..73aee15b 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..fd044933 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..08979437 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..aafb0f17 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..744458e1 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..58c2afb2 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..007c99ec 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..839368dd 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..63a89336 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..3515d95d 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..58f70b8d 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..2f33f257 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..c796f587 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..0d98de03 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..87f4e2f4 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..273869df 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..b74c396d 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..e34c62d5 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..8efdb912 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..7a0cceec 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..49e29082 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..6cb2e1e7 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..a61c42c4 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..bb091cc8 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..6d50a0f5 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..4495d29e 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..ebb0f28a 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..64532ffa 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..64b3cfff 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..250de6f6 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..5833c130 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..ce5248f4 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..d8711a83 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..81880931 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..6f00e579 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..055dde68 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..96359834 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..aafb0f17 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..84c7021f 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..c5ed1991 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..1af1ca28 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..d0b18435 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..64e2970b 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..b072dda8 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..83933d45 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..c102721a 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..80de92e5 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..dd52215c 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..78f45b7c 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..2182f4ff 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..3e3e19d4 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..753bec22 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..6d50a0f5 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..8501ada6 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..0c884c32 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..3c9026fa 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..fd605749 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..b4c834b1 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..d18cb939 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..21c4b98b 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..c828206e 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..f2a5bd22 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..66d69833 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..7a127f51 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..2353ba1b 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..7949f65d 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..687e3052 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..0a21ad15 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..c3a245b7 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..21a347c6 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..643b6ae0 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..63a13c0e 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..da991a93 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..e75e17c9 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..46f93cad 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..8c849a73 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..6ea2122f 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..bad3ba4d 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..d94359dc 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..f8b80e5b 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..8b9bbd89 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..32887936 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..7f0a52d3 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..87adc3af 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..742c9f7e Binary files /dev/null and b/res/flags/ZW.png differ diff --git a/res/home.html b/res/home.html new file mode 100644 index 00000000..3ba2e964 --- /dev/null +++ b/res/home.html @@ -0,0 +1,292 @@ + + +
+
+ +
+

_t("Welcome to Riot.im")

+

_t("Decentralised, encrypted chat & collaboration powered by [matrix]")

+
+
+
+
+
+

_t("Search the room directory")

+ + + + + _t("Lots of rooms already exist in Matrix, linked to existing networks (Slack, IRC, Gitter etc) or independent. Check out the directory!") + +
+
+
+
+

_t("Chat with Riot Bot")

+ + + + + _t("Get started with some tips from Riot Bot!") + +
+
+
+ +

_t("General discussion about Matrix and Riot")

+ +
+
+ + + Matrix HQ + + _t("Discussion of all things Matrix!") +
+
+ + + Riot + + _t("Riot/Web & Desktop chat") +
+
+ + + #riot-ios + + _t("Riot/iOS & matrix-ios-sdk chat") +
+
+ + + #riot-android + + _t("Riot/Android & matrix-android-sdk chat") +
+
+ +

_t("Matrix technical discussions")

+

_t("Running Matrix services")

+ +
+
+ + + Synapse Support Community + + _t("Community-run support for Synapse") +
+
+ + + #dendrite:matrix.org + + _t("Admin support for Dendrite") +
+
+ + + Synapse Homeowners + + _t("Announcements about Synapse releases") +
+
+ + + IRC Matrix Bridges + + _t("Support for those using and running matrix-appservice-irc") +
+
+ +

_t("Building services on Matrix")

+ +
+
+ + + #matrix-dev:matrix.org + + _t("Support for those using the Matrix spec") +
+
+ + + End-to-end crypto in Matrix + + _t("Design and implementation of E2E in Matrix") +
+
+ + + #vr:matrix.org + + _t("Implementing VR services with Matrix") +
+
+ + + #webrtc:matrix.org + + _t("Implementing VoIP services with Matrix") +
+
+ + + Matrix Identity + + _t("Discussion of the Identity Service API") +
+
+ + + Matrix Bridging + + _t("Support for those using, running and writing other bridges") +
+
+ +

_t("Contributing code to Matrix and Riot")

+ +
+
+ + + #riot-dev + + _t("Dev chat for the Riot/Web dev team") +
+
+ + + #dendrite-dev + + _t("Dev chat for the Dendrite dev team") +
+
+ + + Riot-Web Translations + + _t("Co-ordination for Riot/Web translators") +
+
+
diff --git a/res/home/images/logo.svg b/res/home/images/logo.svg new file mode 100644 index 00000000..a5f70e5e --- /dev/null +++ b/res/home/images/logo.svg @@ -0,0 +1,76 @@ + + + + +New_logo + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/home/images/matrix.svg b/res/home/images/matrix.svg new file mode 100644 index 00000000..5c7dfbb5 --- /dev/null +++ b/res/home/images/matrix.svg @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/home/rooms/bridging.png b/res/home/rooms/bridging.png new file mode 100644 index 00000000..6b3a55e7 Binary files /dev/null and b/res/home/rooms/bridging.png differ diff --git a/res/home/rooms/dendrite-dev.png b/res/home/rooms/dendrite-dev.png new file mode 100644 index 00000000..1d96bd84 Binary files /dev/null and b/res/home/rooms/dendrite-dev.png differ diff --git a/res/home/rooms/dendrite.png b/res/home/rooms/dendrite.png new file mode 100644 index 00000000..1d96bd84 Binary files /dev/null and b/res/home/rooms/dendrite.png differ diff --git a/res/home/rooms/e2e.png b/res/home/rooms/e2e.png new file mode 100644 index 00000000..a2bda4bc Binary files /dev/null and b/res/home/rooms/e2e.png differ diff --git a/res/home/rooms/homeowners.png b/res/home/rooms/homeowners.png new file mode 100644 index 00000000..ed45f11c Binary files /dev/null and b/res/home/rooms/homeowners.png differ diff --git a/res/home/rooms/identity.jpg b/res/home/rooms/identity.jpg new file mode 100644 index 00000000..f2e15056 Binary files /dev/null and b/res/home/rooms/identity.jpg differ diff --git a/res/home/rooms/identity.png b/res/home/rooms/identity.png new file mode 100644 index 00000000..de1ea60d Binary files /dev/null and b/res/home/rooms/identity.png differ diff --git a/res/home/rooms/irc.png b/res/home/rooms/irc.png new file mode 100644 index 00000000..5f611d12 Binary files /dev/null and b/res/home/rooms/irc.png differ diff --git a/res/home/rooms/matrix-dev.png b/res/home/rooms/matrix-dev.png new file mode 100644 index 00000000..fa54f00c Binary files /dev/null and b/res/home/rooms/matrix-dev.png differ diff --git a/res/home/rooms/matrix.png b/res/home/rooms/matrix.png new file mode 100644 index 00000000..fa54f00c Binary files /dev/null and b/res/home/rooms/matrix.png differ diff --git a/res/home/rooms/riot-android.png b/res/home/rooms/riot-android.png new file mode 100644 index 00000000..fa2bec8e Binary files /dev/null and b/res/home/rooms/riot-android.png differ diff --git a/res/home/rooms/riot-bot.png b/res/home/rooms/riot-bot.png new file mode 100644 index 00000000..9efd4a3c Binary files /dev/null and b/res/home/rooms/riot-bot.png differ diff --git a/res/home/rooms/riot-dev.png b/res/home/rooms/riot-dev.png new file mode 100644 index 00000000..ff8b21ad Binary files /dev/null and b/res/home/rooms/riot-dev.png differ diff --git a/res/home/rooms/riot-ios.png b/res/home/rooms/riot-ios.png new file mode 100644 index 00000000..83306f7c Binary files /dev/null and b/res/home/rooms/riot-ios.png differ diff --git a/res/home/rooms/riot-translations.png b/res/home/rooms/riot-translations.png new file mode 100644 index 00000000..ee0f8558 Binary files /dev/null and b/res/home/rooms/riot-translations.png differ diff --git a/res/home/rooms/riot.png b/res/home/rooms/riot.png new file mode 100644 index 00000000..4daa2e4e Binary files /dev/null and b/res/home/rooms/riot.png differ diff --git a/res/home/rooms/synapse.png b/res/home/rooms/synapse.png new file mode 100644 index 00000000..ee0f8558 Binary files /dev/null and b/res/home/rooms/synapse.png differ diff --git a/res/home/rooms/vr.png b/res/home/rooms/vr.png new file mode 100644 index 00000000..98b77802 Binary files /dev/null and b/res/home/rooms/vr.png differ diff --git a/res/home/rooms/webrtc.png b/res/home/rooms/webrtc.png new file mode 100644 index 00000000..98b790f9 Binary files /dev/null and b/res/home/rooms/webrtc.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/check-i18n.pl b/scripts/check-i18n.pl new file mode 120000 index 00000000..7d74c7a4 --- /dev/null +++ b/scripts/check-i18n.pl @@ -0,0 +1 @@ +../../matrix-react-sdk/scripts/check-i18n.pl \ No newline at end of file diff --git a/scripts/copy-res.js b/scripts/copy-res.js index 826d9a96..b02946ae 100755 --- a/scripts/copy-res.js +++ b/scripts/copy-res.js @@ -3,19 +3,55 @@ // 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 = [ + {'value': 'en_EN', 'label': 'English'}, + {'value': 'en_US', 'label': 'English (US)'}, + {'value': 'da', 'label': 'Dansk'}, + {'value': 'el', 'label': 'Ελληνικά'}, + {'value': 'nl', 'label': 'Nederlands'}, + {'value': 'de_DE', 'label': 'Deutsch'}, + {'value': 'fr', 'label': 'Français'}, + {'value': 'pt', 'label': 'Português'}, + {'value': 'pt_BR', 'label': 'Português do Brasil'}, + {'value': 'ru', 'label': 'Русский'}, + {'value': 'sv', 'label': 'Svenska'}, + {'value': 'es', 'label': 'Español'}, + {'value': 'th', 'label': 'ไทย'}, + {'value': 'zh_Hans', 'label': '简体中文'}, // simplified chinese + {'value': 'zh_Hant', 'label': '繁體中文'}, // traditional chinese +]; + // 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/home.html", "webapp"], + ["res/home/**", "webapp/home"], ["res/{media,vector-icons}/**", "webapp"], + ["res/flags/*", "webapp/flags/"], ["src/skins/vector/{fonts,img}/**", "webapp"], ["node_modules/emojione/assets/svg/*", "webapp/emojione/svg/"], - ["./config.json", "webapp", {directwatch: 1}], + ["node_modules/emojione/assets/png/*", "webapp/emojione/png/"], + ["./config.json", "webapp", { directwatch: 1 }], ]; +INCLUDE_LANGS.forEach(function(l) { + COPY_LIST.push([ + l.value, "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), {} @@ -31,6 +67,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); @@ -42,10 +87,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}`); }); @@ -54,7 +102,7 @@ function next(i, err) { }); } - const cb = (err) => {next(i+1, err)}; + const cb = (err) => { next(i + 1, err) }; if (watch) { if (opts.directwatch) { @@ -62,20 +110,79 @@ 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.value.toLowerCase().replace("_", "-"); + const languageParts = normalizedLanguage.split('-'); + if (languageParts.length == 2 && languageParts[0] == languageParts[1]) { + languages[languageParts[0]] = {'fileName': lang.value + '.json', 'label': lang.label}; + } else { + languages[normalizedLanguage] = {'fileName': lang.value + '.json', 'label': lang.label}; + } + }); + fs.writeFile('webapp/i18n/languages.json', JSON.stringify(languages, null, 4), function(err) { + if (err) { + console.error("Copy Error occured: " + err); + throw new Error("Failed to generate languages.json"); + } + }); + if (verbose) { + console.log("Generated languages.json"); + } +} + +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..4fa1a4a2 --- /dev/null +++ b/scripts/fetch-develop.deps.sh @@ -0,0 +1,93 @@ +#!/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. + +set -e + +GIT_CLONE_ARGS=("$@") + +# 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 + +# Chop 'origin' off the start as jenkins ends up using +# branches on the origin, but this doesn't work if we +# specify the branch when cloning. +curbranch=${curbranch#origin/} + +echo "Determined branch to be $curbranch" + +# clone a specific branch of a github repo +function clone() { + org=$1 + repo=$2 + branch=$3 + git clone https://github.com/$org/$repo.git $repo --branch $branch \ + "${GIT_CLONE_ARGS[@]}" +} + +function dodep() { + org=$1 + repo=$2 + rm -rf $repo + clone $org $repo $curbranch || { + [ "$curbranch" != 'develop' ] && clone $org $repo develop + } || return $? + + ( + cd $repo + echo "$repo set to branch "`git rev-parse --abbrev-ref HEAD` + ) + + mkdir -p node_modules + rm -r "node_modules/$repo" 2>/dev/null || true + ln -sv "../$repo" node_modules/ +} + +echo -en 'travis_fold:start:matrix-js-sdk\r' +echo 'Setting up matrix-js-sdk' + +dodep matrix-org matrix-js-sdk +( + cd node_modules/matrix-js-sdk + npm install +) + +echo -en 'travis_fold:end:matrix-js-sdk\r' + +echo -en 'travis_fold:start:matrix-react-sdk\r' +echo 'Setting up matrix-react-sdk' + +dodep matrix-org matrix-react-sdk + +mkdir -p node_modules/matrix-react-sdk/node_modules +ln -s ../../matrix-js-sdk node_modules/matrix-react-sdk/node_modules/ + +( + cd node_modules/matrix-react-sdk + npm install +) + +echo -en 'travis_fold:end:matrix-react-sdk\r' + +# 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 node_modules/.bin +ln -sfv ../matrix-react-sdk/scripts/reskindex.js node_modules/.bin/reskindex diff --git a/scripts/genflags.sh b/scripts/genflags.sh new file mode 100755 index 00000000..d960c6de --- /dev/null +++ b/scripts/genflags.sh @@ -0,0 +1,70 @@ +# 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) +# +# on macOS, this is most easily done with: +# brew install imagemagick --with-librsvg +# +# 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 + # -resize 50x30 : resize the flag to have a height of 15px (2x) + # By default, aspect ratio is respected so the width will + # be correct and not necessarily 25px. + # -filter Lanczos : use sharper resampling to avoid muddiness + # -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 54x54 : surround the image with padding so that it + # has the dimensions 27x27px (2x). + convert $f -background none -filter Lanczos -resize 50x30 \ + -gravity Center -border 1 -bordercolor \#e0e0e0 \ + -extent 54x54 $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 2b67aa15..00000000 --- a/src/component-index.js +++ /dev/null @@ -1,88 +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$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..eacc500a 100644 --- a/src/components/structures/BottomLeftMenu.js +++ b/src/components/structures/BottomLeftMenu.js @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +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. @@ -14,20 +15,21 @@ See the License for the specific language governing permissions and limitations under the License. */ -'use strict'; +import React from 'react'; +import ReactDOM from 'react-dom'; +import sdk from 'matrix-react-sdk'; +import dis from 'matrix-react-sdk/lib/dispatcher'; +import AccessibleButton from 'matrix-react-sdk/lib/components/views/elements/AccessibleButton'; +import Velocity from 'velocity-vector'; +import 'velocity-vector/velocity.ui'; -var React = require('react'); -var ReactDOM = require('react-dom'); -var sdk = require('matrix-react-sdk') -var dis = require('matrix-react-sdk/lib/dispatcher'); -var AccessibleButton = require('matrix-react-sdk/lib/components/views/elements/AccessibleButton'); +const CALLOUT_ANIM_DURATION = 1000; module.exports = React.createClass({ displayName: 'BottomLeftMenu', propTypes: { collapsed: React.PropTypes.bool.isRequired, - teamToken: React.PropTypes.string, }, getInitialState: function() { @@ -40,6 +42,18 @@ module.exports = React.createClass({ }); }, + componentWillMount: function() { + this._dispatcherRef = dis.register(this.onAction); + this._peopleButton = null; + this._directoryButton = null; + this._createRoomButton = null; + this._lastCallouts = {}; + }, + + componentWillUnmount: function() { + dis.unregister(this._dispatcherRef); + }, + // Room events onDirectoryClick: function() { dis.dispatch({ action: 'view_room_directory' }); @@ -104,6 +118,30 @@ module.exports = React.createClass({ this.setState({ settingsHover: false }); }, + onAction: function(payload) { + let calloutElement; + switch (payload.action) { + // Incoming instruction: dance! + case 'callout_start_chat': + calloutElement = this._peopleButton; + break; + case 'callout_room_directory': + calloutElement = this._directoryButton; + break; + case 'callout_create_room': + calloutElement = this._createRoomButton; + break; + } + if (calloutElement) { + const lastCallout = this._lastCallouts[payload.action]; + const now = Date.now(); + if (lastCallout == undefined || lastCallout < now - CALLOUT_ANIM_DURATION) { + this._lastCallouts[payload.action] = now; + Velocity(ReactDOM.findDOMNode(calloutElement), "callout.bounce", CALLOUT_ANIM_DURATION); + } + } + }, + // Get the label/tooltip to show getLabel: function(label, show) { if (show) { @@ -112,39 +150,41 @@ module.exports = React.createClass({ } }, - render: function() { - var TintableSvg = sdk.getComponent('elements.TintableSvg'); + _collectPeopleButton: function(e) { + this._peopleButton = e; + }, - var homeButton; - if (this.props.teamToken) { - homeButton = ( - - - { this.getLabel("Welcome page", this.state.homeHover) } - - ); - } + _collectDirectoryButton: function(e) { + this._directoryButton = e; + }, + + _collectCreateRoomButton: function(e) { + this._createRoomButton = e; + }, + + render: function() { + const HomeButton = sdk.getComponent('elements.HomeButton'); + const StartChatButton = sdk.getComponent('elements.StartChatButton'); + const RoomDirectoryButton = sdk.getComponent('elements.RoomDirectoryButton'); + const CreateRoomButton = sdk.getComponent('elements.CreateRoomButton'); + const SettingsButton = sdk.getComponent('elements.SettingsButton'); return (
- { homeButton } - - - { this.getLabel("Start chat", this.state.peopleHover) } - - - - { this.getLabel("Room directory", this.state.directoryHover) } - - - - { this.getLabel("Create new room", this.state.roomsHover) } - - - - { this.getLabel("Settings", this.state.settingsHover) } - + +
+ +
+
+ +
+
+ +
+ + +
); diff --git a/src/components/structures/CompatibilityPage.js b/src/components/structures/CompatibilityPage.js index bae33803..88b01cb2 100644 --- a/src/components/structures/CompatibilityPage.js +++ b/src/components/structures/CompatibilityPage.js @@ -17,6 +17,7 @@ limitations under the License. 'use strict'; var React = require('react'); +import { _t, _tJsx } from 'matrix-react-sdk/lib/languageHandler'; module.exports = React.createClass({ displayName: 'CompatibilityPage', @@ -39,23 +40,37 @@ module.exports = React.createClass({ return (
-

Sorry, your browser is not able to run Riot.

+

{ _tJsx("Sorry, your browser is not able to run Riot.", /(.*?)<\/b>/, (sub) => {sub}) }

- Riot uses many advanced browser features, some of which are not - available or experimental in your current browser. + { _t("Riot uses many advanced browser features, some of which are not available or experimental in your current browser.") }

- Please install Chrome or Firefox for - the best experience. Safari and Opera work too. + { _tJsx('Please install Chrome or Firefox for the best experience.', + [ + /(.*?)<\/a>/, + /(.*?)<\/a>/, + ], + [ + (sub) => {sub}, + (sub) => {sub}, + ] + )} + { _tJsx('Safari and Opera work too.', + [ + /(.*?)<\/a>/, + /(.*?)<\/a>/, + ], + [ + (sub) => {sub}, + (sub) => {sub}, + ] + )}

- With your current browser, the look and feel of the application may - be completely incorrect, and some or all features may not function. - If you want to try it anyway you can continue, but you are on your own - in terms of any issues you may encounter! + { _t("With your current browser, the look and feel of the application may be completely incorrect, and some or all features may not function. If you want to try it anyway you can continue, but you are on your own in terms of any issues you may encounter!") }

diff --git a/src/components/structures/HomePage.js b/src/components/structures/HomePage.js index 8d44c90a..e1e700f2 100644 --- a/src/components/structures/HomePage.js +++ b/src/components/structures/HomePage.js @@ -18,23 +18,82 @@ limitations under the License. 'use strict'; import React from 'react'; -import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg'; -import sdk from 'matrix-react-sdk'; +import GeminiScrollbar from 'react-gemini-scrollbar'; +import request from 'browser-request'; +import { _t } from 'matrix-react-sdk/lib/languageHandler'; +import sanitizeHtml from 'sanitize-html'; module.exports = React.createClass({ displayName: 'HomePage', propTypes: { - teamServerUrl: React.PropTypes.string.isRequired, - teamToken: React.PropTypes.string.isRequired, - collapsedRhs: React.PropTypes.bool, + // URL base of the team server. Optional. + teamServerUrl: React.PropTypes.string, + // Team token. Optional. If set, used to get the static homepage of the team + // associated. If unset, homePageUrl will be used. + teamToken: React.PropTypes.string, + // URL to use as the iFrame src. Defaults to /home.html. + homePageUrl: React.PropTypes.string, + }, + + getInitialState: function() { + return { + iframeSrc: '', + page: '', + }; + }, + + translate: function(s) { + s = sanitizeHtml(_t(s)); + // ugly fix for https://github.com/vector-im/riot-web/issues/4243 + s = s.replace(/Riot\.im/, 'Riot.im'); + s = s.replace(/\[matrix\]/, '[matrix]'); + return s; + }, + + componentWillMount: function() { + if (this.props.teamToken && this.props.teamServerUrl) { + this.setState({ + iframeSrc: `${this.props.teamServerUrl}/static/${this.props.teamToken}/home.html` + }); + } + else { + // we use request() to inline the homepage into the react component + // so that it can inherit CSS and theming easily rather than mess around + // with iframes and trying to synchronise document.stylesheets. + + let src = this.props.homePageUrl || 'home.html'; + + request( + { method: "GET", url: src }, + (err, response, body) => { + if (err || response.status < 200 || response.status >= 300) { + console.log(err); + this.setState({ page: "Couldn't load home page" }); + } + + body = body.replace(/_t\(['"]([\s\S]*?)['"]\)/mg, (match, g1)=>this.translate(g1)); + this.setState({ page: body }); + } + ); + } }, render: function() { - return ( -
-