File tree Expand file tree Collapse file tree 3 files changed +30
-1
lines changed
services/static-webserver/client/source Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -213,7 +213,9 @@ qx.Class.define("osparc.Application", {
213213 link . rel = "icon" ;
214214 document . getElementsByTagName ( "head" ) [ 0 ] . appendChild ( link ) ;
215215 }
216- link . href = "/resource/osparc/favicon-" + qx . core . Environment . get ( "product.name" ) + ".png" ;
216+ link . href = "" ;
217+ osparc . product . Utils . getFaviconUrl ( )
218+ . then ( url => link . href = url ) ;
217219 } ,
218220
219221 __startupChecks : function ( ) {
Original file line number Diff line number Diff line change @@ -114,6 +114,33 @@ qx.Class.define("osparc.product.Utils", {
114114 return resourceType ;
115115 } ,
116116
117+ __linkExists : function ( url ) {
118+ return new Promise ( ( resolve , reject ) => {
119+ const reqSvg = new XMLHttpRequest ( ) ;
120+ reqSvg . open ( "GET" , url , true ) ;
121+ reqSvg . onreadystatechange = ( ) => {
122+ if ( reqSvg . readyState === 4 ) {
123+ if ( reqSvg . status === 404 ) {
124+ reject ( ) ;
125+ } else {
126+ resolve ( ) ;
127+ }
128+ }
129+ } ;
130+ reqSvg . send ( ) ;
131+ } ) ;
132+ } ,
133+
134+ getFaviconUrl : function ( ) {
135+ const pngUrl = "https://raw.githubusercontent.com/ZurichMedTech/s4l-assets/main/app/favicons/favicon-" + this . getProductName ( ) + ".png" ;
136+ const fallbackIcon = "/resource/osparc/favicon-" + this . getProductName ( ) + ".png" ;
137+ return new Promise ( resolve => {
138+ this . __linkExists ( pngUrl )
139+ . then ( ( ) => resolve ( pngUrl ) )
140+ . catch ( ( ) => resolve ( fallbackIcon ) )
141+ } ) ;
142+ } ,
143+
117144 getLogoPath : function ( longLogo = true ) {
118145 let logosPath = null ;
119146 const colorManager = qx . theme . manager . Color . getInstance ( ) ;
You can’t perform that action at this time.
0 commit comments