From f32e28b9144f0c0f4b9057767aaf1e4d058cfd5b Mon Sep 17 00:00:00 2001 From: kPherox Date: Sat, 27 Apr 2019 18:43:06 +0900 Subject: [PATCH] Add client creater for authorized account --- src/main/Client.ts | 8 ++++++++ 1 file changed, 8 insertions(+) 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