Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Add local videos homepage

Chocobozzz54aad475b092
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts
index 4fe9c9ccbe..80503afb35 100644
--- a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts
+++ b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts
@@ -165,7 +165,8 @@ export class EditBasicConfigurationComponent implements OnInit, OnChanges {
links = links.concat([
{ label: $localize`Discover`, path: '/videos/overview' },
- { label: $localize`Browse videos`, path: '/videos/browse' }
+ { label: $localize`Browse all videos`, path: '/videos/browse' },
+ { label: $localize`Browse local videos`, path: '/videos/browse?scope=local' }
])
this.defaultLandingPageOptions = links.map(o => ({
diff --git a/client/src/app/core/routing/redirect.service.ts b/client/src/app/core/routing/redirect.service.ts
index 23f77c6fd6..5be4a96d67 100644
--- a/client/src/app/core/routing/redirect.service.ts
+++ b/client/src/app/core/routing/redirect.service.ts
@@ -67,7 +67,11 @@ export class RedirectService {
}
getDefaultRoute () {
- return this.defaultRoute
+ return this.defaultRoute.split('?')[0]
+ }
+
+ getDefaultRouteQuery () {
+ return this.router.parseUrl(this.defaultRoute).queryParams
}
getDefaultTrendingSort () {
diff --git a/client/src/app/header/header.component.ts b/client/src/app/header/header.component.ts
index 08b1eab8ba..768ad1e10a 100644
--- a/client/src/app/header/header.component.ts
+++ b/client/src/app/header/header.component.ts
@@ -138,11 +138,11 @@ export class HeaderComponent implements OnInit, OnDestroy {
// ---------------------------------------------------------------------------
getDefaultRoute () {
- return this.redirectService.getDefaultRoute().split('?')[0]
+ return this.redirectService.getDefaultRoute()
}
getDefaultRouteQuery () {
- return this.router.parseUrl(this.redirectService.getDefaultRoute()).queryParams
+ return this.redirectService.getDefaultRouteQuery()
}
// ---------------------------------------------------------------------------
diff --git a/client/src/app/menu/menu.component.html b/client/src/app/menu/menu.component.html
index 600fcaa6d9..9aa3dee0bf 100644
--- a/client/src/app/menu/menu.component.html
+++ b/client/src/app/menu/menu.component.html
@@ -54,13 +54,13 @@
<ul class="ul-unstyle">
<li *ngFor="let link of menuSection.links">
@if (link.isPrimaryButton === true) {
- <my-button class="d-block menu-button" [ngClass]="link.ngClass" theme="primary" [icon]="link.icon" [title]="link.label" [ptRouterLink]="link.path">
+ <my-button class="d-block menu-button" [ngClass]="link.ngClass" theme="primary" [icon]="link.icon" [title]="link.label" [ptRouterLink]="link.path" [ptQueryParams]="link.query">
@if (!collapsed) {
{{ link.label }}
}
</my-button>
} @else {
- <a class="menu-link ellipsis" [routerLink]="link.path" routerLinkActive="active" [ngClass]="link.ngClass" [title]="link.label">
+ <a class="menu-link ellipsis" [routerLink]="link.path" [queryParams]="link.query" routerLinkActive="active" [ngClass]="link.ngClass" [title]="link.label">
<my-global-icon *ngIf="link.icon" [iconName]="link.icon" [ngClass]="link.iconClass" aria-hidden="true"></my-global-icon>
<span [ngClass]="{ 'visually-hidden': collapsed }">{{ link.label }}</span>
</a>
diff --git a/client/src/app/menu/menu.component.ts b/client/src/app/menu/menu.component.ts
index 8c521a0af5..f8442f41fd 100644
--- a/client/src/app/menu/menu.component.ts
+++ b/client/src/app/menu/menu.component.ts
@@ -1,6 +1,6 @@
import { CommonModule } from '@angular/common'
import { Component, OnDestroy, OnInit } from '@angular/core'
-import { RouterLink, RouterLinkActive } from '@angular/router'
+import { Params, RouterLink, RouterLinkActive } from '@angular/router'
import {
AuthService,
AuthStatus,
@@ -14,7 +14,7 @@ import {
import { GlobalIconComponent, GlobalIconName } from '@app/shared/shared-icons/global-icon.component'
import { ButtonComponent } from '@app/shared/shared-main/buttons/button.component'
import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap'
-import { ServerConfig, UserRight } from '@peertube/peertube-models'
+import { UserRight } from '@peertube/peertube-models'
import debug from 'debug'
import { of, Subscription } from 'rxjs'
import { first, map, switchMap } from 'rxjs/operators'
@@ -26,6 +26,7 @@ type MenuLink = {
label: string
path: string
+ query?: Params
isPrimaryButton?: boolean // default false
@@ -61,8 +62,6 @@ export class MenuComponent implements OnInit, OnDestroy {
private user: AuthUser
private canSeeVideoMakerBlock: boolean
- private serverConfig: ServerConfig
-
private authSub: Subscription
constructor (
@@ -100,9 +99,6 @@ export class MenuComponent implements OnInit, OnDestroy {
this.onUserStateChange()
})
-
- this.serverService.getConfig()
- .subscribe(config => this.serverConfig = config)
}
ngOnDestroy () {
@@ -130,12 +126,13 @@ export class MenuComponent implements OnInit, OnDestroy {
}
private buildQuickLinks (): MenuSection {
- const base = {
+ const base: MenuSection = {
key: 'quick-access',
title: $localize`Quick access`,
links: [
{
path: this.redirectService.getDefaultRoute(),
+ query: this.redirectService.getDefaultRouteQuery(),
icon: 'home' as GlobalIconName,
label: $localize`Home`
}
diff --git a/client/src/app/shared/shared-video-miniature/videos-list.component.ts b/client/src/app/shared/shared-video-miniature/videos-list.component.ts
index 1f6845dda1..40e9e13684 100644
--- a/client/src/app/shared/shared-video-miniature/videos-list.component.ts
+++ b/client/src/app/shared/shared-video-miniature/videos-list.component.ts
@@ -149,7 +149,7 @@ export class VideosListComponent implements OnInit, OnChanges, OnDestroy {
: []
this.filters = new VideoFilters(this.defaultSort, this.defaultScope, hiddenFilters)
- this.filters.load({ ...this.route.snapshot.queryParams, scope: this.defaultScope })
+ this.filters.load({ scope: this.defaultScope, ...this.route.snapshot.queryParams })
this.groupedDateLabels = {
[GroupDate.UNKNOWN]: null,