master
Dave Winer 9 years ago
parent 27b6d3a98f
commit f58e51d3d3

@ -92,7 +92,7 @@ There will always be more work to do here. ;-)
If you add ?format=json to a request for an OPML file, you'll get a JSON representation of the outline. This is useful for single-page JavaScript apps that want to use the outlineBrowser toolkit to diplay the contents. An example of this is <a href="http://davewiner.com/">davewiner.com</a>.
I also figured out how to write a JS page that's served by PagePark that returns the JSON representation of any OPML file. Here's a <a href="https://gist.github.com/scripting/7b95bfea614245a47f38">gist</a> containing the code. And a <a href="http://pagepark.io/getjsonopml.js?url=http://hosting.opml.org/dave/states.opml">call</a> to that page. It's extra-nice that this feature could be added without modifying PagePark. It's starting to become a real platform! :-)
To do this I needed to write a JS page that's served by PagePark that returns the JSON representation of a specific OPML file. Here's a <a href="https://gist.github.com/scripting/02dfd9dd5d9d3053c510">gist</a> containing the code. And a <a href="http://pagepark.io/getdavewineropml.js">call</a> to that page. It's extra-nice that this feature could be added without modifying PagePark. It's starting to become a real platform! :-)
In both cases, the CORS header allows access from anywhere.

@ -286,20 +286,26 @@ function readOpmlFile (f, callback) { //6/25/15 by DW
}
function readOpmlUrl (urlOutline, callback) {
request (urlOutline, function (err, response, body) {
if (err !== null) {
console.log ("readOpmlUrl: error reading file " + urlOutline + " == " + err.message)
callback (undefined);
}
else {
if (response.statusCode != 200) {
console.log ("readOpmlUrl: error reading file, statusCode == " + response.statusCode + ", urlOutline == " + urlOutline)
if (urlOutline === undefined) { //6/28/15 by DW
console.log ("readOpmlUrl: urlOutline is undefined.")
callback (undefined);
}
else {
request (urlOutline, function (err, response, body) {
if (err !== null) {
console.log ("readOpmlUrl: error reading file " + urlOutline + " == " + err.message)
callback (undefined);
}
else {
readOpmlString (body.toString (), callback);
if (response.statusCode != 200) {
console.log ("readOpmlUrl: error reading file, statusCode == " + response.statusCode + ", urlOutline == " + urlOutline)
callback (undefined);
}
else {
readOpmlString (body.toString (), callback);
}
}
}
});
});
}
}

@ -1,4 +1,4 @@
var myVersion = "0.63a", myProductName = "PagePark";
var myVersion = "0.64a", myProductName = "PagePark";
//The MIT License (MIT)

Loading…
Cancel
Save