diff --git a/frontend/src/app/app.routes.ts b/frontend/src/app/app.routes.ts index 937f175..a6ae8da 100644 --- a/frontend/src/app/app.routes.ts +++ b/frontend/src/app/app.routes.ts @@ -4,9 +4,13 @@ import {AuthGuard} from './guards/auth.guard'; export const routes: Routes = [ { path: 'worlddl', - redirectTo: 'https://www.mediafire.com/folder/zblzjurjleq6i/Altitude_servers_1.17.1', + redirectTo: 'redirect/worlddl', pathMatch: 'full' }, + { + path: 'redirect/:type', + loadComponent: () => import('./shared-components/redirect/redirect.component').then(m => m.RedirectComponent), + }, { path: 'login/:code', loadComponent: () => import('./pages/home/home.component').then(m => m.HomeComponent), diff --git a/frontend/src/app/shared-components/redirect/redirect.component.html b/frontend/src/app/shared-components/redirect/redirect.component.html new file mode 100644 index 0000000..b29532a --- /dev/null +++ b/frontend/src/app/shared-components/redirect/redirect.component.html @@ -0,0 +1,3 @@ +
+ Redirecting... +
diff --git a/frontend/src/app/shared-components/redirect/redirect.component.scss b/frontend/src/app/shared-components/redirect/redirect.component.scss new file mode 100644 index 0000000..0c3cd22 --- /dev/null +++ b/frontend/src/app/shared-components/redirect/redirect.component.scss @@ -0,0 +1,8 @@ +.redirect-loading { + display: flex; + align-items: center; + justify-content: center; + height: 100vh; + font-family: system-ui, -apple-system, "Segoe UI", Roboto; + color: #555; +} diff --git a/frontend/src/app/shared-components/redirect/redirect.component.ts b/frontend/src/app/shared-components/redirect/redirect.component.ts new file mode 100644 index 0000000..be1e58f --- /dev/null +++ b/frontend/src/app/shared-components/redirect/redirect.component.ts @@ -0,0 +1,36 @@ +import {Component, inject, OnInit} from '@angular/core'; +import {ActivatedRoute, Router} from '@angular/router'; + +@Component({ + selector: 'app-redirect', + imports: [], + templateUrl: './redirect.component.html', + styleUrl: './redirect.component.scss' +}) +export class RedirectComponent implements OnInit { + private router: Router = inject(Router) + private route: ActivatedRoute = inject(ActivatedRoute) + private map: Record = { + 'worlddl': 'https://www.mediafire.com/folder/zblzjurjleq6i/Altitude_servers_1.17.1', + }; + + private getRedirectTarget(key: string): string | null { + const value = this.map[key]; + return value ?? null; + } + + ngOnInit(): void { + const type = this.route.snapshot.paramMap.get('type'); + + if (type) { + const target = this.getRedirectTarget(type); + if (target) { + this.router.navigateByUrl(target).then(); + } else { + this.router.navigate(['/']).then(); + } + } else { + this.router.navigate(['/']).then(); + } + } +}