Skip to content

Instantly share code, notes, and snippets.

@scripting

scripting/filter.js

Last active Apr 2, 2020
Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@scripting scripting commented Mar 29, 2020

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