remove dependency on url

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2020-04-13 21:36:49 +01:00
parent d914b13c1b
commit 078d6a0d98
3 changed files with 7 additions and 12 deletions

View file

@ -76,8 +76,7 @@
"react": "^16.9.0",
"react-dom": "^16.9.0",
"sanitize-html": "^1.19.1",
"ua-parser-js": "^0.7.19",
"url": "^0.11.0"
"ua-parser-js": "^0.7.19"
},
"devDependencies": {
"@babel/cli": "^7.7.5",

View file

@ -31,8 +31,6 @@ import AutoDiscoveryUtils from 'matrix-react-sdk/src/utils/AutoDiscoveryUtils';
import {AutoDiscovery} from "matrix-js-sdk/src/autodiscovery";
import * as Lifecycle from "matrix-react-sdk/src/Lifecycle";
import url from 'url';
import {parseQs, parseQsFromFragment} from './url_utils';
import {MatrixClientPeg} from 'matrix-react-sdk/src/MatrixClientPeg';
@ -118,11 +116,10 @@ function onTokenLoginCompleted() {
// if we did a token login, we're now left with the token, hs and is
// url as query params in the url; a little nasty but let's redirect to
// clear them.
const parsedUrl = url.parse(window.location.href);
const parsedUrl = new URL(window.location);
parsedUrl.search = "";
const formatted = url.format(parsedUrl);
console.log("Redirecting to " + formatted + " to drop loginToken " +
"from queryparams");
const formatted = parsedUrl.toString();
console.log("Redirecting to " + formatted + " to drop loginToken from queryparams");
window.location.href = formatted;
}

View file

@ -22,7 +22,6 @@ import request from 'browser-request';
import dis from 'matrix-react-sdk/src/dispatcher.js';
import { _t } from 'matrix-react-sdk/src/languageHandler';
import url from 'url';
import UAParser from 'ua-parser-js';
const POKE_RATE_MS = 10 * 60 * 1000; // 10 min
@ -179,15 +178,15 @@ export default class WebPlatform extends VectorBasePlatform {
getDefaultDeviceDisplayName(): string {
// strip query-string and fragment from uri
const u = url.parse(window.location.href);
const u = new URL(window.location);
u.search = "";
u.hash = "";
const appName = u.format();
const appName = u.toString();
const ua = new UAParser();
const browserName = ua.getBrowser().name || "unknown browser";
const osName = ua.getOS().name || "unknown os";
return _t('%(appName)s via %(browserName)s on %(osName)s', {appName: appName, browserName: browserName, osName: osName});
return _t('%(appName)s via %(browserName)s on %(osName)s', {appName, browserName, osName});
}
screenCaptureErrorString(): ?string {