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/src/app/shared/shared-instance | |
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/src/app/shared/shared-instance')
-rw-r--r-- | client/src/app/shared/shared-instance/instance-about-accordion.component.html | 6 | ||||
-rw-r--r-- | client/src/app/shared/shared-instance/instance-about-accordion.component.ts | 18 |
2 files changed, 20 insertions, 4 deletions
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 () { |