diff --git a/package.json b/package.json index de533bc5..0b83a69f 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/vector/app.js b/src/vector/app.js index 930576e2..e087d8c2 100644 --- a/src/vector/app.js +++ b/src/vector/app.js @@ -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; } diff --git a/src/vector/platform/WebPlatform.js b/src/vector/platform/WebPlatform.js index 8db12856..4524d720 100644 --- a/src/vector/platform/WebPlatform.js +++ b/src/vector/platform/WebPlatform.js @@ -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 {