Support changing your integration manager in the UI
Part of https://github.com/vector-im/riot-web/issues/10161
This commit is contained in:
parent
e21c12c2c9
commit
03d735f4ed
8 changed files with 289 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue