Updated apidocs to use HTTPS for github pages.
This commit is contained in:
parent
b76b7b7a58
commit
9fef59cfd0
7 changed files with 611 additions and 191 deletions
|
@ -3,8 +3,8 @@
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"description": "Lighthouse - Next-gen search api for LBRY",
|
"description": "Lighthouse - Next-gen search api for LBRY",
|
||||||
"title": "Lighthouse API DOCS",
|
"title": "Lighthouse API DOCS",
|
||||||
"url" : "http://lighthouse.lbry.io",
|
"url" : "https://lighthouse.lbry.io",
|
||||||
"sampleUrl": "http://lighthouse.lbry.io",
|
"sampleUrl": "https://lighthouse.lbry.io",
|
||||||
"json_body": true,
|
"json_body": true,
|
||||||
"template": {
|
"template": {
|
||||||
"withCompare": true,
|
"withCompare": true,
|
||||||
|
|
190
docs/api_data.js
190
docs/api_data.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1 +1,21 @@
|
||||||
define({
"name": "Lighthouse",
"version": "0.0.1",
"description": "Lighthouse - Next-gen search api for LBRY",
"title": "Lighthouse API DOCS",
"url": "http://lighthouse.lbry.io",
"sampleUrl": "http://lighthouse.lbry.io",
"json_body": true,
"template": {
"withCompare": true,
"withGenerator": true
},
"defaultVersion": "0.0.0",
"apidoc": "0.3.0",
"generator": {
"name": "apidoc",
"time": "2018-04-08T06:08:09.948Z",
"url": "http://apidocjs.com",
"version": "0.17.6"
}
});
|
define({
|
||||||
|
"name": "Lighthouse",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"description": "Lighthouse - Next-gen search api for LBRY",
|
||||||
|
"title": "Lighthouse API DOCS",
|
||||||
|
"url": "https://lighthouse.lbry.io",
|
||||||
|
"sampleUrl": "https://lighthouse.lbry.io",
|
||||||
|
"json_body": true,
|
||||||
|
"template": {
|
||||||
|
"withCompare": true,
|
||||||
|
"withGenerator": true
|
||||||
|
},
|
||||||
|
"defaultVersion": "0.0.0",
|
||||||
|
"apidoc": "0.3.0",
|
||||||
|
"generator": {
|
||||||
|
"name": "apidoc",
|
||||||
|
"time": "2018-04-08T07:38:33.375Z",
|
||||||
|
"url": "http://apidocjs.com",
|
||||||
|
"version": "0.17.6"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
|
@ -1 +1,21 @@
|
||||||
{
"name": "Lighthouse",
"version": "0.0.1",
"description": "Lighthouse - Next-gen search api for LBRY",
"title": "Lighthouse API DOCS",
"url": "http://lighthouse.lbry.io",
"sampleUrl": "http://lighthouse.lbry.io",
"json_body": true,
"template": {
"withCompare": true,
"withGenerator": true
},
"defaultVersion": "0.0.0",
"apidoc": "0.3.0",
"generator": {
"name": "apidoc",
"time": "2018-04-08T06:08:09.948Z",
"url": "http://apidocjs.com",
"version": "0.17.6"
}
}
|
{
|
||||||
|
"name": "Lighthouse",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"description": "Lighthouse - Next-gen search api for LBRY",
|
||||||
|
"title": "Lighthouse API DOCS",
|
||||||
|
"url": "https://lighthouse.lbry.io",
|
||||||
|
"sampleUrl": "https://lighthouse.lbry.io",
|
||||||
|
"json_body": true,
|
||||||
|
"template": {
|
||||||
|
"withCompare": true,
|
||||||
|
"withGenerator": true
|
||||||
|
},
|
||||||
|
"defaultVersion": "0.0.0",
|
||||||
|
"apidoc": "0.3.0",
|
||||||
|
"generator": {
|
||||||
|
"name": "apidoc",
|
||||||
|
"time": "2018-04-08T07:38:33.375Z",
|
||||||
|
"url": "http://apidocjs.com",
|
||||||
|
"version": "0.17.6"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,184 +1,184 @@
|
||||||
define([
|
define([
|
||||||
'jquery',
|
'jquery',
|
||||||
'lodash'
|
'lodash'
|
||||||
], function($, _) {
|
], function($, _) {
|
||||||
|
|
||||||
var initDynamic = function() {
|
var initDynamic = function() {
|
||||||
// Button send
|
// Button send
|
||||||
$(".sample-request-send").off("click");
|
$(".sample-request-send").off("click");
|
||||||
$(".sample-request-send").on("click", function(e) {
|
$(".sample-request-send").on("click", function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var $root = $(this).parents("article");
|
var $root = $(this).parents("article");
|
||||||
var group = $root.data("group");
|
var group = $root.data("group");
|
||||||
var name = $root.data("name");
|
var name = $root.data("name");
|
||||||
var version = $root.data("version");
|
var version = $root.data("version");
|
||||||
sendSampleRequest(group, name, version, $(this).data("sample-request-type"));
|
sendSampleRequest(group, name, version, $(this).data("sample-request-type"));
|
||||||
});
|
});
|
||||||
|
|
||||||
// Button clear
|
// Button clear
|
||||||
$(".sample-request-clear").off("click");
|
$(".sample-request-clear").off("click");
|
||||||
$(".sample-request-clear").on("click", function(e) {
|
$(".sample-request-clear").on("click", function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var $root = $(this).parents("article");
|
var $root = $(this).parents("article");
|
||||||
var group = $root.data("group");
|
var group = $root.data("group");
|
||||||
var name = $root.data("name");
|
var name = $root.data("name");
|
||||||
var version = $root.data("version");
|
var version = $root.data("version");
|
||||||
clearSampleRequest(group, name, version);
|
clearSampleRequest(group, name, version);
|
||||||
});
|
});
|
||||||
}; // initDynamic
|
}; // initDynamic
|
||||||
|
|
||||||
function sendSampleRequest(group, name, version, type)
|
function sendSampleRequest(group, name, version, type)
|
||||||
{
|
{
|
||||||
var $root = $('article[data-group="' + group + '"][data-name="' + name + '"][data-version="' + version + '"]');
|
var $root = $('article[data-group="' + group + '"][data-name="' + name + '"][data-version="' + version + '"]');
|
||||||
|
|
||||||
// Optional header
|
// Optional header
|
||||||
var header = {};
|
var header = {};
|
||||||
$root.find(".sample-request-header:checked").each(function(i, element) {
|
$root.find(".sample-request-header:checked").each(function(i, element) {
|
||||||
var group = $(element).data("sample-request-header-group-id");
|
var group = $(element).data("sample-request-header-group-id");
|
||||||
$root.find("[data-sample-request-header-group=\"" + group + "\"]").each(function(i, element) {
|
$root.find("[data-sample-request-header-group=\"" + group + "\"]").each(function(i, element) {
|
||||||
var key = $(element).data("sample-request-header-name");
|
var key = $(element).data("sample-request-header-name");
|
||||||
var value = element.value;
|
var value = element.value;
|
||||||
if ( ! element.optional && element.defaultValue !== '') {
|
if ( ! element.optional && element.defaultValue !== '') {
|
||||||
value = element.defaultValue;
|
value = element.defaultValue;
|
||||||
}
|
}
|
||||||
header[key] = value;
|
header[key] = value;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// create JSON dictionary of parameters
|
// create JSON dictionary of parameters
|
||||||
var param = {};
|
var param = {};
|
||||||
var paramType = {};
|
var paramType = {};
|
||||||
$root.find(".sample-request-param:checked").each(function(i, element) {
|
$root.find(".sample-request-param:checked").each(function(i, element) {
|
||||||
var group = $(element).data("sample-request-param-group-id");
|
var group = $(element).data("sample-request-param-group-id");
|
||||||
$root.find("[data-sample-request-param-group=\"" + group + "\"]").not(function(){
|
$root.find("[data-sample-request-param-group=\"" + group + "\"]").not(function(){
|
||||||
return $(this).val() == "" && $(this).is("[data-sample-request-param-optional='true']");
|
return $(this).val() == "" && $(this).is("[data-sample-request-param-optional='true']");
|
||||||
}).each(function(i, element) {
|
}).each(function(i, element) {
|
||||||
var key = $(element).data("sample-request-param-name");
|
var key = $(element).data("sample-request-param-name");
|
||||||
var value = element.value;
|
var value = element.value;
|
||||||
if ( ! element.optional && element.defaultValue !== '') {
|
if ( ! element.optional && element.defaultValue !== '') {
|
||||||
value = element.defaultValue;
|
value = element.defaultValue;
|
||||||
}
|
}
|
||||||
param[key] = value;
|
param[key] = value;
|
||||||
paramType[key] = $(element).next().text();
|
paramType[key] = $(element).next().text();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// grab user-inputted URL
|
// grab user-inputted URL
|
||||||
var url = $root.find(".sample-request-url").val();
|
var url = $root.find(".sample-request-url").val();
|
||||||
|
|
||||||
// Insert url parameter
|
// Insert url parameter
|
||||||
var pattern = pathToRegexp(url, null);
|
var pattern = pathToRegexp(url, null);
|
||||||
var matches = pattern.exec(url);
|
var matches = pattern.exec(url);
|
||||||
for (var i = 1; i < matches.length; i++) {
|
for (var i = 1; i < matches.length; i++) {
|
||||||
var key = matches[i].substr(1);
|
var key = matches[i].substr(1);
|
||||||
if (param[key] !== undefined) {
|
if (param[key] !== undefined) {
|
||||||
url = url.replace(matches[i], encodeURIComponent(param[key]));
|
url = url.replace(matches[i], encodeURIComponent(param[key]));
|
||||||
|
|
||||||
// remove URL parameters from list
|
// remove URL parameters from list
|
||||||
delete param[key];
|
delete param[key];
|
||||||
}
|
}
|
||||||
} // for
|
} // for
|
||||||
|
|
||||||
$root.find(".sample-request-response").fadeTo(250, 1);
|
$root.find(".sample-request-response").fadeTo(250, 1);
|
||||||
$root.find(".sample-request-response-json").html("Loading...");
|
$root.find(".sample-request-response-json").html("Loading...");
|
||||||
refreshScrollSpy();
|
refreshScrollSpy();
|
||||||
|
|
||||||
_.each( param, function( val, key ) {
|
_.each( param, function( val, key ) {
|
||||||
var t = paramType[ key ].toLowerCase();
|
var t = paramType[ key ].toLowerCase();
|
||||||
if ( t === 'object' || t === 'array' ) {
|
if ( t === 'object' || t === 'array' ) {
|
||||||
try {
|
try {
|
||||||
param[ key ] = JSON.parse( val );
|
param[ key ] = JSON.parse( val );
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// send AJAX request, catch success or error callback
|
// send AJAX request, catch success or error callback
|
||||||
var ajaxRequest = {
|
var ajaxRequest = {
|
||||||
url : url,
|
url : url,
|
||||||
headers : header,
|
headers : header,
|
||||||
data : param,
|
data : param,
|
||||||
type : type.toUpperCase(),
|
type : type.toUpperCase(),
|
||||||
success : displaySuccess,
|
success : displaySuccess,
|
||||||
error : displayError
|
error : displayError
|
||||||
};
|
};
|
||||||
|
|
||||||
$.ajax(ajaxRequest);
|
$.ajax(ajaxRequest);
|
||||||
|
|
||||||
|
|
||||||
function displaySuccess(data, status, jqXHR) {
|
function displaySuccess(data, status, jqXHR) {
|
||||||
var jsonResponse;
|
var jsonResponse;
|
||||||
try {
|
try {
|
||||||
jsonResponse = JSON.parse(jqXHR.responseText);
|
jsonResponse = JSON.parse(jqXHR.responseText);
|
||||||
jsonResponse = JSON.stringify(jsonResponse, null, 4);
|
jsonResponse = JSON.stringify(jsonResponse, null, 4);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
jsonResponse = data;
|
jsonResponse = data;
|
||||||
}
|
}
|
||||||
$root.find(".sample-request-response-json").html(jsonResponse);
|
$root.find(".sample-request-response-json").html(jsonResponse);
|
||||||
refreshScrollSpy();
|
refreshScrollSpy();
|
||||||
};
|
};
|
||||||
|
|
||||||
function displayError(jqXHR, textStatus, error) {
|
function displayError(jqXHR, textStatus, error) {
|
||||||
var message = "Error " + jqXHR.status + ": " + error;
|
var message = "Error " + jqXHR.status + ": " + error;
|
||||||
var jsonResponse;
|
var jsonResponse;
|
||||||
try {
|
try {
|
||||||
jsonResponse = JSON.parse(jqXHR.responseText);
|
jsonResponse = JSON.parse(jqXHR.responseText);
|
||||||
jsonResponse = JSON.stringify(jsonResponse, null, 4);
|
jsonResponse = JSON.stringify(jsonResponse, null, 4);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
jsonResponse = escape(jqXHR.responseText);
|
jsonResponse = escape(jqXHR.responseText);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (jsonResponse)
|
if (jsonResponse)
|
||||||
message += "<br>" + jsonResponse;
|
message += "<br>" + jsonResponse;
|
||||||
|
|
||||||
// flicker on previous error to make clear that there is a new response
|
// flicker on previous error to make clear that there is a new response
|
||||||
if($root.find(".sample-request-response").is(":visible"))
|
if($root.find(".sample-request-response").is(":visible"))
|
||||||
$root.find(".sample-request-response").fadeTo(1, 0.1);
|
$root.find(".sample-request-response").fadeTo(1, 0.1);
|
||||||
|
|
||||||
$root.find(".sample-request-response").fadeTo(250, 1);
|
$root.find(".sample-request-response").fadeTo(250, 1);
|
||||||
$root.find(".sample-request-response-json").html(message);
|
$root.find(".sample-request-response-json").html(message);
|
||||||
refreshScrollSpy();
|
refreshScrollSpy();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearSampleRequest(group, name, version)
|
function clearSampleRequest(group, name, version)
|
||||||
{
|
{
|
||||||
var $root = $('article[data-group="' + group + '"][data-name="' + name + '"][data-version="' + version + '"]');
|
var $root = $('article[data-group="' + group + '"][data-name="' + name + '"][data-version="' + version + '"]');
|
||||||
|
|
||||||
// hide sample response
|
// hide sample response
|
||||||
$root.find(".sample-request-response-json").html("");
|
$root.find(".sample-request-response-json").html("");
|
||||||
$root.find(".sample-request-response").hide();
|
$root.find(".sample-request-response").hide();
|
||||||
|
|
||||||
// reset value of parameters
|
// reset value of parameters
|
||||||
$root.find(".sample-request-param").each(function(i, element) {
|
$root.find(".sample-request-param").each(function(i, element) {
|
||||||
element.value = "";
|
element.value = "";
|
||||||
});
|
});
|
||||||
|
|
||||||
// restore default URL
|
// restore default URL
|
||||||
var $urlElement = $root.find(".sample-request-url");
|
var $urlElement = $root.find(".sample-request-url");
|
||||||
$urlElement.val($urlElement.prop("defaultValue"));
|
$urlElement.val($urlElement.prop("defaultValue"));
|
||||||
|
|
||||||
refreshScrollSpy();
|
refreshScrollSpy();
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshScrollSpy()
|
function refreshScrollSpy()
|
||||||
{
|
{
|
||||||
$('[data-spy="scroll"]').each(function () {
|
$('[data-spy="scroll"]').each(function () {
|
||||||
$(this).scrollspy("refresh");
|
$(this).scrollspy("refresh");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function escapeHtml(str) {
|
function escapeHtml(str) {
|
||||||
var div = document.createElement("div");
|
var div = document.createElement("div");
|
||||||
div.appendChild(document.createTextNode(str));
|
div.appendChild(document.createTextNode(str));
|
||||||
return div.innerHTML;
|
return div.innerHTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exports.
|
* Exports.
|
||||||
*/
|
*/
|
||||||
return {
|
return {
|
||||||
initDynamic: initDynamic
|
initDynamic: initDynamic
|
||||||
};
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
# yarn lockfile v1
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
|
"@koa/cors@^2.2.1":
|
||||||
|
version "2.2.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@koa/cors/-/cors-2.2.1.tgz#c06a1c34d787e3cee79c0d4c20e8952d1b6d75c5"
|
||||||
|
|
||||||
abbrev@1:
|
abbrev@1:
|
||||||
version "1.1.0"
|
version "1.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.0.tgz#d0554c2256636e2f56e7c2e5ad183f859428d81f"
|
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.0.tgz#d0554c2256636e2f56e7c2e5ad183f859428d81f"
|
||||||
|
@ -712,7 +716,7 @@ bitcoin-promise@filipnyquist/node-bitcoin-promise#1fbf1cb8913ca3542b66060d48ebea
|
||||||
version "1.3.2"
|
version "1.3.2"
|
||||||
resolved "https://codeload.github.com/filipnyquist/node-bitcoin-promise/tar.gz/1fbf1cb8913ca3542b66060d48ebea185661e0a7"
|
resolved "https://codeload.github.com/filipnyquist/node-bitcoin-promise/tar.gz/1fbf1cb8913ca3542b66060d48ebea185661e0a7"
|
||||||
dependencies:
|
dependencies:
|
||||||
bitcoin filipnyquist/node-bitcoin
|
bitcoin filipnyquist/node-bitcoin#17552efad852a0ae929dc153988649259536a23d
|
||||||
|
|
||||||
bitcoin@filipnyquist/node-bitcoin:
|
bitcoin@filipnyquist/node-bitcoin:
|
||||||
version "3.0.2"
|
version "3.0.2"
|
||||||
|
|
Loading…
Add table
Reference in a new issue