From cf83f7367bcafe6003e668361f42cc940d5a0d18 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Fri, 31 May 2019 23:54:45 -0400 Subject: [PATCH] added a little check --- .../add-new-account.component.ts | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/app/components/floating-column/add-new-account/add-new-account.component.ts b/src/app/components/floating-column/add-new-account/add-new-account.component.ts index cfb5ad75..cfb42038 100644 --- a/src/app/components/floating-column/add-new-account/add-new-account.component.ts +++ b/src/app/components/floating-column/add-new-account/add-new-account.component.ts @@ -13,6 +13,8 @@ import { NotificationService } from '../../../services/notification.service'; styleUrls: ['./add-new-account.component.scss'] }) export class AddNewAccountComponent implements OnInit { + private blockList = ['gab.com', 'gab.ai']; + @Input() mastodonFullHandle: string; constructor( @@ -29,6 +31,8 @@ export class AddNewAccountComponent implements OnInit { const username = fullHandle[0]; const instance = fullHandle[1]; + this.checkBlockList(instance); + this.checkAndCreateApplication(instance) .then((appData: AppData) => { this.redirectToInstanceAuthPage(username, instance, appData); @@ -36,7 +40,7 @@ export class AddNewAccountComponent implements OnInit { .catch((err: HttpErrorResponse) => { if (err instanceof HttpErrorResponse) { this.notificationService.notifyHttpError(err); - } else if ((err).message === 'CORS'){ + } else if ((err).message === 'CORS') { this.notificationService.notify('Connection Error. It\'s usually a CORS issue with the server you\'re connecting to. Please check in the console and if so, contact your administrator with those informations.', true); } else { this.notificationService.notify('Unkown error', true); @@ -46,6 +50,20 @@ export class AddNewAccountComponent implements OnInit { return false; } + private checkBlockList(instance: string){ + let cleanInstance = instance.replace('http://', '').replace('https://', ''); + for (let b of this.blockList) { + if (cleanInstance == b || cleanInstance.includes(`.${b}`)) { + let content = '