From 071f3e519cbd3184b59ee728fe96c5c29b7792b9 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 20 Jan 2022 09:35:06 +0100 Subject: [PATCH] Plugins can add custom instance infobox --- client/src/app/+login/login.component.html | 5 ++++- .../+signup/+register/register.component.html | 5 ++++- .../instance-about-accordion.component.html | 6 ++++++ .../instance-about-accordion.component.ts | 18 ++++++++++++++---- .../models/plugins/client/client-hook.model.ts | 3 +++ 5 files changed, 31 insertions(+), 6 deletions(-) diff --git a/client/src/app/+login/login.component.html b/client/src/app/+login/login.component.html index 531b06dc9..dc74354d8 100644 --- a/client/src/app/+login/login.component.html +++ b/client/src/app/+login/login.component.html @@ -85,7 +85,10 @@
- +
diff --git a/client/src/app/+signup/+register/register.component.html b/client/src/app/+signup/+register/register.component.html index b51f08a4c..2d0e6e865 100644 --- a/client/src/app/+signup/+register/register.component.html +++ b/client/src/app/+signup/+register/register.component.html @@ -17,7 +17,10 @@
- +
+ + + +
+
+
diff --git a/client/src/app/shared/shared-instance/instance-about-accordion.component.ts b/client/src/app/shared/shared-instance/instance-about-accordion.component.ts index 1eb7b49b6..b9f57e2a4 100644 --- a/client/src/app/shared/shared-instance/instance-about-accordion.component.ts +++ b/client/src/app/shared/shared-instance/instance-about-accordion.component.ts @@ -1,8 +1,9 @@ import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' +import { HooksService, Notifier } from '@app/core' import { NgbAccordion } from '@ng-bootstrap/ng-bootstrap' -import { InstanceService } from './instance.service' -import { Notifier } from '@app/core' +import { ClientFilterHookName, PluginClientScope } from '@shared/models/plugins' import { About } from '@shared/models/server' +import { InstanceService } from './instance.service' @Component({ selector: 'my-instance-about-accordion', @@ -11,8 +12,12 @@ import { About } from '@shared/models/server' }) export class InstanceAboutAccordionComponent implements OnInit { @ViewChild('accordion', { static: true }) accordion: NgbAccordion + @Output() init: EventEmitter = new EventEmitter() + @Input() pluginScope: PluginClientScope + @Input() pluginHook: ClientFilterHookName + @Input() panels = { features: true, administrators: true, @@ -29,12 +34,15 @@ export class InstanceAboutAccordionComponent implements OnInit { administrator: '' } + pluginPanels: { id: string, title: string, html: string }[] = [] + constructor ( private instanceService: InstanceService, - private notifier: Notifier + private notifier: Notifier, + private hookService: HooksService ) { } - ngOnInit (): void { + async ngOnInit () { this.instanceService.getAbout() .subscribe({ next: async about => { @@ -47,6 +55,8 @@ export class InstanceAboutAccordionComponent implements OnInit { error: err => this.notifier.error(err.message) }) + + this.pluginPanels = await this.hookService.wrapObject([], this.pluginScope, this.pluginHook) } getAdministratorsPanel () { diff --git a/shared/models/plugins/client/client-hook.model.ts b/shared/models/plugins/client/client-hook.model.ts index 7dd8bc507..bb55e92d5 100644 --- a/shared/models/plugins/client/client-hook.model.ts +++ b/shared/models/plugins/client/client-hook.model.ts @@ -65,6 +65,9 @@ export const clientFilterHookObject = { // Filter upload page alert messages 'filter:upload.messages.create.result': true, + 'filter:login.instance-about-plugin-panels.create.result': true, + 'filter:signup.instance-about-plugin-panels.create.result': true, + // Filter videojs options built for PeerTube player 'filter:internal.player.videojs.options.result': true }