Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop rebase #10

Merged
merged 19 commits into from
Oct 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
d256194
Document how to turn off Piwik and bug reports (#6738)
aaronraimist Oct 2, 2018
ad5be45
Fix reskindex on matrix-react-side not being called if using build sc…
MTRNord Oct 3, 2018
eabcc92
Add text saying that bug reports aren't automatic
aaronraimist Oct 3, 2018
92b2980
Merge pull request #7435 from aaronraimist/patch-1
turt2live Oct 3, 2018
a356264
Fix double-closed tags
dbkr Oct 4, 2018
4d3df8b
Merge pull request #7454 from vector-im/dbkr/double_closing_tags
bwindels Oct 4, 2018
3286acd
Use HTTPS cloning for riot-web too
turt2live Oct 4, 2018
a9e98e6
Merge pull request #7443 from MTRNord/patch-9
turt2live Oct 4, 2018
bccccb2
Silence bluebird warnings
dbkr Oct 5, 2018
e28180f
Merge pull request #7462 from vector-im/dbkr/gone_away_is_the_bluebird
dbkr Oct 5, 2018
4e6f48d
Disable webpack-dev-server auto reload
dbkr Oct 5, 2018
d4576dc
Merge pull request #7463 from vector-im/dbkr/disable_auto_reload
bwindels Oct 5, 2018
b09aa2c
Merge pull request #7459 from vector-im/travis/https-clone
turt2live Oct 5, 2018
a5fb33d
Fix Promise.defer warnings in getconfig.js (#7409)
aaronraimist Oct 3, 2018
54c46df
Fix Promise.defer warnings in index.js (#7409)
aaronraimist Oct 3, 2018
401c85a
Fix Promise.defer warnings in WebPlatform.js (#7409)
aaronraimist Oct 3, 2018
d035efb
Fix lint warnings and turn warnings back on (#7409)
aaronraimist Oct 5, 2018
d836ad8
Undo turning warnings back on (#7409)
aaronraimist Oct 5, 2018
92db2b8
Merge pull request #7444 from aaronraimist/promise-defer
turt2live Oct 9, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ to build.
npm install
npm run build
```
Or just use https://riot.im/develop - the continuous integration release of the
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`.
Expand Down Expand Up @@ -134,7 +134,9 @@ For a good example, see https://riot.im/develop/config.json
1. `integrations_rest_url`: URL to the REST interface for the integrations server.
1. `integrations_widgets_urls`: list of URLs to the REST interface for the widget integrations server.
1. `bug_report_endpoint_url`: endpoint to send bug reports to (must be running a
https://github.com/matrix-org/rageshake server)
https://github.com/matrix-org/rageshake server). Bug reports are sent when a user clicks
"Send Logs" within the application. Bug reports can be disabled by leaving the
`bug_report_endpoint_url` out of your config file.
1. `roomDirectory`: config for the public room directory. This section is optional.
1. `roomDirectory.servers`: List of other homeservers' directories to include in the drop
down list. Optional.
Expand All @@ -147,11 +149,13 @@ For a good example, see https://riot.im/develop/config.json
anything else since it is used to isolate the privileges of file attachments to this
domain. Default: `https://usercontent.riot.im/v1.html`. This needs to contain v1.html from
https://github.com/matrix-org/usercontent/blob/master/v1.html
1. `piwik`: an object containing the following properties:
1. `url`: The URL of the Piwik instance to use for collecting Analytics
1. `whitelistedHSUrls`: a list of HS URLs to not redact from the Analytics
1. `whitelistedISUrls`: a list of IS URLs to not redact from the Analytics
1. `siteId`: The Piwik Site ID to use when sending Analytics to the Piwik server configured above
1. `piwik`: Analytics can be disabled by setting `piwik: false` or by leaving the piwik config
option out of your config file. If you want to enable analytics, set `piwik` to be an object
containing the following properties:
1. `url`: The URL of the Piwik instance to use for collecting analytics
1. `whitelistedHSUrls`: a list of HS URLs to not redact from the analytics
1. `whitelistedISUrls`: a list of IS URLs to not redact from the analytics
1. `siteId`: The Piwik Site ID to use when sending analytics to the Piwik server configured above
1. `teamServerConfig`, `teamTokenMap`, `referralBaseUrl`: an obsolete precursor to communities
with referral tracking; please ignore it.
1. `welcomeUserId`: the user ID of a bot to invite whenever users register that can give them a tour
Expand Down Expand Up @@ -270,7 +274,7 @@ Then similarly with `matrix-react-sdk`:

Finally, build and start Riot itself:

1. `git clone git@github.com:vector-im/riot-web.git`
1. `git clone https://github.com/vector-im/riot-web.git`
1. `cd riot-web`
1. `git checkout develop`
1. `npm install`
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"build:bundle": "cross-env NODE_ENV=production webpack-cli -p --progress --bail --mode production",
"build:bundle:dev": "webpack-cli --progress --bail --mode development",
"build:electron": "npm run clean && npm run build && npm run install:electron && build -wml --ia32 --x64",
"build:react-sdk": "node scripts/npm-sub.js matrix-react-sdk run start:init",
"build:react-sdk": "node scripts/npm-sub.js matrix-react-sdk run build",
"build:js-sdk": "node scripts/npm-sub.js matrix-js-sdk run start:init",
"build": "npm run build:js-sdk && npm run build:react-sdk && npm run reskindex && npm run build:res && npm run build:bundle",
"build:dev": "npm run build:js-sdk && npm run build:react-sdk && npm run reskindex && npm run build:res && npm run build:bundle:dev",
Expand Down
54 changes: 26 additions & 28 deletions src/vector/getconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,35 +33,33 @@ export async function getVectorConfig(relativeLocation) {
}

function getConfig(configJsonFilename) {
let deferred = Promise.defer();

request(
{ method: "GET", url: configJsonFilename },
(err, response, body) => {
if (err || response.status < 200 || response.status >= 300) {
// Lack of a config isn't an error, we should
// just use the defaults.
// Also treat a blank config as no config, assuming
// the status code is 0, because we don't get 404s
// from file: URIs so this is the only way we can
// not fail if the file doesn't exist when loading
// from a file:// URI.
if (response) {
if (response.status == 404 || (response.status == 0 && body == '')) {
deferred.resolve({});
return new Promise(function(resolve, reject) {
request(
{ method: "GET", url: configJsonFilename },
(err, response, body) => {
if (err || response.status < 200 || response.status >= 300) {
// Lack of a config isn't an error, we should
// just use the defaults.
// Also treat a blank config as no config, assuming
// the status code is 0, because we don't get 404s
// from file: URIs so this is the only way we can
// not fail if the file doesn't exist when loading
// from a file:// URI.
if (response) {
if (response.status == 404 || (response.status == 0 && body == '')) {
resolve({});
}
}
reject({err: err, response: response});
return;
}
deferred.reject({err: err, response: response});
return;
}

// We parse the JSON ourselves rather than use the JSON
// parameter, since this throws a parse error on empty
// which breaks if there's no config.json and we're
// loading from the filesystem (see above).
deferred.resolve(JSON.parse(body));
}
);

return deferred.promise;
// We parse the JSON ourselves rather than use the JSON
// parameter, since this throws a parse error on empty
// which breaks if there's no config.json and we're
// loading from the filesystem (see above).
resolve(JSON.parse(body));
},
);
});
}
2 changes: 1 addition & 1 deletion src/vector/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,6 @@
</audio>
<audio id="remoteAudio"></audio>
<!-- let CSS themes pass constants to the app -->
<div id="mx_theme_accentColor"></div><div id="mx_theme_secondaryAccentColor"/></div><div id="mx_theme_tertiaryAccentColor"/></div>
<div id="mx_theme_accentColor"></div><div id="mx_theme_secondaryAccentColor"></div><div id="mx_theme_tertiaryAccentColor"></div>
</body>
</html>
58 changes: 30 additions & 28 deletions src/vector/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ import {getVectorConfig} from './getconfig';

let lastLocationHashSet = null;

// Disable warnings for now: we use deprecated bluebird functions
// and need to migrate, but they spam the console with warnings.
Promise.config({warnings: false});

function initRageshake() {
rageshake.init().then(() => {
console.log("Initialised rageshake: See https://bugs.chromium.org/p/chromium/issues/detail?id=583193 to fix line numbers on Chrome.");
Expand Down Expand Up @@ -175,37 +179,35 @@ function makeRegistrationUrl(params) {
}

function getConfig(configJsonFilename) {
let deferred = Promise.defer();

request(
{ method: "GET", url: configJsonFilename },
(err, response, body) => {
if (err || response.status < 200 || response.status >= 300) {
// Lack of a config isn't an error, we should
// just use the defaults.
// Also treat a blank config as no config, assuming
// the status code is 0, because we don't get 404s
// from file: URIs so this is the only way we can
// not fail if the file doesn't exist when loading
// from a file:// URI.
if (response) {
if (response.status == 404 || (response.status == 0 && body == '')) {
deferred.resolve({});
return new Promise(function(resolve, reject) {
request(
{ method: "GET", url: configJsonFilename },
(err, response, body) => {
if (err || response.status < 200 || response.status >= 300) {
// Lack of a config isn't an error, we should
// just use the defaults.
// Also treat a blank config as no config, assuming
// the status code is 0, because we don't get 404s
// from file: URIs so this is the only way we can
// not fail if the file doesn't exist when loading
// from a file:// URI.
if (response) {
if (response.status == 404 || (response.status == 0 && body == '')) {
resolve({});
}
}
reject({err: err, response: response});
return;
}
deferred.reject({err: err, response: response});
return;
}

// We parse the JSON ourselves rather than use the JSON
// parameter, since this throws a parse error on empty
// which breaks if there's no config.json and we're
// loading from the filesystem (see above).
deferred.resolve(JSON.parse(body));
}
);

return deferred.promise;
// We parse the JSON ourselves rather than use the JSON
// parameter, since this throws a parse error on empty
// which breaks if there's no config.json and we're
// loading from the filesystem (see above).
resolve(JSON.parse(body));
},
);
});
}

function onTokenLoginCompleted() {
Expand Down
48 changes: 24 additions & 24 deletions src/vector/platform/WebPlatform.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ export default class WebPlatform extends VectorBasePlatform {
// annoyingly, the latest spec says this returns a
// promise, but this is only supported in Chrome 46
// and Firefox 47, so adapt the callback API.
const defer = Promise.defer();
global.Notification.requestPermission((result) => {
defer.resolve(result);
return new Promise(function(resolve, reject) {
global.Notification.requestPermission((result) => {
resolve(result);
});
});
return defer.promise;
}

displayNotification(title: string, msg: string, avatarUrl: string, room: Object) {
Expand Down Expand Up @@ -103,31 +103,31 @@ export default class WebPlatform extends VectorBasePlatform {
}

_getVersion(): Promise<string> {
const deferred = Promise.defer();

// We add a cachebuster to the request to make sure that we know about
// the most recent version on the origin server. That might not
// actually be the version we'd get on a reload (particularly in the
// presence of intermediate caching proxies), but still: we're trying
// to tell the user that there is a new version.
request(
{
method: "GET",
url: "version",
qs: { cachebuster: Date.now() },
},
(err, response, body) => {
if (err || response.status < 200 || response.status >= 300) {
if (err === null) err = { status: response.status };
deferred.reject(err);
return;
}

const ver = body.trim();
deferred.resolve(ver);
},
);
return deferred.promise;

return new Promise(function(resolve, reject) {
request(
{
method: "GET",
url: "version",
qs: { cachebuster: Date.now() },
},
(err, response, body) => {
if (err || response.status < 200 || response.status >= 300) {
if (err === null) err = { status: response.status };
reject(err);
return;
}

const ver = body.trim();
resolve(ver);
},
);
});
}

getAppVersion(): Promise<string> {
Expand Down
6 changes: 6 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@ module.exports = {
// don't fill the console up with a mahoosive list of modules
chunks: false,
},

// hot mdule replacement doesn't work (I think we'd need react-hot-reload?)
// so webpack-dev-server reloads the page on every update which is quite
// tedious in Riot since that can take a while.
hot: false,
inline: false,
},
};

Expand Down