mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +00:00
GUAC-587: Move loading of extensions into own function. Do not allow lack of extensions directory to stop loading of app.js and app.css.
This commit is contained in:
@@ -216,13 +216,20 @@ public class ExtensionModule extends ServletModule {
|
|||||||
return ALLOWED_GUACAMOLE_VERSIONS.contains(guacamoleVersion);
|
return ALLOWED_GUACAMOLE_VERSIONS.contains(guacamoleVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
protected void configureServlets() {
|
* Loads all extensions within the GUACAMOLE_HOME/extensions directory, if
|
||||||
|
* any, adding their static resource to the given resoure collections.
|
||||||
// Load authentication provider from guacamole.properties for sake of backwards compatibility
|
*
|
||||||
Class<AuthenticationProvider> authProviderProperty = getAuthProviderProperty();
|
* @param javaScriptResources
|
||||||
if (authProviderProperty != null)
|
* A modifiable collection of static JavaScript resources which may
|
||||||
bindAuthenticationProvider(authProviderProperty);
|
* receive new JavaScript resources from extensions.
|
||||||
|
*
|
||||||
|
* @param cssResources
|
||||||
|
* A modifiable collection of static CSS resources which may receive
|
||||||
|
* new CSS resources from extensions.
|
||||||
|
*/
|
||||||
|
private void loadExtensions(Collection<Resource> javaScriptResources,
|
||||||
|
Collection<Resource> cssResources) {
|
||||||
|
|
||||||
// Retrieve and validate extensions directory
|
// Retrieve and validate extensions directory
|
||||||
File extensionsDir = new File(environment.getGuacamoleHome(), EXTENSIONS_DIRECTORY);
|
File extensionsDir = new File(environment.getGuacamoleHome(), EXTENSIONS_DIRECTORY);
|
||||||
@@ -239,14 +246,10 @@ public class ExtensionModule extends ServletModule {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Init JavaScript resources with base guacamole.min.js
|
// Verify contents are accessible
|
||||||
Collection<Resource> javaScriptResources = new ArrayList<Resource>();
|
if (extensionFiles == null)
|
||||||
javaScriptResources.add(new WebApplicationResource(getServletContext(), "/guacamole.min.js"));
|
logger.warn("Although GUACAMOLE_HOME/" + EXTENSIONS_DIRECTORY + " exists, its contents cannot be read.");
|
||||||
|
|
||||||
// Init CSS resources with base guacamole.min.css
|
|
||||||
Collection<Resource> cssResources = new ArrayList<Resource>();
|
|
||||||
cssResources.add(new WebApplicationResource(getServletContext(), "/guacamole.min.css"));
|
|
||||||
|
|
||||||
// Load each extension within the extension directory
|
// Load each extension within the extension directory
|
||||||
for (File extensionFile : extensionFiles) {
|
for (File extensionFile : extensionFiles) {
|
||||||
|
|
||||||
@@ -285,7 +288,28 @@ public class ExtensionModule extends ServletModule {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default to basic auth if nothing else chosen/provided
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configureServlets() {
|
||||||
|
|
||||||
|
// Load authentication provider from guacamole.properties for sake of backwards compatibility
|
||||||
|
Class<AuthenticationProvider> authProviderProperty = getAuthProviderProperty();
|
||||||
|
if (authProviderProperty != null)
|
||||||
|
bindAuthenticationProvider(authProviderProperty);
|
||||||
|
|
||||||
|
// Init JavaScript resources with base guacamole.min.js
|
||||||
|
Collection<Resource> javaScriptResources = new ArrayList<Resource>();
|
||||||
|
javaScriptResources.add(new WebApplicationResource(getServletContext(), "/guacamole.min.js"));
|
||||||
|
|
||||||
|
// Init CSS resources with base guacamole.min.css
|
||||||
|
Collection<Resource> cssResources = new ArrayList<Resource>();
|
||||||
|
cssResources.add(new WebApplicationResource(getServletContext(), "/guacamole.min.css"));
|
||||||
|
|
||||||
|
// Load all extensions
|
||||||
|
loadExtensions(javaScriptResources, cssResources);
|
||||||
|
|
||||||
|
// Bind basic auth if nothing else chosen/provided
|
||||||
if (boundAuthenticationProvider == null) {
|
if (boundAuthenticationProvider == null) {
|
||||||
logger.info("Using default, \"basic\", XML-driven authentication.");
|
logger.info("Using default, \"basic\", XML-driven authentication.");
|
||||||
bindAuthenticationProvider(BasicFileAuthenticationProvider.class);
|
bindAuthenticationProvider(BasicFileAuthenticationProvider.class);
|
||||||
|
Reference in New Issue
Block a user