From 7ee0efb57a39c7d5f645d5d707ae366327c0c551 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 20 Feb 2024 11:33:01 +0100 Subject: [PATCH] Add ability to set a banner to the instance --- .../about-follows.component.html | 46 +-- .../about-instance.component.html | 322 +++++++++--------- .../about-instance.component.ts | 6 + .../about-peertube.component.html | 2 +- .../about-peertube.component.scss | 5 +- client/src/app/+about/about.component.html | 4 +- client/src/app/+admin/admin.component.html | 2 +- .../edit-custom-config.component.scss | 7 +- .../edit-instance-information.component.html | 5 + .../edit-instance-information.component.ts | 61 +++- .../+admin/config/shared/config.service.ts | 16 + client/src/app/+home/home.component.html | 2 +- client/src/app/+home/home.component.scss | 10 + client/src/app/+home/home.component.ts | 3 +- .../video-channel-edit.component.html | 2 +- .../video-channel-update.component.ts | 8 - .../app/+my-account/my-account.component.html | 2 +- .../app/+my-library/my-library.component.html | 2 +- .../video-channels.component.scss | 4 - .../actor-banner-edit.component.html | 4 +- .../actor-banner-edit.component.ts | 5 +- .../custom-markup.service.ts | 16 + .../peertube-custom-tags/index.ts | 1 + .../instance-banner-markup.component.html | 3 + .../instance-banner-markup.component.ts | 37 ++ .../shared-custom-markup.module.ts | 7 +- client/src/sass/application.scss | 15 +- client/src/sass/class-helpers/_common.scss | 2 +- client/src/sass/class-helpers/_images.scss | 10 + client/src/sass/class-helpers/index.scss | 1 + .../custom-markup/custom-markup-data.model.ts | 18 +- packages/models/src/server/about.model.ts | 4 + .../src/server/config-command.ts | 36 ++ packages/tests/src/api/check-params/config.ts | 78 +++++ packages/tests/src/api/server/config.ts | 57 +++- server/core/controllers/api/config.ts | 59 +++- .../middlewares/validators/actor-image.ts | 9 +- server/core/models/actor/actor-image.ts | 13 +- support/doc/api/openapi.yaml | 54 +++ 39 files changed, 686 insertions(+), 252 deletions(-) create mode 100644 client/src/app/+home/home.component.scss create mode 100644 client/src/app/shared/shared-custom-markup/peertube-custom-tags/instance-banner-markup.component.html create mode 100644 client/src/app/shared/shared-custom-markup/peertube-custom-tags/instance-banner-markup.component.ts create mode 100644 client/src/sass/class-helpers/_images.scss diff --git a/client/src/app/+about/about-follows/about-follows.component.html b/client/src/app/+about/about-follows/about-follows.component.html index 37571dfa4..34427452c 100644 --- a/client/src/app/+about/about-follows/about-follows.component.html +++ b/client/src/app/+about/about-follows/about-follows.component.html @@ -1,28 +1,30 @@ -
-

Follows

+
+
+

Follows

-
-

Followers of {{ instanceName }} ({{ followersPagination.totalItems }})

+
+

Followers of {{ instanceName }} ({{ followersPagination.totalItems }})

-
{{ instanceName }} does not have followers.
+
{{ instanceName }} does not have followers.
- - {{ follower.name }} - + + {{ follower.name }} + + + +
+ +
+

Subscriptions of {{ instanceName }} ({{ followingsPagination.totalItems }})

+ +
{{ instanceName }} does not have subscriptions.
+ + + {{ following.name }} + + + +
-
- -
-

Subscriptions of {{ instanceName }} ({{ followingsPagination.totalItems }})

- -
{{ instanceName }} does not have subscriptions.
- - - {{ following.name }} - - - -
-
diff --git a/client/src/app/+about/about-instance/about-instance.component.html b/client/src/app/+about/about-instance/about-instance.component.html index 4c7504628..876f29821 100644 --- a/client/src/app/+about/about-instance/about-instance.component.html +++ b/client/src/app/+about/about-instance/about-instance.component.html @@ -1,226 +1,232 @@ -
-
+ -
-

About {{ instanceName }}

+
+
+ +
+

About {{ instanceName }}

-
- {{ category }} + Contact us +
- {{ language }} -
+
+ {{ category }} -
-
{{ shortDescription }}
+ {{ language }} +
-
This instance is dedicated to sensitive/NSFW content.
-
+
+
{{ shortDescription }}
-
- -

- ADMINISTRATORS & SUSTAINABILITY -

-
+
This instance is dedicated to sensitive/NSFW content.
+
- - - - - - - - -
- -

- INFORMATION -

-
- - - -
-
- + (click)="onClickCopyLink(anchorLink)" + >

- MODERATION + ADMINISTRATORS & SUSTAINABILITY

-
-
+ - diff --git a/client/src/app/+about/about-instance/about-instance.component.ts b/client/src/app/+about/about-instance/about-instance.component.ts index 85e973d7b..e22352eea 100644 --- a/client/src/app/+about/about-instance/about-instance.component.ts +++ b/client/src/app/+about/about-instance/about-instance.component.ts @@ -20,6 +20,8 @@ export class AboutInstanceComponent implements OnInit, AfterViewChecked { aboutHTML: AboutHTML descriptionElement: HTMLDivElement + instanceBannerUrl: string + languages: string[] = [] categories: string[] = [] shortDescription = '' @@ -64,6 +66,10 @@ export class AboutInstanceComponent implements OnInit, AfterViewChecked { this.shortDescription = about.instance.shortDescription + this.instanceBannerUrl = about.instance.banners.length !== 0 + ? about.instance.banners[0].path + : undefined + this.serverConfig = this.serverService.getHTMLConfig() this.route.data.subscribe(data => { diff --git a/client/src/app/+about/about-peertube/about-peertube.component.html b/client/src/app/+about/about-peertube/about-peertube.component.html index d1c3c678a..a066f0e46 100644 --- a/client/src/app/+about/about-peertube/about-peertube.component.html +++ b/client/src/app/+about/about-peertube/about-peertube.component.html @@ -1,4 +1,4 @@ -
+

This website is powered by PeerTube

diff --git a/client/src/app/+about/about-peertube/about-peertube.component.scss b/client/src/app/+about/about-peertube/about-peertube.component.scss index a81bb8cfc..11a5f2df6 100644 --- a/client/src/app/+about/about-peertube/about-peertube.component.scss +++ b/client/src/app/+about/about-peertube/about-peertube.component.scss @@ -1,9 +1,10 @@ @use '_variables' as *; @use '_mixins' as *; -.root { +.margin-content { max-width: 1200px; - margin: auto; + margin-inline-start: auto; + margin-inline-end: auto; } .card { diff --git a/client/src/app/+about/about.component.html b/client/src/app/+about/about.component.html index cf302e061..149a999fa 100644 --- a/client/src/app/+about/about.component.html +++ b/client/src/app/+about/about.component.html @@ -1,5 +1,5 @@
-