diff --git a/src/main/Client.ts b/src/main/Client.ts index 17a0be21..f6ab0303 100644 --- a/src/main/Client.ts +++ b/src/main/Client.ts @@ -12,6 +12,14 @@ export default class Clients { private static nonAuthorizedHTTP: Map = new Map() private static nonAuthorizedWebsocket: Map = new Map() + public static createAuthClient(protocol: Protocol, domain: string, accessToken: string): Mastodon { + let scheme = protocol === 'http' ? 'https://' : 'wss://' + return new Mastodon( + accessToken, + scheme + domain + '/api/v1' + ) + } + public static getNoAuthClient(domain: string, protocol: Protocol = 'http'): Mastodon { let clients = protocol === 'http' ? this.nonAuthorizedHTTP : this.nonAuthorizedWebsocket