diff options
author | Chocobozzz <me@florianbigard.com> | 2022-01-20 09:35:06 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-01-20 09:35:06 +0100 |
commit | 071f3e519cbd3184b59ee728fe96c5c29b7792b9 (patch) | |
tree | 2c3f9e678833a7ed8947b718d55a36b4304b94bc /client | |
parent | 4abc7b053ae6f3f5499c27a71d464f7f389711e9 (diff) | |
download | PeerTube-071f3e519cbd3184b59ee728fe96c5c29b7792b9.tar.gz PeerTube-071f3e519cbd3184b59ee728fe96c5c29b7792b9.tar.zst PeerTube-071f3e519cbd3184b59ee728fe96c5c29b7792b9.zip |
Plugins can add custom instance infobox
Diffstat (limited to 'client')
4 files changed, 28 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 @@ | |||
85 | </div> | 85 | </div> |
86 | 86 | ||
87 | <div #instanceInformation class="instance-information"> | 87 | <div #instanceInformation class="instance-information"> |
88 | <my-instance-about-accordion (init)="onInstanceAboutAccordionInit($event)" [panels]="instanceInformationPanels"></my-instance-about-accordion> | 88 | <my-instance-about-accordion |
89 | (init)="onInstanceAboutAccordionInit($event)" [panels]="instanceInformationPanels" | ||
90 | pluginScope="login" pluginHook="filter:login.instance-about-plugin-panels.create.result" | ||
91 | ></my-instance-about-accordion> | ||
89 | </div> | 92 | </div> |
90 | </div> | 93 | </div> |
91 | </ng-container> | 94 | </ng-container> |
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 @@ | |||
17 | <my-custom-stepper linear *ngIf="!signupDone"> | 17 | <my-custom-stepper linear *ngIf="!signupDone"> |
18 | <cdk-step [stepControl]="formStepTerms" i18n-label="Stepper label for the registration page describing terms of service" label="Terms"> | 18 | <cdk-step [stepControl]="formStepTerms" i18n-label="Stepper label for the registration page describing terms of service" label="Terms"> |
19 | <div class="instance-information"> | 19 | <div class="instance-information"> |
20 | <my-instance-about-accordion (init)="onInstanceAboutAccordionInit($event)" [panels]="instanceInformationPanels"></my-instance-about-accordion> | 20 | <my-instance-about-accordion |
21 | (init)="onInstanceAboutAccordionInit($event)" [panels]="instanceInformationPanels" | ||
22 | pluginScope="signup" pluginHook="filter:signup.instance-about-plugin-panels.create.result" | ||
23 | ></my-instance-about-accordion> | ||
21 | </div> | 24 | </div> |
22 | 25 | ||
23 | <my-register-step-terms | 26 | <my-register-step-terms |
diff --git a/client/src/app/shared/shared-instance/instance-about-accordion.component.html b/client/src/app/shared/shared-instance/instance-about-accordion.component.html index e91e44656..73e511d1c 100644 --- a/client/src/app/shared/shared-instance/instance-about-accordion.component.html +++ b/client/src/app/shared/shared-instance/instance-about-accordion.component.html | |||
@@ -49,5 +49,11 @@ | |||
49 | <div class="block" [innerHTML]="aboutHtml.codeOfConduct"></div> | 49 | <div class="block" [innerHTML]="aboutHtml.codeOfConduct"></div> |
50 | </ng-template> | 50 | </ng-template> |
51 | </ngb-panel> | 51 | </ngb-panel> |
52 | |||
53 | <ngb-panel *ngFor="let pluginPanel of pluginPanels" [id]="pluginPanel.id" [title]="pluginPanel.title"> | ||
54 | <ng-template ngbPanelContent> | ||
55 | <div class="block" [innerHTML]="pluginPanel.html"></div> | ||
56 | </ng-template> | ||
57 | </ngb-panel> | ||
52 | </ng-container> | 58 | </ng-container> |
53 | </ngb-accordion> | 59 | </ngb-accordion> |
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 @@ | |||
1 | import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' | 1 | import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' |
2 | import { HooksService, Notifier } from '@app/core' | ||
2 | import { NgbAccordion } from '@ng-bootstrap/ng-bootstrap' | 3 | import { NgbAccordion } from '@ng-bootstrap/ng-bootstrap' |
3 | import { InstanceService } from './instance.service' | 4 | import { ClientFilterHookName, PluginClientScope } from '@shared/models/plugins' |
4 | import { Notifier } from '@app/core' | ||
5 | import { About } from '@shared/models/server' | 5 | import { About } from '@shared/models/server' |
6 | import { InstanceService } from './instance.service' | ||
6 | 7 | ||
7 | @Component({ | 8 | @Component({ |
8 | selector: 'my-instance-about-accordion', | 9 | selector: 'my-instance-about-accordion', |
@@ -11,8 +12,12 @@ import { About } from '@shared/models/server' | |||
11 | }) | 12 | }) |
12 | export class InstanceAboutAccordionComponent implements OnInit { | 13 | export class InstanceAboutAccordionComponent implements OnInit { |
13 | @ViewChild('accordion', { static: true }) accordion: NgbAccordion | 14 | @ViewChild('accordion', { static: true }) accordion: NgbAccordion |
15 | |||
14 | @Output() init: EventEmitter<InstanceAboutAccordionComponent> = new EventEmitter<InstanceAboutAccordionComponent>() | 16 | @Output() init: EventEmitter<InstanceAboutAccordionComponent> = new EventEmitter<InstanceAboutAccordionComponent>() |
15 | 17 | ||
18 | @Input() pluginScope: PluginClientScope | ||
19 | @Input() pluginHook: ClientFilterHookName | ||
20 | |||
16 | @Input() panels = { | 21 | @Input() panels = { |
17 | features: true, | 22 | features: true, |
18 | administrators: true, | 23 | administrators: true, |
@@ -29,12 +34,15 @@ export class InstanceAboutAccordionComponent implements OnInit { | |||
29 | administrator: '' | 34 | administrator: '' |
30 | } | 35 | } |
31 | 36 | ||
37 | pluginPanels: { id: string, title: string, html: string }[] = [] | ||
38 | |||
32 | constructor ( | 39 | constructor ( |
33 | private instanceService: InstanceService, | 40 | private instanceService: InstanceService, |
34 | private notifier: Notifier | 41 | private notifier: Notifier, |
42 | private hookService: HooksService | ||
35 | ) { } | 43 | ) { } |
36 | 44 | ||
37 | ngOnInit (): void { | 45 | async ngOnInit () { |
38 | this.instanceService.getAbout() | 46 | this.instanceService.getAbout() |
39 | .subscribe({ | 47 | .subscribe({ |
40 | next: async about => { | 48 | next: async about => { |
@@ -47,6 +55,8 @@ export class InstanceAboutAccordionComponent implements OnInit { | |||
47 | 55 | ||
48 | error: err => this.notifier.error(err.message) | 56 | error: err => this.notifier.error(err.message) |
49 | }) | 57 | }) |
58 | |||
59 | this.pluginPanels = await this.hookService.wrapObject([], this.pluginScope, this.pluginHook) | ||
50 | } | 60 | } |
51 | 61 | ||
52 | getAdministratorsPanel () { | 62 | getAdministratorsPanel () { |