diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-04 13:31:41 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-06-04 15:45:44 +0200 |
commit | 2989628b7913383b39ac34c7db8666a21f8e5037 (patch) | |
tree | ac7759177c04e524e7845143fd685aefb49e810e /client/src/app/core/routing/redirect.service.ts | |
parent | 8e08d415f9473b6b72fef698729453e726da16e7 (diff) | |
download | PeerTube-2989628b7913383b39ac34c7db8666a21f8e5037.tar.gz PeerTube-2989628b7913383b39ac34c7db8666a21f8e5037.tar.zst PeerTube-2989628b7913383b39ac34c7db8666a21f8e5037.zip |
Use HTML config when possible
Diffstat (limited to 'client/src/app/core/routing/redirect.service.ts')
-rw-r--r-- | client/src/app/core/routing/redirect.service.ts | 21 |
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 | } |