unoffical wafrn mirror
wafrn.net
atproto
social-network
activitypub
1import { NgModule } from "@angular/core";
2import {
3 PreloadAllModules,
4 RouteReuseStrategy,
5 RouterModule,
6 Routes,
7} from "@angular/router";
8import { NavigationMenuComponent } from "./components/navigation-menu/navigation-menu.component";
9import { NavigationMenuModule } from "./components/navigation-menu/navigation-menu.module";
10import { isAdminGuard } from "./guards/is-admin.guard";
11import { loginRequiredGuard } from "./guards/login-required.guard";
12import { CustomReuseStrategy } from "./services/routing.service";
13import { userLoggedGuard } from "./guards/user-logged.guard";
14
15const routes: Routes = [
16 {
17 path: "",
18 component: NavigationMenuComponent,
19 children: [
20 {
21 path: "",
22 pathMatch: "full",
23 canActivate: [userLoggedGuard],
24 loadComponent: () =>
25 import("./components/home-redirector/home-redirector.component").then(
26 (m) => m.HomeRedirectorComponent
27 ),
28 //loadChildren: () =>
29 },
30 {
31 path: "register",
32 loadChildren: () =>
33 import("./pages/register/register.module").then(
34 (m) => m.RegisterModule
35 ),
36 },
37 {
38 path: "checkMail",
39 loadComponent: () =>
40 import("./pages/check-email/check-email.component").then(
41 (m) => m.CheckEmailComponent
42 ),
43 },
44 {
45 path: "about",
46 loadChildren: () =>
47 import("./pages/about/about.module").then((m) => m.AboutModule),
48 },
49 {
50 path: "privacy",
51 redirectTo: "/article/system.privacy-policy",
52 },
53 {
54 path: "recoverPassword",
55 loadChildren: () =>
56 import("./pages/recover-password/recover-password.module").then(
57 (m) => m.RecoverPasswordModule
58 ),
59 },
60 {
61 path: "mfaSetup",
62 loadChildren: () =>
63 import("./pages/mfa-setup/mfa-setup.module").then(
64 (m) => m.MfaSetupModule
65 ),
66 },
67 {
68 path: "dashboard/search",
69 loadChildren: () =>
70 import("./pages/search/search.module").then((m) => m.SearchModule),
71 },
72 {
73 path: "dashboard/notifications",
74 loadChildren: () =>
75 import("./pages/notifications/notifications.module").then(
76 (m) => m.NotificationsModule
77 ),
78 },
79 {
80 path: "dashboard",
81 loadChildren: () =>
82 import("./pages/dashboard/dashboard.module").then(
83 (m) => m.DashboardModule
84 ),
85 data: { reuseRoute: false }, // We reuse the children, but not this route specifically.
86 },
87 {
88 path: "activate",
89 loadChildren: () =>
90 import("./pages/activate-account/activate-account.module").then(
91 (m) => m.ActivateAccountModule
92 ),
93 },
94 {
95 path: "resetPassword",
96 loadChildren: () =>
97 import("./pages/reset-password/reset-password.module").then(
98 (m) => m.ResetPasswordModule
99 ),
100 },
101 {
102 path: "post/:id",
103 redirectTo: "/fediverse/post/:id",
104 },
105 {
106 path: "fediverse/post",
107 loadChildren: () =>
108 import("./pages/single-post/single-post.module").then(
109 (m) => m.SinglePostModule
110 ),
111 },
112 {
113 path: "article",
114 loadChildren: () =>
115 import("./pages/single-post/single-post.module").then(
116 (m) => m.SinglePostModule
117 ),
118 },
119 {
120 path: "blog",
121 loadChildren: () =>
122 import("./pages/view-blog/view-blog.module").then(
123 (m) => m.ViewBlogModule
124 ),
125 data: { reuseRoute: false }, // BUG ON THIS ONE. THIS ONE GOES INTO A LOOP
126 },
127 {
128 path: "profile",
129 loadChildren: () =>
130 import("./pages/profile/profile.module").then((m) => m.ProfileModule),
131 canActivate: [loginRequiredGuard],
132 },
133 {
134 path: "settings",
135 loadChildren: () =>
136 import("./pages/settings/settings.module").then(
137 (m) => m.SettingsModule
138 ),
139 canActivate: [loginRequiredGuard],
140 },
141 {
142 path: "login",
143 loadChildren: () =>
144 import("./pages/login/login.module").then((m) => m.LoginModule),
145 },
146 {
147 path: "login/mfa",
148 loadChildren: () =>
149 import("./pages/login-mfa/login-mfa.module").then(
150 (m) => m.LoginMfaModule
151 ),
152 },
153 {
154 path: "admin",
155 loadChildren: () =>
156 import("./pages/admin/admin.module").then((m) => m.AdminModule),
157 canActivate: [isAdminGuard],
158 },
159 {
160 path: "doom",
161 loadChildren: () =>
162 import("./pages/doom/doom.module").then((m) => m.DoomModule),
163 },
164 {
165 path: "editor",
166 canActivate: [loginRequiredGuard],
167 loadComponent: () =>
168 import("./components/new-editor/new-editor.component").then(
169 (m) => m.NewEditorComponent
170 ),
171 },
172 {
173 path: "aac4alex",
174 loadComponent: () =>
175 import("./pages/aac-for-alex/aac-for-alex.component").then(
176 (m) => m.AacForAlexComponent
177 ),
178 },
179 {
180 path: "authorize_interaction",
181 loadChildren: () =>
182 import("./pages/search/search.module").then((m) => m.SearchModule),
183 },
184 {
185 path: "**",
186 loadChildren: () =>
187 import("./pages/pagenotfound/pagenotfound.module").then(
188 (m) => m.PagenotfoundModule
189 ),
190 },
191 ],
192 },
193];
194
195@NgModule({
196 imports: [
197 RouterModule.forRoot(routes, {
198 // tried not using this but in some circumstances is slow
199 preloadingStrategy: PreloadAllModules,
200 anchorScrolling: "enabled",
201 scrollPositionRestoration: "enabled",
202 }),
203 NavigationMenuModule,
204 ],
205 providers: [{ provide: RouteReuseStrategy, useClass: CustomReuseStrategy }],
206 exports: [RouterModule],
207})
208export class AppRoutingModule { }