mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-27 23:23:07 +00:00 
			
		
		
		
	GUAC-1260 Allow extensions to override guacamole icons.
This commit is contained in:
		| @@ -108,6 +108,18 @@ public class Extension { | ||||
|      */ | ||||
|     private final Collection<Class<AuthenticationProvider>> authenticationProviderClasses; | ||||
|  | ||||
|     /** | ||||
|      * The resource for the small favicon for the extension. If provided, this | ||||
|      * will replace the default guacamole icon. | ||||
|      */ | ||||
|     private final Resource smallIcon; | ||||
|  | ||||
|     /** | ||||
|      * The resource foe the large favicon for the extension. If provided, this  | ||||
|      * will replace the default guacamole icon. | ||||
|      */ | ||||
|     private final Resource largeIcon; | ||||
|  | ||||
|     /** | ||||
|      * Returns a new map of all resources corresponding to the collection of | ||||
|      * paths provided. Each resource will be associated with the given | ||||
| @@ -346,6 +358,17 @@ public class Extension { | ||||
|         // Define authentication providers | ||||
|         authenticationProviderClasses = getAuthenticationProviderClasses(manifest.getAuthProviders()); | ||||
|  | ||||
|         // Get small icon resource if provided | ||||
|         if (manifest.getSmallIcon() != null) | ||||
|             smallIcon = new ClassPathResource(classLoader, "image/png", manifest.getSmallIcon()); | ||||
|         else | ||||
|             smallIcon = null; | ||||
|  | ||||
|         // Get large icon resource if provided | ||||
|         if (manifest.getLargeIcon() != null) | ||||
|             largeIcon = new ClassPathResource(classLoader, "image/png", manifest.getLargeIcon()); | ||||
|         else | ||||
|             largeIcon = null; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -447,4 +470,26 @@ public class Extension { | ||||
|         return authenticationProviderClasses; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the resource for the small favicon for the extension. If | ||||
|      * provided, this will replace the default guacamole icon. | ||||
|      *  | ||||
|      * @return  | ||||
|      *     The resource for the large favicon. | ||||
|      */ | ||||
|     public Resource getSmallIcon() { | ||||
|         return smallIcon; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the resource for the large favicon for the extension. If | ||||
|      * provided, this will replace the default guacamole icon. | ||||
|      *  | ||||
|      * @return  | ||||
|      *     The resource for the large favicon. | ||||
|      */ | ||||
|     public Resource getLargeIcon() { | ||||
|         return largeIcon; | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -86,6 +86,18 @@ public class ExtensionManifest { | ||||
|      */ | ||||
|     private Collection<String> authProviders; | ||||
|  | ||||
|     /** | ||||
|      * The path to the small favicon. If provided, this will replace the default | ||||
|      * guacamole icon. | ||||
|      */ | ||||
|     private String smallIcon; | ||||
|  | ||||
|     /** | ||||
|      * The path to the large favicon. If provided, this will replace the default | ||||
|      * guacamole icon. | ||||
|      */ | ||||
|     private String largeIcon; | ||||
|  | ||||
|     /** | ||||
|      * Returns the version of the Guacamole web application for which the | ||||
|      * extension was built, such as "0.9.7". | ||||
| @@ -312,4 +324,46 @@ public class ExtensionManifest { | ||||
|         this.authProviders = authProviders; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the path to the small favicon, relative to the root of the | ||||
|      * extension. | ||||
|      * | ||||
|      * @return The path to the small favicon. | ||||
|      */ | ||||
|     public String getSmallIcon() { | ||||
|         return smallIcon; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Sets the path to the small favicon. This will replace the default | ||||
|      * guacamole icon. | ||||
|      * | ||||
|      * @param smallIcon The path to the small favicon. | ||||
|      */ | ||||
|     public void setSmallIcon(String smallIcon) { | ||||
|         this.smallIcon = smallIcon; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns the path to the large favicon, relative to the root of the | ||||
|      * extension. | ||||
|      * | ||||
|      * @return | ||||
|      *     The path to the large favicon. | ||||
|      */ | ||||
|     public String getLargeIcon() { | ||||
|         return largeIcon; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Sets the path to the large favicon. This will replace the default | ||||
|      * guacamole icon. | ||||
|      * | ||||
|      * @param largeIcon | ||||
|      *     The path to the large favicon. | ||||
|      */ | ||||
|     public void setLargeIcon(String largeIcon) { | ||||
|         this.largeIcon = largeIcon; | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -369,6 +369,14 @@ public class ExtensionModule extends ServletModule { | ||||
|                 String staticResourcePrefix = "/app/ext/" + extension.getNamespace() + "/"; | ||||
|                 serveStaticResources(staticResourcePrefix, extension.getStaticResources()); | ||||
|  | ||||
|                 // Serve up the small favicon if provided | ||||
|                 if(extension.getSmallIcon() != null) | ||||
|                     serve("/images/logo-64.png").with(new ResourceServlet(extension.getSmallIcon())); | ||||
|  | ||||
|                 // Serve up the large favicon if provided | ||||
|                 if(extension.getLargeIcon()!= null) | ||||
|                     serve("/images/logo-144.png").with(new ResourceServlet(extension.getLargeIcon())); | ||||
|  | ||||
|                 // Log successful loading of extension by name | ||||
|                 logger.info("Extension \"{}\" loaded.", extension.getName()); | ||||
|  | ||||
|   | ||||
| @@ -83,8 +83,11 @@ | ||||
|  | ||||
| .login-ui .login-dialog .logo { | ||||
|     display: block; | ||||
|     max-width: 3em; | ||||
|     margin: 0.5em auto; | ||||
|     width: 3em; | ||||
|     height: 3em; | ||||
|     background-size: 3em; | ||||
|     background-image: url("images/guac-tricolor.png"); | ||||
| } | ||||
|  | ||||
| .login-ui.continuation div.login-dialog { | ||||
|   | ||||
| @@ -31,7 +31,7 @@ | ||||
|             <form class="login-form" ng-submit="login()"> | ||||
|  | ||||
|                 <!-- Guacamole version --> | ||||
|                 <img class="logo" src="images/guac-tricolor.png" alt=""/> | ||||
|                 <div class="logo"></div> | ||||
|                 <div class="version">{{'APP.NAME' | translate}}</div> | ||||
|  | ||||
|                 <!-- Login message/instructions --> | ||||
|   | ||||
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 1.5 KiB | 
| Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 9.0 KiB | 
| Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB | 
| @@ -5,9 +5,9 @@ | ||||
|         <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, target-densitydpi=medium-dpi"/> | ||||
|         <meta name="mobile-web-app-capable" content="yes"/> | ||||
|         <meta name="apple-mobile-web-app-capable" content="yes"/> | ||||
|         <link rel="icon" type="image/png" href="images/guacamole-logo-64.png"/> | ||||
|         <link rel="icon" type="image/png" sizes="144x144" href="images/guacamole-logo-144.png"/> | ||||
|         <link rel="apple-touch-icon" type="image/png" href="images/guacamole-logo-144.png"/> | ||||
|         <link rel="icon" type="image/png" href="images/logo-64.png"/> | ||||
|         <link rel="icon" type="image/png" sizes="144x144" href="images/logo-144.png"/> | ||||
|         <link rel="apple-touch-icon" type="image/png" href="images/logo-144.png"/> | ||||
|         <link rel="stylesheet" type="text/css" href="app.css"> | ||||
|         <title ng-bind="page.title | translate"></title> | ||||
|     </head> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user