lbrycrd APIs
+
+
-
- lbrycrd APIs
Methods and signatures provided by the lbrycrd blockchain daemon are documented below. To build, download, or run lbrycrd, see the project README.
-
`;
diff --git a/app/components/api/header-sdk.js b/app/components/api/header-sdk.js
index 890b02e..5e4dd50 100644
--- a/app/components/api/header-sdk.js
+++ b/app/components/api/header-sdk.js
@@ -11,13 +11,8 @@ import html from "choo/html";
// E X P O R T
export default () => html`
- You can find the repo for this API on GitHub:
-https://github.com/lbryio/lbry
-
-
lbry-sdk APIs
+
+
-
- lbry-sdk APIs
Methods and signatures provided by the lbry-sdk daemon are documented below. To build, download, or run the daemon, see the project README.
-
`;
diff --git a/app/components/client/playground-scripts.js b/app/components/client/playground-scripts.js
index 044cd4e..3fe2752 100644
--- a/app/components/client/playground-scripts.js
+++ b/app/components/client/playground-scripts.js
@@ -222,8 +222,6 @@ curl --header "Content-Type: application/json"
}
function playgroundResponseForExample3(source) {
- document.querySelector("[data-action='execute claim']").disabled = true;
-
return `
You can find the repo for this API on GitHub:
-https://github.com/lbryio/lbrycrd
-
# With the LBRY app/daemon running locally, you can use this in your Terminal
diff --git a/app/components/markdown.js b/app/components/markdown.js
index 08d8014..dfb7262 100644
--- a/app/components/markdown.js
+++ b/app/components/markdown.js
@@ -9,7 +9,6 @@ import exists from "fs-exists-sync";
import fm from "front-matter";
import fs from "graceful-fs";
import html from "choo/html";
-import m from "markdown-it";
import markdownAnchor from "markdown-it-anchor";
import markdownSup from "@module/markdown-it-sup";
import path from "path";
@@ -18,7 +17,7 @@ import raw from "choo/html/raw";
// U T I L S
const numberRegex = /^[0-9]/g;
-const md = m({
+const md = require("markdown-it")({
html: true,
typographer: true
}).use(markdownSup)
@@ -33,9 +32,7 @@ const md = m({
.replace(/\)/g, "")
.replace(/,/g, "");
- if (finalString.match(numberRegex))
- finalString = `_${finalString}`;
-
+ if (finalString.match(numberRegex)) finalString = `_${finalString}`;
return finalString;
}
});
diff --git a/app/dist/scripts/api.js b/app/dist/scripts/api.js
index bb6f8d2..d16921c 100644
--- a/app/dist/scripts/api.js
+++ b/app/dist/scripts/api.js
@@ -14,49 +14,23 @@ document.getElementById("input-search").value = "";
// Activate search
document.getElementById("input-search").addEventListener("keyup", () => {
if (document.getElementById("input-search").value)
- document.querySelector(".api-toc__search-clear").classList.add("active");
+ document.querySelector(".api__toc__search__clear").classList.add("active");
else
- document.querySelector(".api-toc__search-clear").classList.remove("active");
+ document.querySelector(".api__toc__search__clear").classList.remove("active");
});
// Cancel search
-document.querySelector(".api-toc__search-clear").addEventListener("click", () => {
+document.querySelector(".api__toc__search__clear").addEventListener("click", () => {
document.getElementById("input-search").value = "";
- document.querySelector(".api-toc__search-clear").classList.remove("active");
+ document.querySelector(".api__toc__search__clear").classList.remove("active");
jets.destroy();
reinitJets();
});
-// Code toggles
-handleApiLanguageToggles("curl");
-handleApiLanguageToggles("lbrynet");
-handleApiLanguageToggles("python");
-
-
-
-// H E L P E R S
-
-function handleApiLanguageToggles(language) {
- document.getElementById(`toggle-${language}`).addEventListener("click", () => {
- const codeExamples = document.querySelectorAll(`[data-api-example-type="${language}"]`);
- const examples = document.querySelectorAll("[data-api-example-type]");
- const toggles = document.querySelectorAll("*[id^='toggle-']");
-
- for (const example of examples)
- example.classList.remove("active");
-
- for (const example of codeExamples)
- example.classList.add("active");
-
- for (const toggle of toggles)
- toggle.classList.remove("active");
-
- document.getElementById(`toggle-${language}`).classList.add("active");
- });
-}
+// H E L P E R
function reinitJets() {
jets = new Jets({
diff --git a/app/index.js b/app/index.js
index 5a28487..5e33c60 100755
--- a/app/index.js
+++ b/app/index.js
@@ -61,8 +61,7 @@ server
next();
})
.ready(err => {
- if (err)
- throw err;
+ if (err) throw err;
server.ws.on("connection", socket => {
socket.on("message", data => {
diff --git a/app/sass/pages/_api.scss b/app/sass/pages/_api.scss
index ab02d72..f256a49 100644
--- a/app/sass/pages/_api.scss
+++ b/app/sass/pages/_api.scss
@@ -15,7 +15,7 @@
}
}
-.api-header {
+.api__header {
padding: 2rem;
position: relative;
@@ -33,20 +33,20 @@
/*!
* API | Table of Contents
*
- * @class .api-toc
- * @class .api-toc__search
- * @class .api-toc__search-field
+ * @class .api__toc
+ * @class .api__toc__search
+ * @class .api__toc__search__field
*
- * @class .api-toc__search-clear
+ * @class .api__toc__search__clear
* @state {.active}
*
- * @class .api-toc__items
+ * @class .api__toc__items
*
- * @class .api-toc__item
+ * @class .api__toc__item
* @state {:hover}
**/
-.api-toc {
+.api__toc {
width: 200px; height: calc(100vh - 4rem); // navigation is 4rem tall
bottom: 0; left: 0;
@@ -59,11 +59,11 @@
z-index: 3;
}
-.api-toc__search {
+.api__toc__search {
position: relative;
}
-.api-toc__search-field {
+.api__toc__search__field {
width: 100%;
padding: 0.25rem calc(2rem + 4px) 0.25rem 0.75rem;
@@ -72,7 +72,7 @@
line-height: 2rem;
}
-.api-toc__search-clear {
+.api__toc__search__clear {
width: 1.25rem; height: 1.25rem;
top: 0.6rem; right: 0.75rem;
@@ -97,7 +97,7 @@
}
}
-.api-toc__items {
+.api__toc__items {
font-size: 0.8rem;
line-height: 1.33;
list-style-type: none;
@@ -105,7 +105,7 @@
padding-bottom: 1rem;
}
-.api-toc__item {
+.api__toc__item {
&:hover {
background-color: $lbry-gray-2;
}
@@ -116,12 +116,12 @@
}
}
-.api-content {
+.api__content {
width: calc(100% - 200px);
float: right;
}
-.api-documentation {
+.api__documentation {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(50%, 1fr));
@@ -182,30 +182,18 @@
}
}
-.api-content__body {
+.api__content__body {
padding: 2rem;
- border-bottom: 1px solid $lbry-gray-1;
-
- a {
- transition: color 0.2s;
-
- &:not(:hover) {
- color: $lbry-teal-3;
- }
-
- &:hover {
- color: $lbry-teal-5;
- }
- }
+ border-bottom: 1px solid $lbry-gray-1; // rgba($lbry-gray-1, 0.3);
}
-.api-content__body-arguments {
+.api__content__body__arguments {
border: 1px solid $lbry-gray-2;
border-radius: 3px;
list-style-type: none;
}
-.api-content__body-argument {
+.api__content__body__argument {
&:not(:last-of-type) {
border-bottom: 1px solid $lbry-gray-2;
}
@@ -246,57 +234,14 @@
}
}
-.api-content__example,
-.api-content__intro {
+.api__content__example {
padding: 2rem;
+
background-color: rgba($lbry-black, 0.9);
border-bottom: 1px solid rgba($lbry-white, 0.1);
color: $lbry-white;
- position: relative;
pre {
background-color: $lbry-black;
}
}
-
-
-
-.api-content__items {
- width: 100%;
- padding: 1rem 2rem;
- top: 4rem; right: 0;
-
- background-color: $lbry-black;
- color: $lbry-white;
- position: sticky;
- z-index: 10;
-}
-
-.api-content__item {
- padding: 0.25rem 0.75rem;
- border-radius: 0.2rem;
- display: inline-block;
- font-size: 0.8rem;
- transition: background-color 0.2s;
-
- &:not(:last-of-type) {
- margin-right: 0.5rem;
- }
-
- &:not(:hover) {
- background-color: $lbry-gray-5;
- }
-
- &.active,
- &:hover {
- background-color: $lbry-teal-4;
- }
-}
-
-pre {
- &[data-api-example-type] {
- &:not(.active) {
- display: none;
- }
- }
-}
diff --git a/app/views/api.js b/app/views/api.js
index a06bf46..e1aea10 100644
--- a/app/views/api.js
+++ b/app/views/api.js
@@ -16,9 +16,7 @@ import redirects from "@data/redirects.json";
const blockchainApi = "https://cdn.jsdelivr.net/gh/lbryio/lbrycrd@master/contrib/devtools/generated/api_v1.json";
const cache = new Map();
-const sdkApi = process.env.NODE_ENV === "development" ?
- "https://cdn.jsdelivr.net/gh/lbryio/lbry@generate_examples/docs/api.json" : // TODO: Remove when `generate_examples` is merged into master
- "https://cdn.jsdelivr.net/gh/lbryio/lbry@master/docs/api.json";
+const sdkApi = "https://cdn.jsdelivr.net/gh/lbryio/lbry@master/docs/api.json";
@@ -38,25 +36,18 @@ export default async(state) => {
return asyncHtml`
-