Remove url npm dependency and use Web URL constructor (#10930)

This commit is contained in:
Michael Telatynski
2023-05-17 12:50:00 +01:00
committed by GitHub
parent 7917d973e7
commit 2da199c41d
13 changed files with 101 additions and 53 deletions
@@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import url from "url";
import { ComponentProps } from "react";
import { logger } from "matrix-js-sdk/src/logger";
@@ -25,6 +24,7 @@ import Modal from "../Modal";
import SettingsStore from "../settings/SettingsStore";
import IntegrationManager from "../components/views/settings/IntegrationManager";
import { IntegrationManagers } from "./IntegrationManagers";
import { parseUrl } from "../utils/UrlUtils";
export enum Kind {
Account = "account",
@@ -42,15 +42,14 @@ export class IntegrationManagerInstance {
) {}
public get name(): string {
const parsed = url.parse(this.uiUrl);
const parsed = parseUrl(this.uiUrl);
return parsed.host ?? "";
}
public get trimmedApiUrl(): string {
const parsed = url.parse(this.apiUrl);
const parsed = parseUrl(this.apiUrl);
parsed.pathname = "";
parsed.path = "";
return url.format(parsed);
return parsed.toString();
}
public getScalarClient(): ScalarAuthClient {