aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/app.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/app.component.ts')
-rw-r--r--client/src/app/app.component.ts26
1 files changed, 25 insertions, 1 deletions
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts
index 3af33ba2b..25936146c 100644
--- a/client/src/app/app.component.ts
+++ b/client/src/app/app.component.ts
@@ -1,4 +1,5 @@
1import { Component, OnInit } from '@angular/core' 1import { Component, OnInit } from '@angular/core'
2import { DomSanitizer, SafeHtml } from '@angular/platform-browser'
2import { GuardsCheckStart, Router } from '@angular/router' 3import { GuardsCheckStart, Router } from '@angular/router'
3import { AuthService, ServerService } from '@app/core' 4import { AuthService, ServerService } from '@app/core'
4import { isInSmallView } from '@app/shared/misc/utils' 5import { isInSmallView } from '@app/shared/misc/utils'
@@ -24,10 +25,13 @@ export class AppComponent implements OnInit {
24 25
25 isMenuDisplayed = true 26 isMenuDisplayed = true
26 27
28 customCSS: SafeHtml
29
27 constructor ( 30 constructor (
28 private router: Router, 31 private router: Router,
29 private authService: AuthService, 32 private authService: AuthService,
30 private serverService: ServerService 33 private serverService: ServerService,
34 private domSanitizer: DomSanitizer
31 ) {} 35 ) {}
32 36
33 get serverVersion () { 37 get serverVersion () {
@@ -66,6 +70,26 @@ export class AppComponent implements OnInit {
66 } 70 }
67 } 71 }
68 ) 72 )
73
74 this.serverService.configLoaded
75 .subscribe(() => {
76 const config = this.serverService.getConfig()
77
78 // We test customCSS in case or the admin removed the css
79 if (this.customCSS || config.instance.customizations.css) {
80 const styleTag = '<style>' + config.instance.customizations.css + '</style>'
81 this.customCSS = this.domSanitizer.bypassSecurityTrustHtml(styleTag)
82 }
83
84 if (config.instance.customizations.javascript) {
85 try {
86 // tslint:disable:no-eval
87 eval(config.instance.customizations.javascript)
88 } catch (err) {
89 console.error('Cannot eval custom JavaScript.', err)
90 }
91 }
92 })
69 } 93 }
70 94
71 toggleMenu () { 95 toggleMenu () {