Skip to content

Instantly share code, notes, and snippets.

@scripting
Last active April 2, 2020 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scripting/a676b0da36c13576877a91fc77a34ecb to your computer and use it in GitHub Desktop.
Save scripting/a676b0da36c13576877a91fc77a34ecb to your computer and use it in GitHub Desktop.
Example of a PagePark plug-in
//translate a url in this form: http://my.this.how/davewiner/example.opml
//to a file path like this: /root/apps/littleoutliner/publicFiles/users/davewiner/myOutlines/example.opml
exports.filter = filter;
const folder = "/root/apps/littleoutliner/publicFiles/users/";
function filter (options, callback) {
var url = options.httpRequest.url;
var splits = url.split ("?");
url = splits [0];
splits = url.split ("/");
var f = folder + splits [1] + "/myOutlines/" + splits [2];
options.serveLocalFile (f);
}
@scripting
Copy link
Author

scripting commented Mar 29, 2020

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