Support changing your integration manager in the UI

Part of https://github.com/vector-im/riot-web/issues/10161
This commit is contained in:
Travis Ralston 2019-08-12 15:35:39 -06:00
parent e21c12c2c9
commit 03d735f4ed
8 changed files with 289 additions and 4 deletions

View file

@ -19,12 +19,18 @@ import sdk from "../index";
import {dialogTermsInteractionCallback, TermsNotSignedError} from "../Terms";
import type {Room} from "matrix-js-sdk";
import Modal from '../Modal';
import url from 'url';
export const KIND_ACCOUNT = "account";
export const KIND_CONFIG = "config";
export class IntegrationManagerInstance {
apiUrl: string;
uiUrl: string;
kind: string;
constructor(apiUrl: string, uiUrl: string) {
constructor(kind: string, apiUrl: string, uiUrl: string) {
this.kind = kind;
this.apiUrl = apiUrl;
this.uiUrl = uiUrl;
@ -32,6 +38,11 @@ export class IntegrationManagerInstance {
if (!this.uiUrl) this.uiUrl = this.apiUrl;
}
get name(): string {
const parsed = url.parse(this.uiUrl);
return parsed.hostname;
}
getScalarClient(): ScalarAuthClient {
return new ScalarAuthClient(this.apiUrl, this.uiUrl);
}