Skip to content

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

Rename not fount page to error page

Chocobozzzc0e3d9ff9019
diff --git a/client/src/app/+page-not-found/page-not-found-routing.module.ts b/client/src/app/+error-page/error-page-routing.module.ts
similarity index 60%
rename from client/src/app/+page-not-found/page-not-found-routing.module.ts
rename to client/src/app/+error-page/error-page-routing.module.ts
index 84f400bb62..a81f6c7566 100644
--- a/client/src/app/+page-not-found/page-not-found-routing.module.ts
+++ b/client/src/app/+error-page/error-page-routing.module.ts
@@ -1,12 +1,12 @@
import { NgModule } from '@angular/core'
import { RouterModule, Routes } from '@angular/router'
-import { PageNotFoundComponent } from './page-not-found.component'
+import { ErrorPageComponent } from './error-page.component'
import { MenuGuards } from '@app/core'
-const pageNotFoundRoutes: Routes = [
+const errorPageRoutes: Routes = [
{
path: '',
- component: PageNotFoundComponent,
+ component: ErrorPageComponent,
canActivate: [ MenuGuards.close(true) ],
canDeactivate: [ MenuGuards.open(true) ],
data: {
@@ -18,7 +18,7 @@ const pageNotFoundRoutes: Routes = [
]
@NgModule({
- imports: [ RouterModule.forChild(pageNotFoundRoutes) ],
+ imports: [ RouterModule.forChild(errorPageRoutes) ],
exports: [ RouterModule ]
})
-export class PageNotFoundRoutingModule {}
+export class ErrorPageRoutingModule {}
diff --git a/client/src/app/+page-not-found/page-not-found.component.html b/client/src/app/+error-page/error-page.component.html
similarity index 96%
rename from client/src/app/+page-not-found/page-not-found.component.html
rename to client/src/app/+error-page/error-page.component.html
index b950b8640b..070985d3c6 100644
--- a/client/src/app/+page-not-found/page-not-found.component.html
+++ b/client/src/app/+error-page/error-page.component.html
@@ -31,7 +31,7 @@
<ng-container *ngIf="type !== 'video'" i18n>You might need to login to see the resource.</ng-container>
</div>
- <a class="peertube-button-link orange-button mt-5" i18n routerLink="/login">
+ <a class="peertube-button-big-link orange-button mt-5" i18n routerLink="/login">
Login
</a>
diff --git a/client/src/app/+page-not-found/page-not-found.component.scss b/client/src/app/+error-page/error-page.component.scss
similarity index 75%
rename from client/src/app/+page-not-found/page-not-found.component.scss
rename to client/src/app/+error-page/error-page.component.scss
index efb81ff004..4e12e8c78b 100644
--- a/client/src/app/+page-not-found/page-not-found.component.scss
+++ b/client/src/app/+error-page/error-page.component.scss
@@ -35,18 +35,6 @@
width: 400px;
}
- @media screen and (min-width: #{breakpoint(lg)}) {
- width: 600px;
- }
-
- @media screen and (min-width: #{breakpoint(xl)}) {
- width: 700px;
- }
-
- @media screen and (min-width: #{breakpoint(xxl)}) {
- width: 800px;
- }
-
@media screen and (max-height: 600px) {
padding-top: 50px;
diff --git a/client/src/app/+page-not-found/page-not-found.component.ts b/client/src/app/+error-page/error-page.component.ts
similarity index 85%
rename from client/src/app/+page-not-found/page-not-found.component.ts
rename to client/src/app/+error-page/error-page.component.ts
index 10645a6345..4fee013509 100644
--- a/client/src/app/+page-not-found/page-not-found.component.ts
+++ b/client/src/app/+error-page/error-page.component.ts
@@ -4,11 +4,11 @@ import { Router } from '@angular/router'
import { HttpStatusCode } from '@shared/models'
@Component({
- selector: 'my-page-not-found',
- templateUrl: './page-not-found.component.html',
- styleUrls: [ './page-not-found.component.scss' ]
+ selector: 'my-error-page',
+ templateUrl: './error-page.component.html',
+ styleUrls: [ './error-page.component.scss' ]
})
-export class PageNotFoundComponent implements OnInit {
+export class ErrorPageComponent implements OnInit {
status = HttpStatusCode.NOT_FOUND_404
type: 'video' | 'other' = 'other'
diff --git a/client/src/app/+error-page/error-page.module.ts b/client/src/app/+error-page/error-page.module.ts
new file mode 100644
index 0000000000..807c6f5a95
--- /dev/null
+++ b/client/src/app/+error-page/error-page.module.ts
@@ -0,0 +1,23 @@
+import { CommonModule } from '@angular/common'
+import { NgModule } from '@angular/core'
+import { ErrorPageRoutingModule } from './error-page-routing.module'
+import { ErrorPageComponent } from './error-page.component'
+
+@NgModule({
+ imports: [
+ CommonModule,
+
+ ErrorPageRoutingModule
+ ],
+
+ declarations: [
+ ErrorPageComponent
+ ],
+
+ exports: [
+ ErrorPageComponent
+ ],
+
+ providers: []
+})
+export class ErrorPageModule { }
diff --git a/client/src/app/+page-not-found/page-not-found.module.ts b/client/src/app/+page-not-found/page-not-found.module.ts
deleted file mode 100644
index 2e09ab2992..0000000000
--- a/client/src/app/+page-not-found/page-not-found.module.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { CommonModule } from '@angular/common'
-import { NgModule } from '@angular/core'
-import { PageNotFoundRoutingModule } from './page-not-found-routing.module'
-import { PageNotFoundComponent } from './page-not-found.component'
-
-@NgModule({
- imports: [
- CommonModule,
-
- PageNotFoundRoutingModule
- ],
-
- declarations: [
- PageNotFoundComponent
- ],
-
- exports: [
- PageNotFoundComponent
- ],
-
- providers: []
-})
-export class PageNotFoundModule { }
diff --git a/client/src/app/app-routing.module.ts b/client/src/app/app-routing.module.ts
index a9d9c723ad..40e4ec35d5 100644
--- a/client/src/app/app-routing.module.ts
+++ b/client/src/app/app-routing.module.ts
@@ -194,7 +194,7 @@ for (const locale of POSSIBLE_LOCALES) {
routes.push({
path: '**',
- loadChildren: () => import('./+page-not-found/page-not-found.module').then(m => m.PageNotFoundModule)
+ loadChildren: () => import('./+error-page/error-page.module').then(m => m.ErrorPageModule)
})
@NgModule({
diff --git a/client/src/app/core/routing/redirect.service.ts b/client/src/app/core/routing/redirect.service.ts
index db4b350186..567fd432b0 100644
--- a/client/src/app/core/routing/redirect.service.ts
+++ b/client/src/app/core/routing/redirect.service.ts
@@ -46,7 +46,7 @@ export class RedirectService {
this.currentUrl = this.router.url
router.events.subscribe(event => {
if (event instanceof NavigationEnd || event instanceof NavigationCancel) {
- if (event.url === '/404') return
+ if ([ '/401', '/404' ].includes(event.url)) return
this.previousUrl = this.currentUrl
this.currentUrl = event.url
diff --git a/client/src/app/shared/shared-main/auth/auth-interceptor.service.ts b/client/src/app/shared/shared-main/auth/auth-interceptor.service.ts
index 7daf31a981..e4b74f3adb 100644
--- a/client/src/app/shared/shared-main/auth/auth-interceptor.service.ts
+++ b/client/src/app/shared/shared-main/auth/auth-interceptor.service.ts
@@ -62,7 +62,7 @@ export class AuthInterceptor implements HttpInterceptor {
}
private handleNotAuthenticated (err: HttpErrorResponse): Observable<any> {
- this.router.navigate([ '/404' ], { state: { obj: err }, skipLocationChange: true })
+ this.router.navigate([ '/401' ], { state: { obj: err }, skipLocationChange: true })
return of(err.message)
}
}
diff --git a/client/src/sass/class-helpers.scss b/client/src/sass/class-helpers.scss
index c67179ccb8..72381d1a89 100644
--- a/client/src/sass/class-helpers.scss
+++ b/client/src/sass/class-helpers.scss
@@ -27,10 +27,18 @@
@include peertube-button;
}
+.peertube-button-big {
+ @include peertube-button-big;
+}
+
.peertube-button-link {
@include peertube-button-link;
}
+.peertube-button-big-link {
+ @include peertube-button-big-link;
+}
+
.orange-button {
@include orange-button;
}
diff --git a/client/src/sass/include/_mixins.scss b/client/src/sass/include/_mixins.scss
index 6b93a57281..9d3700e15e 100644
--- a/client/src/sass/include/_mixins.scss
+++ b/client/src/sass/include/_mixins.scss
@@ -284,6 +284,13 @@
display: inline-block;
}
+@mixin peertube-button-big-link {
+ @include disable-default-a-behaviour;
+ @include peertube-button-big;
+
+ display: inline-block;
+}
+
@mixin peertube-button-outline {
@include disable-default-a-behaviour;
@include peertube-button;