Skip to content

Instantly share code, notes, and snippets.

@grahams
Created January 31, 2017 18:02
Show Gist options
  • Save grahams/9aa80b06db160bc027e2aee70a685974 to your computer and use it in GitHub Desktop.
Save grahams/9aa80b06db160bc027e2aee70a685974 to your computer and use it in GitHub Desktop.
@grahams
Copy link
Author

grahams commented Mar 9, 2022

This script more or less works for Shortcuts as well. You want receive files from Quick Actions -> Run JS for Automation with Shortcut Input -> Copy JavaScript Result to clipboard

function run(input, parameters) {
    for(var x = 0; x < input.length; x += 1) {
        var filePath = input[x].toString()

        if(filePath.length > 0) {
            var escaped = escape(filePath);

            if( (escaped.toLowerCase().indexOf("resilio") > -1) &&
                (escaped.toLowerCase().indexOf("public") > -1) ) {

                var pubUrl = escaped.replace(/^.*Resilio%20Sync\/Public/, "http://grahams.wtf/public")
               	return(pubUrl);
            }
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment