JAL-3247 JAL-3254 Fixed file association launch behaviour in getdown in Windows
[jalview.git] / getdown / src / getdown / core / src / main / java / com / threerings / getdown / data / Application.java
index 4d75236..7376cdb 100644 (file)
@@ -1792,15 +1792,19 @@ public class Application
 
     public void newAppbase (URL url) {
       if (
-              url.getHost().endsWith(".jalview.org")
-              || url.equals("jalview.org")
-              || (url.getProtocol().equals("file") && url.getHost().equals(""))
+              url.getHost().equals(locatorDomain)
+              || (allowLocatorSubdomains && url.getHost().endsWith("."+locatorDomain))
+              || (allowLocatorFileProtocol && url.getProtocol().equals("file") && url.getHost().equals(""))
                       ) {
         newAppbase = url;
         log.info("Appbase set to Java Version Locator url '"+url.toString()+"'");
         return;
       }
-      log.info("Java Version Locator url '"+url.toString()+"' does not have a jalview.org domain. Ignoring");
+      log.info("Java Version Locator url '"+url.toString()+"' does not have satisfy domain rules ("
+      +(allowLocatorFileProtocol?"file:///|":"")
+      +"https://"
+      +(allowLocatorSubdomains?"[*.]":locatorDomain)
+      +"). Ignoring");
     }
 
     protected final EnvConfig _envc;
@@ -1868,6 +1872,9 @@ public class Application
 
     protected static final String ENV_VAR_PREFIX = "%ENV.";
     protected static final Pattern ENV_VAR_PATTERN = Pattern.compile("%ENV\\.(.*?)%");
+    protected static final String locatorDomain = "jalview.org";
+    protected boolean allowLocatorSubdomains = true;
+    protected boolean allowLocatorFileProtocol = true;
     
     public static final String locatorFileExtension = "jvl";
 }