aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core/routing/redirect.service.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/core/routing/redirect.service.ts')
-rw-r--r--client/src/app/core/routing/redirect.service.ts21
1 files changed, 6 insertions, 15 deletions
diff --git a/client/src/app/core/routing/redirect.service.ts b/client/src/app/core/routing/redirect.service.ts
index cf690a4d0..198332b00 100644
--- a/client/src/app/core/routing/redirect.service.ts
+++ b/client/src/app/core/routing/redirect.service.ts
@@ -20,24 +20,14 @@ export class RedirectService {
20 private serverService: ServerService 20 private serverService: ServerService
21 ) { 21 ) {
22 // The config is first loaded from the cache so try to get the default route 22 // The config is first loaded from the cache so try to get the default route
23 const tmpConfig = this.serverService.getTmpConfig() 23 const config = this.serverService.getHTMLConfig()
24 if (tmpConfig?.instance?.defaultClientRoute) { 24 if (config?.instance?.defaultClientRoute) {
25 this.defaultRoute = tmpConfig.instance.defaultClientRoute 25 this.defaultRoute = config.instance.defaultClientRoute
26 } 26 }
27 if (tmpConfig?.trending?.videos?.algorithms?.default) { 27 if (config?.trending?.videos?.algorithms?.default) {
28 this.defaultTrendingAlgorithm = tmpConfig.trending.videos.algorithms.default 28 this.defaultTrendingAlgorithm = config.trending.videos.algorithms.default
29 } 29 }
30 30
31 // Load default route
32 this.serverService.getConfig()
33 .subscribe(config => {
34 const defaultRouteConfig = config.instance.defaultClientRoute
35 const defaultTrendingConfig = config.trending.videos.algorithms.default
36
37 if (defaultRouteConfig) this.defaultRoute = defaultRouteConfig
38 if (defaultTrendingConfig) this.defaultTrendingAlgorithm = defaultTrendingConfig
39 })
40
41 // Track previous url 31 // Track previous url
42 this.currentUrl = this.router.url 32 this.currentUrl = this.router.url
43 router.events.subscribe(event => { 33 router.events.subscribe(event => {
@@ -52,6 +42,7 @@ export class RedirectService {
52 return this.defaultRoute 42 return this.defaultRoute
53 } 43 }
54 44
45
55 getDefaultTrendingAlgorithm () { 46 getDefaultTrendingAlgorithm () {
56 return this.defaultTrendingAlgorithm 47 return this.defaultTrendingAlgorithm
57 } 48 }