Compare commits
36
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
32f64d704d | ||
|
|
0a51e2f652 | ||
|
|
b260fc0624 | ||
|
|
7b11a03e02 | ||
|
|
7963e5bdd4 | ||
|
|
6ad1f91862 | ||
|
|
167587081f | ||
|
|
47da88fe2a | ||
|
|
fed52c65da | ||
|
|
0ec0dea55d | ||
|
|
dac8511d1f | ||
|
|
362c14c83c | ||
|
|
053aad7833 | ||
|
|
026bb01b81 | ||
|
|
e020eb3c13 | ||
|
|
1be0995bbf | ||
|
|
d8b37ed0e6 | ||
|
|
1b56526711 | ||
|
|
707f616224 | ||
|
|
5277050c37 | ||
|
|
698222cf32 | ||
|
|
1c0888e0cf | ||
|
|
39ea483f08 | ||
|
|
6ae0984edf | ||
|
|
d5932ce67c | ||
|
|
777d9f0f83 | ||
|
|
b3ae6ca0d6 | ||
|
|
ebbcb02c87 | ||
|
|
cc965191f2 | ||
|
|
48190d18be | ||
|
|
201f8a4a09 | ||
|
|
ed6cfb239a | ||
|
|
7beeffd008 | ||
|
|
8bfeafa137 | ||
|
|
85226a20d0 | ||
|
|
ee65417441 |
No files matched your search
@@ -25,7 +25,6 @@
|
||||
|
||||
|
||||
## Prerequisites
|
||||
- [lbry/web-daemon](https://github.com/lbryio/web-daemon)
|
||||
- [Node](https://nodejs.org) (version >= 10)
|
||||
|
||||
## Notes
|
||||
|
||||
@@ -65,25 +65,32 @@ function syncWithApi(data) { // eslint-disable-line no-unused-vars
|
||||
.then(response => response.json())
|
||||
.then(result => {
|
||||
switch(true) {
|
||||
case result.error === "this reward is limited to 1 per person":
|
||||
case result.error === "This reward is limited to 1 per person":
|
||||
document.querySelector("developer-program").innerHTML =
|
||||
"<p>You have already claimed this reward. This reward is limited to <strong>ONE</strong> per person. Your enthusiasm is appreciated.</p>";
|
||||
break;
|
||||
return;
|
||||
|
||||
case Boolean(result.error):
|
||||
document.querySelector("developer-program").innerHTML =
|
||||
`<p>${result.error}</p>`;
|
||||
return;
|
||||
|
||||
case result.success:
|
||||
result = result.data;
|
||||
document.querySelector("developer-program").innerHTML =
|
||||
`<p><strong>Success!</strong> Your wallet has been credited with ${result.reward_amount} LBC.</p><p>We have a great reference for the <a href="/api/sdk">LBRY SDK here</a> to help you get started.</p><p>You can see proof of this transaction on <a href="https://explorer.lbry.com/tx/${result.transaction_id}">our Blockchain Explorer</a>.</p>`;
|
||||
break;
|
||||
return;
|
||||
|
||||
default:
|
||||
console.log(data); // eslint-disable-line no-console
|
||||
console.info(data); // eslint-disable-line no-console
|
||||
document.querySelector("developer-program").innerHTML =
|
||||
"<p><strong>The LBRY API might be down. Please try again later.</strong></p>";
|
||||
break;
|
||||
"<p><strong>No success or error was received so the LBRY API might be down.<br/>Please try again later.</strong></p>";
|
||||
return;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
|
||||
// Idk what the error would be (probably a 500) so let's just have this message
|
||||
document.querySelector("developer-program").innerHTML =
|
||||
"<p><strong>LBRY API is down. Please try again later.</strong></p>";
|
||||
|
||||
@@ -257,7 +257,7 @@ const handleExamples = debounce(event => {
|
||||
|
||||
switch(data.action) {
|
||||
case "choose claim":
|
||||
fetchMetadata(exampleNumber, data.claimId);
|
||||
fetchMetadata(exampleNumber, `${data.name}#${data.claimId}`);
|
||||
|
||||
if (document.querySelector(".playground-navigation__example:nth-child(3)").classList.contains("active"))
|
||||
document.getElementById("fetch-claim-uri").value = event.dataset.name + "#" + event.dataset.claimId;
|
||||
|
||||
@@ -22,8 +22,7 @@ export default () => `
|
||||
|
||||
<div>
|
||||
<span><a href="https://github.com/lbryio/lbrycrd">lbrycrd</a></span>
|
||||
<span><a href="https://github.com/lbryio/torba">torba</a></span>
|
||||
<span><a href="https://github.com/lbryio/lbryumx">lbryumx</a></span>
|
||||
<span><a href="https://github.com/lbryio/lbry-sdk">SDK</a></span>
|
||||
</div>
|
||||
</h2>
|
||||
|
||||
|
||||
@@ -27,11 +27,11 @@ export default pagePath => {
|
||||
break;
|
||||
|
||||
case "/api/blockchain":
|
||||
githubUrl = "https://github.com/lbryio/lbrycrd/blob/add_api_docs_scripts/contrib/devtools/generated/api_v1.json";
|
||||
githubUrl = "https://github.com/lbryio/lbrycrd/blob/master/contrib/devtools/generated/api_v1.json";
|
||||
break;
|
||||
|
||||
case "/api/sdk":
|
||||
githubUrl = "https://github.com/lbryio/lbry-sdk/blob/master/lbry/docs/api.json";
|
||||
githubUrl = "https://github.com/lbryio/lbry-sdk/blob/master/docs/api.json";
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -13,6 +13,8 @@ import stringifyObject from "stringify-object";
|
||||
|
||||
import messageSlack from "./slack";
|
||||
import publishMeme from "./publish-meme";
|
||||
import lbrytvAPI from "~helper/lbrytv-sdk";
|
||||
|
||||
import randomString from "./random-string";
|
||||
import { send } from "~socket";
|
||||
import uploadImage from "./upload-image";
|
||||
@@ -76,10 +78,10 @@ export default async(data, socket) => {
|
||||
|
||||
|
||||
|
||||
switch(true) {
|
||||
switch(resolveMethod) {
|
||||
// T I P
|
||||
// E X A M P L E
|
||||
case resolveMethod === "support_create":
|
||||
case "support_create":
|
||||
if (!approvedContentIdsForTipping.includes(claimAddress)) {
|
||||
return send(socket, {
|
||||
example: data.example,
|
||||
@@ -103,7 +105,7 @@ export default async(data, socket) => {
|
||||
|
||||
// P U B L I S H
|
||||
// E X A M P L E
|
||||
case resolveMethod === "publish":
|
||||
case "publish":
|
||||
apiRequestMethod = "PUT";
|
||||
|
||||
// Required for publishing
|
||||
@@ -194,10 +196,36 @@ export default async(data, socket) => {
|
||||
|
||||
// R E S O L V E
|
||||
// E X A M P L E
|
||||
case resolveMethod === "resolve":
|
||||
case "resolve":
|
||||
apiRequestMethod = "GET";
|
||||
body.uri = claimAddress;
|
||||
try {
|
||||
let resolveResponse = await lbrytvAPI.resolve([claimAddress]);
|
||||
|
||||
if (socket) {
|
||||
const renderedCode = prism.highlight(
|
||||
stringifyObject(resolveResponse, { indent: " ", singleQuotes: false }),
|
||||
prism.languages.json,
|
||||
"json"
|
||||
);
|
||||
|
||||
return send(socket, {
|
||||
example: data.example,
|
||||
html: raw(`
|
||||
<h3>Response</h3>
|
||||
${explorerNotice}
|
||||
<pre><code class="language-json">${renderedCode}</code></pre>
|
||||
`),
|
||||
message: "show result",
|
||||
selector: `#example${data.example}-result`
|
||||
});
|
||||
}
|
||||
} catch(error) {
|
||||
messageSlack({
|
||||
message: "```" + error + "```",
|
||||
title: "DAEMON ERROR: resolve"
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
"use strict";
|
||||
const request = require("request");
|
||||
|
||||
import messageSlack from "./slack";
|
||||
|
||||
|
||||
let addSupport = function() {
|
||||
return;
|
||||
};
|
||||
|
||||
let publish = function() {
|
||||
return;
|
||||
};
|
||||
|
||||
let resolve = function(urls) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
let options = {
|
||||
method: "POST",
|
||||
url: "https://api.lbry.tv/api/v1/proxy",
|
||||
headers:
|
||||
{
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: {
|
||||
method: "resolve",
|
||||
params: { urls: urls }
|
||||
},
|
||||
json: true
|
||||
};
|
||||
|
||||
request(options, function(error, response, daemonResponse) {
|
||||
if (error) {
|
||||
messageSlack({
|
||||
message: "```" + error + "```",
|
||||
title: "DAEMON ERROR: resolve"
|
||||
});
|
||||
return reject("DAEMON ERROR: resolve");
|
||||
}
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(daemonResponse, "error")) {
|
||||
messageSlack({
|
||||
message: "```" + daemonResponse.error + "```",
|
||||
title: "DAEMON ERROR: resolve"
|
||||
});
|
||||
return reject("DAEMON ERROR: resolve");
|
||||
} else
|
||||
return resolve(daemonResponse.result);
|
||||
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
let getTrending = function() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
let options = {
|
||||
method: "POST",
|
||||
url: "https://api.lbry.tv/api/v1/proxy",
|
||||
headers:
|
||||
{
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body:
|
||||
{
|
||||
method: "claim_search",
|
||||
params:
|
||||
{
|
||||
page_size: 20,
|
||||
page: 1,
|
||||
no_totals: true,
|
||||
any_tags:
|
||||
["art",
|
||||
"automotive",
|
||||
"blockchain",
|
||||
"comedy",
|
||||
"economics",
|
||||
"education",
|
||||
"gaming",
|
||||
"music",
|
||||
"news",
|
||||
"science",
|
||||
"sports",
|
||||
"technology"],
|
||||
channel_ids: [],
|
||||
not_channel_ids: [],
|
||||
not_tags: ["porn", "nsfw", "mature", "xxx"],
|
||||
order_by: ["trending_global", "trending_mixed"]
|
||||
}
|
||||
},
|
||||
json: true
|
||||
};
|
||||
|
||||
request(options, function(error, response, daemonResponse) {
|
||||
if (error) {
|
||||
messageSlack({
|
||||
message: "```" + error + "```",
|
||||
title: "DAEMON ERROR: trending"
|
||||
});
|
||||
return reject("DAEMON ERROR: trending");
|
||||
}
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(daemonResponse, "error")) {
|
||||
messageSlack({
|
||||
message: "```" + daemonResponse.error + "```",
|
||||
title: "DAEMON ERROR: trending"
|
||||
});
|
||||
return reject("DAEMON ERROR: trending");
|
||||
} else
|
||||
return resolve(daemonResponse.result.items);
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export default {
|
||||
addSupport,
|
||||
publish,
|
||||
resolve,
|
||||
getTrending
|
||||
};
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
|
||||
// P A C K A G E S
|
||||
|
||||
import color from "colorette";
|
||||
import * as color from "colorette";
|
||||
import compress from "fastify-compress";
|
||||
import cors from "cors";
|
||||
import fastify from "fastify";
|
||||
|
||||
@@ -3,6 +3,21 @@ developer-program {
|
||||
|
||||
input-submit {
|
||||
padding-top: 0.5rem;
|
||||
|
||||
button {
|
||||
color: $lbry-white;
|
||||
padding-right: 1.5rem;
|
||||
padding-left: 1.5rem;
|
||||
transition: background-color 0.2s;
|
||||
|
||||
&:not(:hover) {
|
||||
background-color: $lbry-black;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: $lbry-teal-4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.button {
|
||||
|
||||
+87
-107
@@ -11,6 +11,7 @@ import html from "choo/html";
|
||||
|
||||
import apiPage from "~view/api";
|
||||
import fetchMetadata from "~helper/fetch-metadata";
|
||||
import lbrytvAPI from "~helper/lbrytv-sdk";
|
||||
import { generateGitHubFeed } from "~helper/github";
|
||||
import messageSlack from "~helper/slack";
|
||||
import { URL } from "url";
|
||||
@@ -117,67 +118,56 @@ export default async(socket, action) => {
|
||||
|
||||
function generateContent(exampleNumber, displayTrendingContent) {
|
||||
if (exampleNumber === 1) {
|
||||
return getTrendingContent().then(response => {
|
||||
if (!response || !response.success || response.success !== true || !response.data)
|
||||
return "";
|
||||
return lbrytvAPI.getTrending()
|
||||
.then(response => {
|
||||
const renderedContentCollection = [];
|
||||
const urlsToResolve = [];
|
||||
|
||||
const rawContentCollection = [];
|
||||
const renderedContentCollection = [];
|
||||
const trendingContentData = response.data;
|
||||
|
||||
for (const data of trendingContentData) {
|
||||
rawContentCollection.push(fetchMetadata({
|
||||
claim: data.url,
|
||||
example: exampleNumber,
|
||||
method: "resolve"
|
||||
}));
|
||||
}
|
||||
|
||||
Promise.all(rawContentCollection)
|
||||
.then(collection => {
|
||||
for (const part of collection) {
|
||||
if (part && part.value.tags && part.value.tags.includes("mature"))
|
||||
continue;
|
||||
if (part === undefined)
|
||||
continue;
|
||||
try {
|
||||
renderedContentCollection.push(`
|
||||
<section class="playground-content__trend">
|
||||
<figure
|
||||
class="media__thumb"
|
||||
data-action="choose claim"
|
||||
data-claim-id="${part.name}"
|
||||
${part.value.thumbnail.url.length ? `style="background-image: url(${makeImageSourceSecure(part.value.thumbnail.url)})"` : ""}
|
||||
></figure>
|
||||
|
||||
<div class="media__title">
|
||||
${part.value.title}
|
||||
</div>
|
||||
|
||||
<div class="media__subtitle">
|
||||
${part.signing_channel ? part.signing_channel.name : "Anon"}
|
||||
</div>
|
||||
</section>
|
||||
`);
|
||||
} catch(err) {
|
||||
console.error(err);
|
||||
return; // TODO: Return nice error message
|
||||
}
|
||||
}
|
||||
|
||||
renderedContentCollection.push(`
|
||||
<script>
|
||||
document.getElementById("playground-example-description").innerHTML = document.querySelector("[data-action='playground, example 1']").dataset.description
|
||||
</script>
|
||||
`);
|
||||
|
||||
displayTrendingContent(renderedContentCollection.join(""));
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
return null;
|
||||
response.forEach(r =>{
|
||||
urlsToResolve.push(r.canonical_url);
|
||||
});
|
||||
});
|
||||
lbrytvAPI.resolve(urlsToResolve)
|
||||
.then(resolveResponse => {
|
||||
if (resolveResponse !== null) {
|
||||
let responses = Object.values(resolveResponse);
|
||||
|
||||
for (let r in responses) {
|
||||
let part = responses[r];
|
||||
|
||||
if (part.value && part.value.thumbnail.url) {
|
||||
renderedContentCollection.push(`
|
||||
<section class="playground-content__trend">
|
||||
<figure
|
||||
class="media__thumb"
|
||||
data-action="choose claim"
|
||||
data-claim-id="${part.claim_id}"
|
||||
data-name=${part.name}
|
||||
style="background-image: url(${makeImageSourceSecure(part.value.thumbnail.url)})">
|
||||
</figure>
|
||||
|
||||
<div class="media__title">
|
||||
${part.value.title || "Untitled"}
|
||||
</div>
|
||||
|
||||
<div class="media__subtitle">
|
||||
${part.signing_channel ? part.signing_channel.name : "Anon"}
|
||||
</div>
|
||||
</section>
|
||||
`);
|
||||
}
|
||||
}
|
||||
}
|
||||
renderedContentCollection.push(`
|
||||
<script>
|
||||
document.getElementById("playground-example-description").innerHTML = document.querySelector("[data-action='playground, example 1']").dataset.description
|
||||
</script>
|
||||
`);
|
||||
displayTrendingContent(renderedContentCollection.join(""));
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (exampleNumber === 3) {
|
||||
@@ -193,50 +183,49 @@ function generateContent(exampleNumber, displayTrendingContent) {
|
||||
"minecraft-in-real-life-iron-man#758dd6497cdfc401ae1f25984738d024d47b50af",
|
||||
"ethan-shows-kyle-warframe-skyvault#8a7401b88d5ed0376d98f16808194d4dcb05b284"
|
||||
];
|
||||
|
||||
const rawContentCollection = [];
|
||||
const renderedContentCollection = [];
|
||||
|
||||
for (const url of approvedUrls)
|
||||
rawContentCollection.push(fetchMetadata({ claim: url, method: "resolve", example: 1 }));
|
||||
lbrytvAPI.resolve(approvedUrls)
|
||||
.then(resolveResponse => {
|
||||
if (resolveResponse !== null) {
|
||||
let responses = Object.values(resolveResponse);
|
||||
|
||||
return Promise.all(rawContentCollection).then(collection => {
|
||||
for (const part of collection) {
|
||||
if (
|
||||
part &&
|
||||
part.value &&
|
||||
part.value.thumbnail.url
|
||||
) {
|
||||
renderedContentCollection.push(`
|
||||
<section class="playground-content__trend">
|
||||
<figure
|
||||
class="media__thumb"
|
||||
data-action="choose claim"
|
||||
data-claim-id="${part.claim_id}"
|
||||
data-name=${part.name}
|
||||
style="background-image: url(${makeImageSourceSecure(part.value.thumbnail.url)})">
|
||||
</figure>
|
||||
for (let r in responses) {
|
||||
let part = responses[r];
|
||||
|
||||
<div class="media__title">
|
||||
${part.value.title}
|
||||
</div>
|
||||
|
||||
<div class="media__subtitle">
|
||||
${part.signing_channel.name || "Anon"}
|
||||
</div>
|
||||
</section>
|
||||
`);
|
||||
if (part.value && part.value.thumbnail.url) {
|
||||
renderedContentCollection.push(`
|
||||
<section class="playground-content__trend">
|
||||
<figure
|
||||
class="media__thumb"
|
||||
data-action="choose claim"
|
||||
data-claim-id="${part.claim_id}"
|
||||
data-name=${part.name}
|
||||
style="background-image: url(${makeImageSourceSecure(part.value.thumbnail.url)})">
|
||||
</figure>
|
||||
|
||||
<div class="media__title">
|
||||
${part.value.title || "Untitled"}
|
||||
</div>
|
||||
|
||||
<div class="media__subtitle">
|
||||
${part.signing_channel ? part.signing_channel.name : "Anon"}
|
||||
</div>
|
||||
</section>
|
||||
`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
renderedContentCollection.push(`
|
||||
<script>
|
||||
document.getElementById("playground-example-description").innerHTML = document.querySelector("[data-action='playground, example 3']").dataset.description
|
||||
</script>
|
||||
`);
|
||||
|
||||
displayTrendingContent(renderedContentCollection.join(""));
|
||||
});
|
||||
renderedContentCollection.push(`
|
||||
<script>
|
||||
document.getElementById("playground-example-description").innerHTML = document.querySelector("[data-action='playground, example 3']").dataset.description
|
||||
</script>
|
||||
`);
|
||||
displayTrendingContent(renderedContentCollection.join(""));
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -377,15 +366,6 @@ function getGitHubUserToken(socket) {
|
||||
});
|
||||
}
|
||||
|
||||
async function getTrendingContent() {
|
||||
try {
|
||||
const response = await got("https://api.lbry.com/file/list_trending");
|
||||
return JSON.parse(response.body); // eslint-disable-line padding-line-between-statements
|
||||
} catch(error) {
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
function makeImageSourceSecure(url) {
|
||||
if (!url || !url.length)
|
||||
return url;
|
||||
|
||||
+3
-15
@@ -17,12 +17,9 @@ import redirects from "~data/redirects.json";
|
||||
|
||||
const cache = new Map();
|
||||
const filePathBlockchain = "/contrib/devtools/generated/api_v1.json";
|
||||
const filePathSdk = "/lbry/docs/api.json";
|
||||
const filePathSdk = "/docs/api.json";
|
||||
const rawGitHubBase = "https://raw.githubusercontent.com/lbryio/";
|
||||
|
||||
if (!process.env.GITHUB_OAUTH_TOKEN) // No point in rendering this page
|
||||
throw new Error("Missing GitHub token");
|
||||
|
||||
const octokit = new Octokit({
|
||||
auth: `token ${process.env.GITHUB_OAUTH_TOKEN}`
|
||||
});
|
||||
@@ -246,7 +243,7 @@ async function getTags(repositoryName) {
|
||||
repo: repositoryName
|
||||
});
|
||||
|
||||
const tags = [];
|
||||
const tags = ["master"];
|
||||
|
||||
// NOTE:
|
||||
// The versioning in our repos do not make sense so extra
|
||||
@@ -257,16 +254,7 @@ async function getTags(repositoryName) {
|
||||
switch(true) {
|
||||
case repositoryName === "lbry-sdk":
|
||||
data.forEach(tag => {
|
||||
if (
|
||||
tag.name >= "v0.38.0" &&
|
||||
tag.name !== "v0.38.0rc7" &&
|
||||
tag.name !== "v0.38.0rc6" &&
|
||||
tag.name !== "v0.38.0rc5" &&
|
||||
tag.name !== "v0.38.0rc4" &&
|
||||
tag.name !== "v0.38.0rc3" &&
|
||||
tag.name !== "v0.38.0rc2" &&
|
||||
tag.name !== "v0.38.0rc1"
|
||||
) tags.push(tag.name);
|
||||
if (tag.name >= "v0.52.0") tags.push(tag.name);
|
||||
});
|
||||
break;
|
||||
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ export default () => html`
|
||||
<section class="community">
|
||||
<div class="inner-wrap">
|
||||
<h3>Community</h3>
|
||||
<p>There's literally <a href="https://spee.ch/@lbrytech/dozens.mp4">12<sup>n</sup></a> of us.</p>
|
||||
<p>There's literally <a href="https://lbry.tv/@lbrytech:1/dozens:e">12n</a> of us.</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="//chat.lbry.com" title="LBRY on Discord">Chat</a></li>
|
||||
|
||||
+4
-4
@@ -5,7 +5,7 @@ description: Learn how to build your own app via LBRY in this comprehensive guid
|
||||
|
||||
## Introduction
|
||||
|
||||
Want to build something on top of LBRY? This is the place to get started. If this is your first introduction to LBRY, you should read the [Overview](/overview) first. If you would rather build with us, check out our [Contributing Guide](/contribute).
|
||||
Want to build something on top of LBRY? This is the place to get started. If this is your first introduction to LBRY, you should read the [Overview](./overview.md) first. If you would rather build with us, check out our [Contributing Guide](./contribute.md).
|
||||
|
||||
There are exactly 1,000,006 app ideas that could work on the LBRY network, but it doesn't make sense for _everything_ to be built on it.
|
||||
|
||||
@@ -86,7 +86,7 @@ Unfortunately, most users will want more functionality in an app than typing int
|
||||
|
||||
You can build many types of apps. Your app doesn't have to use Electron, nor does it have to be targeted at consumers, use a UI, or even fetch digital content at all! In this section, we'll look into the different types of apps you could build, and the different components needed to build anything you want.
|
||||
|
||||
Most applications will use the [LBRY SDK](#sdk) as a way of accessing and communicating with the LBRY network. A look at the [APIs](/api/sdk) provided by the SDK will help you understand what it can and can't do.
|
||||
Most applications will use the [LBRY SDK](#sdk) as a way of accessing and communicating with the LBRY network. A look at the [APIs](https://lbry.tech/api/sdk) provided by the SDK will help you understand what it can and can't do.
|
||||
|
||||
Some applications do not need to access content available on the network (e.g. a wallet-only app, or a blockchain visualizer). These applications might use [lbrycrd](#lbrycrd), the full-node blockchain daemon, or [chainquery](#chainquery), which parses blockchain data into SQL.
|
||||
|
||||
@@ -142,7 +142,7 @@ Regardless of the type of desktop app, you'll want to follow the steps for [usin
|
||||
|
||||
The [official LBRY desktop app](https://github.com/lbryio/lbry-desktop) is built with Electron. It is very easy to build with, and allows web developers to easily start creating "native" desktop applications. You can use a plain html document with a `<script>` tag, or build out a large web app. The official desktop app uses [React](https://reactjs.org/).
|
||||
|
||||
If you want to write an electron app, check out the [electron-starter project](https://github.com/lbryio/electron-starter) for a bare bones setup that is very similar to how [lbry-desktop](https://github.com/lbryio/lbry-desktop) is structured. It's also a simple way to explore the [SDK API](<(https://https://lbry.tech/api/sdk)>).
|
||||
If you want to write an electron app, check out the [electron-starter project](https://github.com/lbryio/electron-starter) for a bare bones setup that is very similar to how [lbry-desktop](https://github.com/lbryio/lbry-desktop) is structured. It's also a simple way to explore the [SDK API](https://lbry.tech/api/sdk).
|
||||
|
||||
Check out [this video](https://spee.ch/6/lbry-electron-starter) for a brief overview and guide to get it running. If you just want the source code, go [here](https://github.com/lbryio/electron-starter). Or, if you really really want to see it in action _now_, just paste these commands into your terminal:
|
||||
|
||||
@@ -195,7 +195,7 @@ Once that is downloaded, there are two steps to get it integrated into your app.
|
||||
|
||||
First, run `lbrynet start` in the directory you downloaded the SDK. This starts the API server and connects to the LBRY network.
|
||||
|
||||
Then, use an API wrapper to talk to the SDK or write your own. There are a number of simple [api wrappers](https://lbry.tech/resources/api-wrappers) available in several different languages, created by LBRY community members! These allow you to easily send commands to the SDK in the language of your choice.
|
||||
Then, use an API wrapper to talk to the SDK or write your own. There are a number of simple [API wrappers](https://lbry.tech/resources/api-wrappers) available in several different languages, created by LBRY community members! These allow you to easily send commands to the SDK in the language of your choice.
|
||||
|
||||
If a wrapper for the language you would like to use doesn't exist, it is still fairly easy to interact with. The SDK provides a JSON-RPC server at `localhost:5279` for interaction. You can call it via `cURL` or the HTTP functionality provided by the language you are using. You can look at an existing wrapper in another language for more detail.
|
||||
|
||||
|
||||
@@ -22,10 +22,8 @@ If you want to contribute to LBRY, there's definitely something for you! The fir
|
||||
| Component | Language (Toolset) | What Is It | Intro Video
|
||||
--- | --- | --- | ---
|
||||
| [lbrycrd](https://github.com/lbryio/lbrycrd) | C++ | A full node for the LBRY blockchain, including a standalone wallet. Used by miners and some applications. Most consumer applications do not bundle [[lbrycrd]] directly, and instead bundle [[lbry-sdk]]. | [Video](/resources/video-lbrycrd)
|
||||
| [lbry-sdk](https://github.com/lbryio/lbry-sdk) | Python (asyncio) | A daemon that can be used directly or to develop other applications. Provides convenience [APIs](/api/sdk), bundles an SPV wallet ([[torba]]), and contains an implementation of the LBRY data network. | [Video](/resources/video-lbrysdk)
|
||||
| [torba](https://github.com/lbryio/lbry-sdk) | Python | An [[SPV]] (Simple Payment Verification) wallet. Bundled with [[lbry-sdk]].
|
||||
| [wallet server](https://github.com/lbryio/lbry-sdk/tree/master/lbry/lbry/wallet/server) | Protobuf, Python | The wallet server used by [[torba]]. | |
|
||||
| [schema](https://github.com/lbryio/lbry-sdk/tree/master/lbry/lbry/schema) | Protobuf, Python | Defines the structure of the metadata stored in the LBRY blockchain. | |
|
||||
| [lbry-sdk](https://github.com/lbryio/lbry-sdk) | Python (asyncio) | A daemon that can be used directly or to develop other applications. Provides convenience [APIs](/api/sdk), bundles an SPV wallet client and server, and contains an implementation of the LBRY data network. | [Video](/resources/video-lbrysdk)
|
||||
| [schema](https://github.com/lbryio/lbry-sdk/tree/master/lbry/schema) | Protobuf, Python | Defines the structure of the metadata stored in the LBRY blockchain. | |
|
||||
|
||||
### Official Applications
|
||||
| Application | Language (Toolset) | What Is It | Intro Video
|
||||
@@ -68,7 +66,7 @@ Several hundred extremely good-looking, wise and moral people, as well as our CT
|
||||
|
||||
Web and application designers are requested to be able to work directly on CSS in the project they'd be contributing to. Please follow the [Coding](#coding) instructions for any website or application you want to improve.
|
||||
|
||||
We're happy to provide assistance if you're used to working in HTMl and CSS but are having trouble getting started. Check out [our chat](https://chat.lbry.com) or [our forum](https://discourse.lbry.com).
|
||||
We're happy to provide assistance if you're used to working in HTML and CSS but are having trouble getting started. Check out [our chat](https://chat.lbry.com) or [our forum](https://discourse.lbry.com).
|
||||
|
||||
## Writing
|
||||
|
||||
|
||||
@@ -41,6 +41,10 @@ The sequence number of a block in the blockchain. The first block is at height 0
|
||||
|
||||
An open, distributed ledger that records transactions in a verifiable and change-resistant way. The LBRY blockchain serves as an index of the content available on the network, a payment system and record of purchases for priced content, and a source if cryptographic publisher identities.
|
||||
|
||||
### Canonical URL
|
||||
|
||||
Similar to the [Short URL](#short-url), but will include the channel for but for claims that are signed by channels. The canonical URL is generally the recommend URL to use when linking LBRY URLs or displaying URLs to users. Note that it is rarely possible for the canonical URL to change to a shorter version when a competeting channel or claim is abandoned, but even if this happens, older canonical URLs will still work.
|
||||
|
||||
### Chainquery
|
||||
|
||||
A tool that stores blockchain data in an SQL database, keeps the database up-to-date as the blockchain grows, and provides an API to access the data using standard SQL queries.
|
||||
@@ -172,7 +176,7 @@ A file included with each LBRY project that contains basic information about tha
|
||||
|
||||
A long-running node that accepts blobs for upload and rehosts them on the network.
|
||||
|
||||
### Resolve (or URL Resolution)
|
||||
### Resolve (or URL Resolution) {#resolve}
|
||||
|
||||
The process of translating a URL into the associated claim ID and metadata. See [Resolution](/spec#resolution) for details.
|
||||
|
||||
@@ -184,6 +188,10 @@ A definition of the structure of the metadata that is stored in claims in the bl
|
||||
|
||||
A scheme to validate transactions without storing the whole blockchain.
|
||||
|
||||
### Short URL
|
||||
|
||||
The shortest [URL](https://spec.lbry.com/#urls), not including the [channel](#channel), that will [resolve](#resolve) to the correct claim (i.e. lbry://cats#c, returning lbry://cats#ca43e2b6db155177564e574b09dfedc7588816ef or lbry://@cats#0 returning lbry://@cats#0893dbed95307c4b27aadbcb1cc6cb593810b3f9). This is determined on a first come, first serve basis on claim id collisions. A short URL with more than one identifier may change to include only a single identifier if the previous claim, which had the single identifier, is deleted.
|
||||
|
||||
### SPV
|
||||
|
||||
SPV is an abbreviation for [Simplified Payment Verification](#simplified-payment-verification).
|
||||
|
||||
@@ -2,7 +2,7 @@ While the blockchain is the innovation that makes LBRY _possible_, the [Data Net
|
||||
|
||||
At this level:
|
||||
|
||||
- [Metadata](/spec#metadata] stored in the blockchain is interpreted and validated.
|
||||
- [Metadata](/spec#metadata) stored in the blockchain is interpreted and validated.
|
||||
- [Data referenced by metadata](/spec#data) is accessed and distributed via a peer-to-peer network.
|
||||
- [Identities](/spec#channels) are created, signed, and validated.
|
||||
|
||||
|
||||
@@ -18,3 +18,4 @@ description: Find the LBRY specification, API documentation, our Contributor's g
|
||||
- [Regtest Setup](/resources/regtest-setup)
|
||||
- [LBRY Android App Build Steps](/resources/android-build)
|
||||
- [Lighthouse (search) API](https://lbryio.github.io/lighthouse)
|
||||
- [Run Your Own Wallet Server](/resources/wallet-server)
|
||||
@@ -3,7 +3,7 @@ title: SDK Settings
|
||||
description: The daemon provided by the LBRY SDK has many settings. This resource lists them all and what they mean. Ready, set, settings!
|
||||
---
|
||||
|
||||
This document outlines how to configure SDK daemon settings and what options are available. They can be found on the lbry GitHub repository in [conf.py](https://github.com/lbryio/lbry-sdk/blob/master/lbry/lbry/conf.py).
|
||||
This document outlines how to configure SDK daemon settings and what options are available. They can be found on the lbry GitHub repository in [conf.py](https://github.com/lbryio/lbry-sdk/blob/master/lbry/conf.py).
|
||||
|
||||
## Daemon settings configuration
|
||||
|
||||
@@ -66,13 +66,6 @@ Configuration options are organized by their respective areas: Files, Wallet, Ne
|
||||
| streaming_get | boolean | false | true | Allow calling localhost:5280/get/claimname requests |
|
||||
| save_files | boolean | true | false | Save files with each download |
|
||||
| save_blobs | boolean | true | false | Save blobs with each download |
|
||||
### Security
|
||||
|
||||
| Setting | Format | Default value | Sample Values | Description |
|
||||
|----------------|---------|---------------|--------------------|----------------------------------------------------------------------------------------------------------------------------------|
|
||||
| allowed_origin | string | '' | '*' or localhost | IP address to allow API requests from |
|
||||
| use_auth_http | boolean | false | true | See [authentication instructions](https://github.com/lbryio/lbry-sdk/blob/master/lbrynet/daemon/auth/server.py#L179) for details |
|
||||
|
||||
### Other
|
||||
| Setting | Format | Default value | Sample Values | Description |
|
||||
|--------------------|---------|---------------|--------------------------------|---------------------------------------------------------------------------------------------------------------|
|
||||
|
||||
@@ -33,7 +33,7 @@ For this example, we will use claim ID `d9317ac7842f88ba442fee749c4f834353c24206
|
||||
|
||||
## Parse the Metadata
|
||||
|
||||
Perform a `getclaimbyid` call to lbrycrd using the claim ID for the claim you want to look up. You should get a response with some parameters. The `value` parameter contains the claim contents as a protobuf-encoded binary string. Decode the value using the protobuf definitions in [lbryio/types](https://github.com/lbryio/types/tree/master/proto). You will get a Claim object.
|
||||
Perform a `getclaimbyid` call to lbrycrd using the claim ID for the claim you want to look up. You should get a response with some parameters. The `value` parameter contains the claim contents as a protobuf-encoded binary string. Decode the value using the protobuf definitions in [lbryio/types](https://github.com/lbryio/types/tree/master/v2/proto). You will get a Claim object.
|
||||
|
||||
|
||||
## Get the Stream Hash
|
||||
|
||||
@@ -33,7 +33,7 @@ For this example, we will use claimID `d9317ac7842f88ba442fee749c4f834353c24206`
|
||||
|
||||
## Parse the Metadata
|
||||
|
||||
Perform a `getclaimbyid` call to lbrycrd using the claimID for the claim you want to look up. You should get a response with some parameters. The `value` parameter contains the claim contents as a protobuf-encoded binary string. Decode the value using the protobuf definitions in [lbryio/types](https://github.com/lbryio/types/tree/master/proto). You will get a Claim object.
|
||||
Perform a `getclaimbyid` call to lbrycrd using the claimID for the claim you want to look up. You should get a response with some parameters. The `value` parameter contains the claim contents as a protobuf-encoded binary string. Decode the value using the protobuf definitions in [lbryio/types](https://github.com/lbryio/types/tree/master/v2/proto). You will get a Claim object.
|
||||
|
||||
|
||||
## Get the SD Hash
|
||||
|
||||
@@ -101,4 +101,4 @@ A template for issues should exist to guide users in correctly filing them.
|
||||
|
||||
## Style and Formatting Notes
|
||||
|
||||
- Rely on autowrap instead of manually breaking up paragraphs with carriage return.
|
||||
- Rely on autowrap instead of manually breaking up paragraphs with a carriage return.
|
||||
@@ -0,0 +1,100 @@
|
||||
# How To Run Your Own Wallet Server
|
||||
|
||||
This guide will walk you through the process of setting up a LBRY wallet server. This involves provisioning a web server and setting up some services (docker, lbrycrd, and the wallet server). At the end, you'll have your own connection to the LBRY network.
|
||||
|
||||
**note:** This is early-stage stuff. You may encounter unexpected issues. Please be patient and don't hesitate to [reach out for help](#get-in-touch).
|
||||
|
||||
|
||||
## Start With A Fresh Server
|
||||
|
||||
We recommend a dual-core server with at least 8GB RAM, 50GB disk, and a fresh Ubuntu 18.04 install.
|
||||
|
||||
I tested this guide on AWS using a `t3.large` instance and the `ami-07d0cf3af28718ef8` image. If you're using AWS, create your instance in the us-east-2 (Ohio) region. That's where our snapshots are stored, so downloading them will be faster for you.
|
||||
|
||||
Make sure your firewall has ports 9246 and 50001 open. 9246 is the port lbrycrd uses to communicate to other nodes. 50001 is the wallet server RPC port.
|
||||
|
||||
|
||||
## Set Up Docker
|
||||
|
||||
### Install Docker & Docker Compose
|
||||
```
|
||||
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common && \
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - && \
|
||||
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" && \
|
||||
sudo apt install -y docker-ce docker-ce-cli containerd.io && \
|
||||
sudo systemctl enable docker && sudo systemctl start docker && \
|
||||
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && \
|
||||
sudo chmod +x /usr/local/bin/docker-compose
|
||||
|
||||
```
|
||||
|
||||
### Download our docker-compose.yml
|
||||
|
||||
You can see it [here](https://github.com/lbryio/lbry-sdk/blob/master/docker/docker-compose-wallet-server.yml).
|
||||
```
|
||||
curl -L "https://raw.githubusercontent.com/lbryio/lbry-sdk/master/docker/docker-compose-wallet-server.yml" -o docker-compose.yml
|
||||
```
|
||||
|
||||
## Turn It On
|
||||
|
||||
### Start the servers
|
||||
```
|
||||
sudo docker-compose up --detach
|
||||
```
|
||||
|
||||
### Check that everything worked
|
||||
|
||||
The first time you start the wallet server, it will take a few minutes to download a recent snapshot of the database and extract it. You can follow the progress with
|
||||
|
||||
```
|
||||
sudo docker-compose logs --follow
|
||||
```
|
||||
|
||||
After the wallet server has caught up, it will bind to port 50001 and start responding to requests. You can check if this happened by running
|
||||
|
||||
```
|
||||
sudo netstat -tlpn | grep 50001
|
||||
```
|
||||
|
||||
If there is no output, the port is ont bound yet and the server is still catching up. Check the logs for more info.
|
||||
|
||||
After the wallet server is ready, check that it responds to basic RPC calls:
|
||||
|
||||
```
|
||||
echo '{"id":1,"method":"server.version"}' | timeout 1 curl telnet://localhost:50001
|
||||
```
|
||||
|
||||
You should see a response like `{"jsonrpc": "2.0", "result": ["0.46.1", "0.0"], "id": 1}`. If you do, congratulations! You've set up your own wallet server.
|
||||
|
||||
|
||||
## Maintenance
|
||||
|
||||
### Stopping and Restarting
|
||||
|
||||
Use the usual docker-compose commands (`start`, `stop`, `pause`, etc) to control the servers. Run `docker-compose --help` to see the
|
||||
options.
|
||||
|
||||
|
||||
### Updating
|
||||
|
||||
To update to the latest wallet server release, run the following:
|
||||
```
|
||||
docker pull lbry/wallet-server:latest-release
|
||||
docker-compose down
|
||||
docker-compose up --detach
|
||||
```
|
||||
|
||||
### Resyncing
|
||||
|
||||
From time to time, we'll release an update that requires erasing the wallet server database and recreating it from scratch. The process is
|
||||
similar to an update, but causes the server to be down for much longer. Here's how to do it:
|
||||
```
|
||||
docker pull lbry/wallet-server:latest-release
|
||||
docker-compose down
|
||||
docker volume rm "$(whoami)_wallet_server"
|
||||
WALLET_SERVER_SNAPSHOT_URL= docker-compose up --detach
|
||||
```
|
||||
|
||||
## Get in touch
|
||||
|
||||
Whether you got to the end without a hiccup or you got stuck along the way, we want to hear from you. [Join our Discord](https://discord.gg/y3W9JuS) to get help, stay updated, and talk to other wallet server operators.
|
||||
Generated
+10961
File diff suppressed because it is too large.
Load diff
+2
-1
@@ -44,7 +44,8 @@
|
||||
"redis": "^2.8.0",
|
||||
"slack-node": "^0.1.8",
|
||||
"socket.io": "^2.2.0",
|
||||
"stringify-object": "^3.3.0"
|
||||
"stringify-object": "^3.3.0",
|
||||
"request": "latest"
|
||||
},
|
||||
"description": "Documentation for the LBRY protocol and associated projects",
|
||||
"devDependencies": {
|
||||
|
||||
Reference in new issue
Block a user