1 import { Component, OnInit } from '@angular/core'
2 import { Title } from '@angular/platform-browser'
3 import { Router } from '@angular/router'
4 import { HttpStatusCode } from '@shared/models'
7 selector: 'my-error-page',
8 templateUrl: './error-page.component.html',
9 styleUrls: [ './error-page.component.scss' ]
11 export class ErrorPageComponent implements OnInit {
12 status = HttpStatusCode.NOT_FOUND_404
13 type: 'video' | 'other' = 'other'
16 private titleService: Title,
17 private router: Router
19 const state = this.router.getCurrentNavigation()?.extras.state
20 this.type = state?.type || this.type
21 this.status = state?.obj.status || this.status
25 if (this.pathname.includes('teapot')) {
26 this.status = HttpStatusCode.I_AM_A_TEAPOT_418
27 this.titleService.setTitle($localize`I'm a teapot` + ' - PeerTube')
32 return window.location.pathname
36 switch (this.status) {
37 case HttpStatusCode.I_AM_A_TEAPOT_418:
39 case HttpStatusCode.FORBIDDEN_403:
41 case HttpStatusCode.NOT_FOUND_404: