remove dependency on `url`

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/13138/head
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": "^16.9.0",
"react-dom": "^16.9.0", "react-dom": "^16.9.0",
"sanitize-html": "^1.19.1", "sanitize-html": "^1.19.1",
"ua-parser-js": "^0.7.19", "ua-parser-js": "^0.7.19"
"url": "^0.11.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.7.5", "@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 {AutoDiscovery} from "matrix-js-sdk/src/autodiscovery";
import * as Lifecycle from "matrix-react-sdk/src/Lifecycle"; import * as Lifecycle from "matrix-react-sdk/src/Lifecycle";
import url from 'url';
import {parseQs, parseQsFromFragment} from './url_utils'; import {parseQs, parseQsFromFragment} from './url_utils';
import {MatrixClientPeg} from 'matrix-react-sdk/src/MatrixClientPeg'; 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 // 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 // url as query params in the url; a little nasty but let's redirect to
// clear them. // clear them.
const parsedUrl = url.parse(window.location.href); const parsedUrl = new URL(window.location);
parsedUrl.search = ""; parsedUrl.search = "";
const formatted = url.format(parsedUrl); const formatted = parsedUrl.toString();
console.log("Redirecting to " + formatted + " to drop loginToken " + console.log("Redirecting to " + formatted + " to drop loginToken from queryparams");
"from queryparams");
window.location.href = formatted; 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 dis from 'matrix-react-sdk/src/dispatcher.js';
import { _t } from 'matrix-react-sdk/src/languageHandler'; import { _t } from 'matrix-react-sdk/src/languageHandler';
import url from 'url';
import UAParser from 'ua-parser-js'; import UAParser from 'ua-parser-js';
const POKE_RATE_MS = 10 * 60 * 1000; // 10 min const POKE_RATE_MS = 10 * 60 * 1000; // 10 min
@ -179,15 +178,15 @@ export default class WebPlatform extends VectorBasePlatform {
getDefaultDeviceDisplayName(): string { getDefaultDeviceDisplayName(): string {
// strip query-string and fragment from uri // strip query-string and fragment from uri
const u = url.parse(window.location.href); const u = new URL(window.location);
u.search = ""; u.search = "";
u.hash = ""; u.hash = "";
const appName = u.format(); const appName = u.toString();
const ua = new UAParser(); const ua = new UAParser();
const browserName = ua.getBrowser().name || "unknown browser"; const browserName = ua.getBrowser().name || "unknown browser";
const osName = ua.getOS().name || "unknown os"; 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 { screenCaptureErrorString(): ?string {