From 8139a0ff7230fbdbea8909ae00aa280a4c8e5829 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Fri, 27 Sep 2019 21:55:40 -0400 Subject: [PATCH 1/2] added pixelfed Oauth compatibility --- src/app/services/auth.service.ts | 17 +++++++++++++---- src/app/services/tools.service.ts | 6 +++++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index ec4f684a..1815696d 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -1,5 +1,5 @@ import { Injectable } from "@angular/core"; -import { HttpClient } from "@angular/common/http"; +import { HttpClient, HttpHeaders } from "@angular/common/http"; import { ApiRoutes } from './models/api.settings'; import { AppData, TokenData } from "./models/mastodon.interfaces"; @@ -17,15 +17,24 @@ export class AuthService { } getToken(instance: string, client_id: string, client_secret: string, code: string, redirect_uri: string): Promise { - const url = `https://${instance}/oauth/token?client_id=${client_id}&client_secret=${client_secret}&grant_type=authorization_code&code=${code}&redirect_uri=${encodeURIComponent(redirect_uri)}`; + const encodedRedirectUri = encodeURIComponent(redirect_uri); + const url = `https://${instance}/oauth/token?client_id=${client_id}&client_secret=${client_secret}&grant_type=authorization_code&code=${code}&redirect_uri=${encodedRedirectUri}`; - return this.httpClient.post(url, null).toPromise(); + const bodyLoad = { + 'client_id': client_id, + 'client_secret': client_secret, + 'grant_type': 'authorization_code', + 'redirect_uri': redirect_uri, + 'code': code + }; + + return this.httpClient.post(url, bodyLoad).toPromise(); } createNewApplication(instance: string, appName: string, redirectUrl: string, scopes: string, website: string): Promise { const url = 'https://' + instance + this.apiRoutes.createApp; - const formData = new FormData(); + const formData = new FormData(); formData.append('client_name', appName); formData.append('redirect_uris', redirectUrl); formData.append('scopes', scopes); diff --git a/src/app/services/tools.service.ts b/src/app/services/tools.service.ts index 356603c6..5ad49485 100644 --- a/src/app/services/tools.service.ts +++ b/src/app/services/tools.service.ts @@ -31,6 +31,8 @@ export class ToolsService { type = InstanceType.GlitchSoc; } else if (instance.version.toLowerCase().includes('+florence')) { type = InstanceType.Florence; + } else if (instance.version.toLowerCase().includes('pixelfed')) { + type = InstanceType.Pixelfed; } var splittedVersion = instance.version.split('.'); @@ -39,6 +41,7 @@ export class ToolsService { var instanceInfo = new InstanceInfo(type, major, minor); this.instanceInfos[acc.instance] = instanceInfo; + return instanceInfo; }); } @@ -171,5 +174,6 @@ export enum InstanceType { Mastodon = 1, Pleroma = 2, GlitchSoc = 3, - Florence = 4 + Florence = 4, + Pixelfed = 5 } \ No newline at end of file From f52ed00db552d47f782f48e2b7ce7ef87d5d0dfa Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Tue, 1 Oct 2019 01:40:07 -0400 Subject: [PATCH 2/2] road to 0.17.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 89533f9a..8efbae79 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sengi", - "version": "0.17.0", + "version": "0.17.1", "license": "AGPL-3.0-or-later", "main": "main-electron.js", "description": "A multi-account desktop client for Mastodon and Pleroma",