diff --git a/.github/ISSUE_TEMPLATE/redesign_issue.md b/.github/ISSUE_TEMPLATE/redesign_issue.md deleted file mode 100644 index 162d0a1285..0000000000 --- a/.github/ISSUE_TEMPLATE/redesign_issue.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -name: Redesign Issue -about: Bugs, feedback or feature requests specifically associated with the Redesign - project (https://riot.im/experimental) -title: '' -labels: redesign -assignees: '' - ---- - - - -- **Browser**: Chrome, Safari, Firefox? which version? -- **OS**: Windows, macOS, Ubuntu, Arch Linux, etc? - -### Description - -Describe here the problem that you are experiencing, or the feature you are requesting. -Include screenshots if possible: you can drag and drop images below. - -### Steps to reproduce - -- For bugs, list the steps -- that reproduce the bug -- using hyphens as bullet points - -Describe how what happens differs from what you expected. - -Log: sent/not sent? diff --git a/CHANGELOG.md b/CHANGELOG.md index ba5de17582..522b7f5b36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,113 @@ +Changes in [1.0.1](https://github.com/vector-im/riot-web/releases/tag/v1.0.1) (2019-02-15) +========================================================================================== +[Full Changelog](https://github.com/vector-im/riot-web/compare/v1.0.0...v1.0.1) + + +Changes in [1.0.0](https://github.com/vector-im/riot-web/releases/tag/v1.0.0) (2019-02-14) +========================================================================================== +[Full Changelog](https://github.com/vector-im/riot-web/compare/v1.0.0-rc.2...v1.0.0) + + * Add snipping lines to welcome page without guests + [\#8634](https://github.com/vector-im/riot-web/pull/8634) + * Add home page to fix loading tests + [\#8625](https://github.com/vector-im/riot-web/pull/8625) + +Changes in [1.0.0-rc.2](https://github.com/vector-im/riot-web/releases/tag/v1.0.0-rc.2) (2019-02-14) +==================================================================================================== +[Full Changelog](https://github.com/vector-im/riot-web/compare/v1.0.0-rc.1...v1.0.0-rc.2) + + * Update from Weblate. + [\#8615](https://github.com/vector-im/riot-web/pull/8615) + * Replace favicon assets to ones with transparent backgrounds + [\#8600](https://github.com/vector-im/riot-web/pull/8600) + * Refreshed icons + [\#8594](https://github.com/vector-im/riot-web/pull/8594) + * Fix order of fetch-develop-deps / npm install + [\#8566](https://github.com/vector-im/riot-web/pull/8566) + * Revive building dark theme + [\#8540](https://github.com/vector-im/riot-web/pull/8540) + * Update from Weblate. + [\#8546](https://github.com/vector-im/riot-web/pull/8546) + * Repair app loading tests after welcome page + [\#8525](https://github.com/vector-im/riot-web/pull/8525) + * Support configurable welcome background and logo + [\#8528](https://github.com/vector-im/riot-web/pull/8528) + * Update from Weblate. + [\#8518](https://github.com/vector-im/riot-web/pull/8518) + * Document `embeddedPages` configuration + [\#8514](https://github.com/vector-im/riot-web/pull/8514) + * README.md : Syntax Coloring + [\#8502](https://github.com/vector-im/riot-web/pull/8502) + +Changes in [1.0.0-rc.1](https://github.com/vector-im/riot-web/releases/tag/v1.0.0-rc.1) (2019-02-08) +==================================================================================================== +[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.17.9...v1.0.0-rc.1) + + * Update from Weblate. + [\#8475](https://github.com/vector-im/riot-web/pull/8475) + * Add configurable welcome page + [\#8466](https://github.com/vector-im/riot-web/pull/8466) + * fix app tests after force enabling lazy loading + removing feature flag + [\#8464](https://github.com/vector-im/riot-web/pull/8464) + * Allow Electron to zoom with CommandOrControl+= + [\#8381](https://github.com/vector-im/riot-web/pull/8381) + * Hide sign in / create account for logged in users + [\#8368](https://github.com/vector-im/riot-web/pull/8368) + * Fix home page link target + [\#8365](https://github.com/vector-im/riot-web/pull/8365) + * Add auth background image and update Riot logo + [\#8364](https://github.com/vector-im/riot-web/pull/8364) + * New homepage + [\#8363](https://github.com/vector-im/riot-web/pull/8363) + * Spell homeserver correctly + [\#8358](https://github.com/vector-im/riot-web/pull/8358) + * Merge redesign into develop + [\#8321](https://github.com/vector-im/riot-web/pull/8321) + * Disable room directory test because it doesn't work + [\#8318](https://github.com/vector-im/riot-web/pull/8318) + * Tweak auth overflow on Windows and Linux + [\#8307](https://github.com/vector-im/riot-web/pull/8307) + * Clean up Custom Server Help dialog + [\#8296](https://github.com/vector-im/riot-web/pull/8296) + * Cache-bust olm.wasm + [\#8283](https://github.com/vector-im/riot-web/pull/8283) + * Completely disable other themes for now (#8277) + [\#8280](https://github.com/vector-im/riot-web/pull/8280) + * Remove support for team servers + [\#8271](https://github.com/vector-im/riot-web/pull/8271) + * Add target="_blank" to footer links + [\#8248](https://github.com/vector-im/riot-web/pull/8248) + * Fix device names on desktop + [\#8241](https://github.com/vector-im/riot-web/pull/8241) + * Fix literal </> in notifications + [\#8238](https://github.com/vector-im/riot-web/pull/8238) + * Fix registration nextLink on desktop + [\#8239](https://github.com/vector-im/riot-web/pull/8239) + * Add returns to fetch-develop-deps + [\#8233](https://github.com/vector-im/riot-web/pull/8233) + * Update electron builder + [\#8231](https://github.com/vector-im/riot-web/pull/8231) + * Try fetching more branches for PRs + [\#8225](https://github.com/vector-im/riot-web/pull/8225) + * Use content hashing for font and image URLs + [\#8159](https://github.com/vector-im/riot-web/pull/8159) + * Develop->Experimental + [\#8156](https://github.com/vector-im/riot-web/pull/8156) + * Update from Weblate. + [\#8150](https://github.com/vector-im/riot-web/pull/8150) + * Correct the copying of e-mail addresses in the electron app + [\#8124](https://github.com/vector-im/riot-web/pull/8124) + * Start documenting keyboard shortcuts + [\#7165](https://github.com/vector-im/riot-web/pull/7165) + * Update issue templates + [\#7948](https://github.com/vector-im/riot-web/pull/7948) + * Added new colour var to all themes + [\#7927](https://github.com/vector-im/riot-web/pull/7927) + * Redesign: apply changes from dharma theme to status theme + [\#7541](https://github.com/vector-im/riot-web/pull/7541) + * Redesign: ignore setting and always show dharma theme for now + [\#7540](https://github.com/vector-im/riot-web/pull/7540) + Changes in [0.17.9](https://github.com/vector-im/riot-web/releases/tag/v0.17.9) (2019-01-22) ============================================================================================ [Full Changelog](https://github.com/vector-im/riot-web/compare/v0.17.9-rc.1...v0.17.9) diff --git a/README.md b/README.md index 10fef7360e..d7c7ba96eb 100644 --- a/README.md +++ b/README.md @@ -116,17 +116,24 @@ config.json You can configure the app by copying `config.sample.json` to `config.json` and customising it: -For a good example, see https://riot.im/develop/config.json +For a good example, see https://riot.im/develop/config.json. -1. `default_hs_url` is the default homeserver url. -1. `default_is_url` is the default identity server url (this is the server used - for verifying third party identifiers like email addresses). If this is blank, - registering with an email address, adding an email address to your account, - or inviting users via email address will not work. Matrix identity servers are - very simple web services which map third party identifiers (currently only email - addresses) to matrix IDs: see http://matrix.org/docs/spec/identity_service/unstable.html - for more details. Currently the only public matrix identity servers are https://matrix.org - and https://vector.im. In future identity servers will be decentralised. +1. `default_server_name` sets the default server name to use for authentication. + This will trigger Riot to ask + `https:///.well-known/matrix/client` for the homeserver and + identity server URLs to use. This is the recommended approach for setting a + default server. However, it is also possible to use the following to directly + configure each of the URLs: + * `default_hs_url` sets the default homeserver URL. + * `default_is_url` sets the default identity server URL (this is the server used + for verifying third party identifiers like email addresses). If this is blank, + registering with an email address, adding an email address to your account, + or inviting users via email address will not work. Matrix identity servers are + very simple web services which map third party identifiers (currently only email + addresses) to matrix IDs: see http://matrix.org/docs/spec/identity_service/unstable.html + for more details. Currently the only public matrix identity servers are https://matrix.org + and https://vector.im. In the future, identity servers will be decentralised. + * Riot will report an error if you accidentally configure both `default_server_name` _and_ `default_hs_url` since it's unclear which should take priority. 1. `features`: Lookup of optional features that may be `enable`d, `disable`d, or exposed to the user in the `labs` section of settings. The available optional experimental features vary from release to release. diff --git a/electron_app/package.json b/electron_app/package.json index 8d88140551..f80f3ad341 100644 --- a/electron_app/package.json +++ b/electron_app/package.json @@ -2,11 +2,12 @@ "name": "riot-web", "productName": "Riot", "main": "src/electron-main.js", - "version": "0.17.9", + "version": "1.0.1", "description": "A feature-rich client for Matrix.org", "author": "New Vector Ltd.", "dependencies": { "auto-launch": "^5.0.1", + "electron-store": "^2.0.0", "electron-window-state": "^4.1.0", "minimist": "^1.2.0", "png-to-ico": "^1.0.2" diff --git a/electron_app/src/electron-main.js b/electron_app/src/electron-main.js index 12203e7906..a86e818b92 100644 --- a/electron_app/src/electron-main.js +++ b/electron_app/src/electron-main.js @@ -35,6 +35,7 @@ const updater = require('./updater'); const { migrateFromOldOrigin } = require('./originMigrator'); const windowStateKeeper = require('electron-window-state'); +const Store = require('electron-store'); // boolean flag set whilst we are doing one-time origin migration // We only serve the origin migration script while we're actually @@ -55,8 +56,11 @@ try { // Continue with the defaults (ie. an empty config) } +const store = new Store(); + let mainWindow = null; global.appQuitting = false; +global.minimizeToTray = store.get('minimizeToTray', true); // handle uncaught errors otherwise it displays @@ -136,6 +140,12 @@ ipcMain.on('ipcCall', async function(ev, payload) { launcher.disable(); } break; + case 'getMinimizeToTrayEnabled': + ret = global.minimizeToTray; + break; + case 'setMinimizeToTrayEnabled': + store.set('minimizeToTray', global.minimizeToTray = args[0]); + break; case 'getAppVersion': ret = app.getVersion(); break; @@ -147,6 +157,7 @@ ipcMain.on('ipcCall', async function(ev, payload) { } else { mainWindow.focus(); } + break; case 'origin_migrate': migratingOrigin = true; await migrateFromOldOrigin(); @@ -262,10 +273,12 @@ app.on('ready', () => { path: absTarget, }); }, (error) => { - if (error) console.error('Failed to register protocol') + if (error) console.error('Failed to register protocol'); }); - if (vectorConfig['update_base_url']) { + if (argv['no-update']) { + console.log('Auto update disabled via command line flag "--no-update"'); + } else if (vectorConfig['update_base_url']) { console.log(`Starting auto update with base URL: ${vectorConfig['update_base_url']}`); updater.start(vectorConfig['update_base_url']); } else { @@ -331,7 +344,7 @@ app.on('ready', () => { mainWindow = global.mainWindow = null; }); mainWindow.on('close', (e) => { - if (!global.appQuitting && (tray.hasTray() || process.platform === 'darwin')) { + if (global.minimizeToTray && !global.appQuitting && (tray.hasTray() || process.platform === 'darwin')) { // On Mac, closing the window just hides it // (this is generally how single-window Mac apps // behave, eg. Mail.app) diff --git a/package-lock.json b/package-lock.json index 879800dff7..903d8ccfa2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "riot-web", - "version": "0.17.8", + "version": "1.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 30a209d58b..19cc5e6af1 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "riot-web", "productName": "Riot", "main": "electron_app/src/electron-main.js", - "version": "0.17.9", + "version": "1.0.1", "description": "A feature-rich client for Matrix.org", "author": "New Vector Ltd.", "repository": { @@ -70,8 +70,8 @@ "gemini-scrollbar": "github:matrix-org/gemini-scrollbar#b302279", "gfm.css": "^1.1.2", "highlight.js": "^9.13.1", - "matrix-js-sdk": "0.14.3", - "matrix-react-sdk": "0.14.8", + "matrix-js-sdk": "1.0.0", + "matrix-react-sdk": "1.0.1", "modernizr": "^3.6.0", "prop-types": "^15.6.2", "react": "^15.6.0", @@ -102,7 +102,7 @@ "cross-env": "^4.0.0", "css-loader": "^2.1.0", "electron-builder": "^20.38.5", - "electron-builder-squirrel-windows": "^11.6.1", + "electron-builder-squirrel-windows": "^20.38.5", "electron-devtools-installer": "^2.2.4", "emojione": "^2.2.7", "eslint": "^5.8.0", @@ -125,6 +125,7 @@ "karma-spec-reporter": "0.0.31", "karma-summary-reporter": "^1.5.1", "karma-webpack": "4.0.0-beta.0", + "loader-utils": "^1.2.3", "matrix-mock-request": "^1.2.2", "matrix-react-test-utils": "^0.2.0", "minimist": "^1.2.0", diff --git a/scripts/cleanup.sh b/scripts/cleanup.sh new file mode 100755 index 0000000000..6c174b3a66 --- /dev/null +++ b/scripts/cleanup.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# +# script to clean up the deployments made by redeploy.py for vectorwebdev and vectorwebexp +set -e + +# currently live deployment (full path) +live=`dirname $(readlink -f "$HOME/live")` + +# currently live bundle (just the name of the bundle) +live_bundle=`grep 'script src="bundles' live/index.html | sed -e 's#.*bundles/##' -e 's#/.*##'` + +# clean up 'extracted': find things which are older than 7 days, exclude the current live one, and remove +find $HOME/extracted -maxdepth 1 -type d -ctime +7 \! -path "$live" -exec rm -r {} \; + +# clean up 'bundles': ditto +find $HOME/bundles -maxdepth 1 -type d -ctime +7 \! -name "$live_bundle" -exec rm -r {} \; diff --git a/scripts/copy-res.js b/scripts/copy-res.js index cde96bc419..4a2c6707d0 100755 --- a/scripts/copy-res.js +++ b/scripts/copy-res.js @@ -1,5 +1,7 @@ #!/usr/bin/env node +const loaderUtils = require("loader-utils"); + // copies the resources into the webapp directory. // @@ -61,12 +63,6 @@ const COPY_LIST = [ ["./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'); @@ -77,8 +73,8 @@ const argv = parseArgs( process.argv.slice(2), {} ); -var watch = argv.w; -var verbose = argv.v; +const watch = argv.w; +const verbose = argv.v; function errCheck(err) { if (err) { @@ -136,39 +132,11 @@ function next(i, err) { .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'; - - // XXX: Use a debounce because for some reason if we read the language - // file immediately after the FS event is received, the file contents - // appears empty. Possibly https://github.com/nodejs/node/issues/6112 - let makeLangDebouncer; - const makeLang = () => { - if (makeLangDebouncer) { - clearTimeout(makeLangDebouncer); - } - makeLangDebouncer = setTimeout(() => { - genLangFile(source, dest); - }, 500); - }; - - [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); } @@ -195,21 +163,28 @@ function genLangFile(lang, dest) { translations = weblateToCounterpart(translations); - fs.writeFileSync(dest + lang + '.json', JSON.stringify(translations, null, 4)); + const json = JSON.stringify(translations, null, 4); + const jsonBuffer = Buffer.from(json); + const digest = loaderUtils.getHashDigest(jsonBuffer, null, null, 7); + const filename = `${lang}.${digest}.json`; + + fs.writeFileSync(dest + filename, json); if (verbose) { - console.log("Generated language file: " + lang); + console.log("Generated language file: " + filename); } + + return filename; } -function genLangList() { +function genLangList(langFileMap) { 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}; + languages[languageParts[0]] = {'fileName': langFileMap[lang.value], 'label': lang.label}; } else { - languages[normalizedLanguage] = {'fileName': lang.value + '.json', 'label': lang.label}; + languages[normalizedLanguage] = {'fileName': langFileMap[lang.value], 'label': lang.label}; } }); fs.writeFile('webapp/i18n/languages.json', JSON.stringify(languages, null, 4), function(err) { @@ -257,5 +232,50 @@ function weblateToCounterpart(inTrs) { return outTrs; } -genLangList(); +/** +watch the input files for a given language, +regenerate the file, adding its content-hashed filename to langFileMap +and regenerating languages.json with the new filename +*/ +function watchLanguage(lang, dest, langFileMap) { + const reactSdkFile = 'node_modules/matrix-react-sdk/src/i18n/strings/' + lang + '.json'; + const riotWebFile = 'src/i18n/strings/' + lang + '.json'; + + // XXX: Use a debounce because for some reason if we read the language + // file immediately after the FS event is received, the file contents + // appears empty. Possibly https://github.com/nodejs/node/issues/6112 + let makeLangDebouncer; + const makeLang = () => { + if (makeLangDebouncer) { + clearTimeout(makeLangDebouncer); + } + makeLangDebouncer = setTimeout(() => { + const filename = genLangFile(lang, dest); + langFileMap[lang]=filename; + genLangList(langFileMap); + }, 500); + }; + + [reactSdkFile, riotWebFile].forEach(function(f) { + chokidar.watch(f) + .on('add', makeLang) + .on('change', makeLang) + .on('error', errCheck); + }); +} + +// language resources +const I18N_DEST = "webapp/i18n/"; +const I18N_FILENAME_MAP = INCLUDE_LANGS.reduce((m, l) => { + const filename = genLangFile(l.value, I18N_DEST); + m[l.value] = filename; + return m; +}, {}); +genLangList(I18N_FILENAME_MAP); + +if (watch) { + INCLUDE_LANGS.forEach(l => watchLanguage(l.value, I18N_DEST, I18N_FILENAME_MAP)); +} + +// non-language resources next(0); diff --git a/scripts/electron-package.sh b/scripts/electron-package.sh index bd68d9c2cc..bffb6b00ec 100755 --- a/scripts/electron-package.sh +++ b/scripts/electron-package.sh @@ -104,10 +104,12 @@ cp $distdir/*.dmg "$pubdir/install/macos/" # Windows installers go to the dist dir because they need signing mkdir -p "$pubdir/install/win32/ia32/" -cp $distdir/win-ia32/*.exe "$projdir/electron_app/dist/unsigned/" +mkdir -p "$projdir/electron_app/dist/unsigned/ia32/" +cp $distdir/squirrel-windows-ia32/*.exe "$projdir/electron_app/dist/unsigned/ia32/" mkdir -p "$pubdir/install/win32/x64/" -cp $distdir/win/*.exe "$projdir/electron_app/dist/unsigned/" +mkdir -p "$projdir/electron_app/dist/unsigned/x64/" +cp $distdir/squirrel-windows/*.exe "$projdir/electron_app/dist/unsigned/x64/" # Packages for auto-update mkdir -p "$pubdir/update/macos" @@ -115,12 +117,12 @@ cp $distdir/*-mac.zip "$pubdir/update/macos/" echo "$vername" > "$pubdir/update/macos/latest" mkdir -p "$pubdir/update/win32/ia32/" -cp $distdir/win-ia32/*.nupkg "$pubdir/update/win32/ia32/" -cp $distdir/win-ia32/RELEASES "$pubdir/update/win32/ia32/" +cp $distdir/squirrel-windows-ia32/*.nupkg "$pubdir/update/win32/ia32/" +cp $distdir/squirrel-windows-ia32/RELEASES "$pubdir/update/win32/ia32/" mkdir -p "$pubdir/update/win32/x64/" -cp $distdir/win/*.nupkg "$pubdir/update/win32/x64/" -cp $distdir/win/RELEASES "$pubdir/update/win32/x64/" +cp $distdir/squirrel-windows/*.nupkg "$pubdir/update/win32/x64/" +cp $distdir/squirrel-windows/RELEASES "$pubdir/update/win32/x64/" # Move the debs to the main project dir's dist folder cp $distdir/*.deb "$projdir/electron_app/dist/" diff --git a/scripts/make-icons.sh b/scripts/make-icons.sh index 19e48895df..2db5293df3 100755 --- a/scripts/make-icons.sh +++ b/scripts/make-icons.sh @@ -1,4 +1,10 @@ #!/bin/bash +# +# Converts an svg logo into the various image resources required by +# the various platforms deployments. +# +# On debian-based systems you need these deps: +# apt-get install xmlstarlet python3-cairosvg icnsutils if [ $# != 1 ] then @@ -52,7 +58,23 @@ 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_app/build/icon.icns "$tmpdir/Riot.iconset" + +if [ -x "$(command -v iconutil)" ]; then + # available on macos + iconutil -c icns -o electron_app/build/icon.icns "$tmpdir/Riot.iconset" +elif [ -x "$(command -v png2icns)" ]; then + # available on linux + # png2icns is more finicky about its input than iconutil + # 1. it doesn't support a 64x64 (aka 32x32@2x) + # 2. it doesn't like duplicates (128x128@2x == 256x256) + rm "$tmpdir/Riot.iconset/icon_128x128@2x.png" + rm "$tmpdir/Riot.iconset/icon_256x256@2x.png" + rm "$tmpdir/Riot.iconset/icon_16x16@2x.png" + rm "$tmpdir/Riot.iconset/icon_32x32@2x.png" + png2icns electron_app/build/icon.icns "$tmpdir"/Riot.iconset/*png +else + echo "WARNING: Unsupported platform. Skipping icns build" +fi cp "$tmpdir/36.png" "res/vector-icons/android-chrome-36x36.png" cp "$tmpdir/48.png" "res/vector-icons/android-chrome-48x48.png" diff --git a/scripts/package.sh b/scripts/package.sh index 23d0925b05..008803cac9 100755 --- a/scripts/package.sh +++ b/scripts/package.sh @@ -14,7 +14,11 @@ else fi npm run clean -npm run build$dev +# riot-web is at `workspace`. +# matrix-react-sdk is at `workspace/node_modules/matrix-react-sdk`, but this is +# symlinked to a repo at `workspace/matrix-react-sdk`. +# To get from `workspace/matrix-react-sdk/lib` up to the lang file, we use: +RIOT_LANGUAGES_FILE="../../webapp/i18n/languages.json" npm run build$dev # include the sample config in the tarball. Arguably this should be done by # `npm run build`, but it's just too painful. diff --git a/src/vector/index.html b/src/vector/index.html index 5451ec5232..f24007c964 100644 --- a/src/vector/index.html +++ b/src/vector/index.html @@ -3,22 +3,22 @@ Riot - - - - - - - - - + + + + + + + + + - + - - + + <% for (var i=0; i < htmlWebpackPlugin.files.css.length; i++) { diff --git a/src/vector/platform/ElectronPlatform.js b/src/vector/platform/ElectronPlatform.js index 6e600cfc85..fcab36ac39 100644 --- a/src/vector/platform/ElectronPlatform.js +++ b/src/vector/platform/ElectronPlatform.js @@ -174,18 +174,30 @@ export default class ElectronPlatform extends VectorBasePlatform { return await this._ipcCall('getAppVersion'); } - supportsAutoLaunch() { + supportsAutoLaunch(): boolean { return true; } - async getAutoLaunchEnabled() { + async getAutoLaunchEnabled(): boolean { return await this._ipcCall('getAutoLaunchEnabled'); } - async setAutoLaunchEnabled(enabled) { + async setAutoLaunchEnabled(enabled: boolean): void { return await this._ipcCall('setAutoLaunchEnabled', enabled); } + supportsMinimizeToTray(): boolean { + return true; + } + + async getMinimizeToTrayEnabled(): boolean { + return await this._ipcCall('getMinimizeToTrayEnabled'); + } + + async setMinimizeToTrayEnabled(enabled: boolean): void { + return await this._ipcCall('setMinimizeToTrayEnabled', enabled); + } + async canSelfUpdate(): boolean { const feedUrl = await this._ipcCall('getUpdateFeedUrl'); return Boolean(feedUrl); diff --git a/src/vector/platform/VectorBasePlatform.js b/src/vector/platform/VectorBasePlatform.js index 602a0c27c9..cfdeeacbe4 100644 --- a/src/vector/platform/VectorBasePlatform.js +++ b/src/vector/platform/VectorBasePlatform.js @@ -88,19 +88,6 @@ export default class VectorBasePlatform extends BasePlatform { this._updateFavicon(); } - supportsAutoLaunch() { - return false; - } - - // XXX: Surely this should be a setting like any other? - async getAutoLaunchEnabled() { - return false; - } - - async setAutoLaunchEnabled(enabled) { - throw new Error("Unimplemented"); - } - /** * Begin update polling, if applicable */ diff --git a/webpack.config.js b/webpack.config.js index aba990541b..70ef0574a7 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -6,6 +6,12 @@ const HtmlWebpackPlugin = require('html-webpack-plugin'); let og_image_url = process.env.RIOT_OG_IMAGE_URL; if (!og_image_url) og_image_url = 'https://riot.im/app/themes/riot/img/logos/riot-im-logo-black-text.png'; +// relative to languageHandler.js in matrix-react-sdk +let RIOT_LANGUAGES_FILE = process.env.RIOT_LANGUAGES_FILE; +if (!RIOT_LANGUAGES_FILE) { + RIOT_LANGUAGES_FILE = "../../riot-web/webapp/i18n/languages.json"; +} + module.exports = { entry: { // Load babel-polyfill first to avoid issues where some imports (namely react) @@ -61,7 +67,17 @@ module.exports = { }), }, { - test: /\.(gif|png|svg|ttf)$/, + // cache-bust languages.json file placed in + // riot-web/webapp/i18n during build by copy-res.js + test: /\.*languages.json$/, + type: "javascript/auto", + loader: 'file-loader', + options: { + name: 'i18n/[name].[hash:7].[ext]', + }, + }, + { + test: /\.(gif|png|svg|ttf|xml|ico)$/, // Use a content-based hash in the name so that we can set a long cache // lifetime for assets while still delivering changes quickly. oneOf: [ @@ -148,8 +164,8 @@ module.exports = { 'process.env': { NODE_ENV: JSON.stringify(process.env.NODE_ENV), }, + 'LANGUAGES_FILE': JSON.stringify(RIOT_LANGUAGES_FILE), }), - new ExtractTextPlugin("bundles/[hash]/[name].css", { allChunks: true, }),