* allow local file override for fn:script scheme. Scripts must be saved as "{appdir}/scripts/name.groovy"
This commit is contained in:
parent
6631740d98
commit
9effd7cc6d
|
@ -211,10 +211,23 @@ public class ArgumentProcessor {
|
|||
boolean trusted = trustRemoteScript;
|
||||
|
||||
// special handling for endorsed online scripts
|
||||
if (uri.getScheme().endsWith("fn")) {
|
||||
url = "http://filebot.sourceforge.net/scripts/" + uri.getAuthority() + ".groovy";
|
||||
if (uri.getScheme().equals("fn")) {
|
||||
String path = "/scripts/" + uri.getAuthority() + ".groovy";
|
||||
|
||||
// check for local override
|
||||
File local = new File(getApplicationFolder(), path);
|
||||
if (local.exists()) {
|
||||
CLILogger.finest(String.format("[resolve] %s => %s", uri, local));
|
||||
return new Script(readAll(new InputStreamReader(new FileInputStream(local), "UTF-8")), true);
|
||||
} else {
|
||||
// script repository
|
||||
URL remote = new URL("http", "filebot.sourceforge.net", path);
|
||||
CLILogger.finest(String.format("[resolve] %s => %s", uri, remote));
|
||||
|
||||
url = remote.toString();
|
||||
trusted = true;
|
||||
}
|
||||
}
|
||||
|
||||
// fetch remote script only if modified
|
||||
CachedResource<String> script = new CachedResource<String>(url, String.class, 24 * 60 * 60 * 1000) {
|
||||
|
|
Loading…
Reference in New Issue