Compare commits

..
Author SHA1 Message Date
Sean Yesmunt c1c6549dd2 allow site to be ran without a github token 2019-10-28 00:36:15 -04:00
14 changed files with 85 additions and 11112 deletions

No files matched your search

+1
View File
@@ -0,0 +1 @@
package-lock=false
+1
View File
@@ -25,6 +25,7 @@
## Prerequisites
- [lbry/web-daemon](https://github.com/lbryio/web-daemon)
- [Node](https://nodejs.org) (version >= 10)
## Notes
+2 -1
View File
@@ -22,7 +22,8 @@ export default () => `
<div>
<span><a href="https://github.com/lbryio/lbrycrd">lbrycrd</a></span>
<span><a href="https://github.com/lbryio/lbry-sdk">SDK</a></span>
<span><a href="https://github.com/lbryio/torba">torba</a></span>
<span><a href="https://github.com/lbryio/lbryumx">lbryumx</a></span>
</div>
</h2>
+1 -1
View File
@@ -31,7 +31,7 @@ export default pagePath => {
break;
case "/api/sdk":
githubUrl = "https://github.com/lbryio/lbry-sdk/blob/master/docs/api.json";
githubUrl = "https://github.com/lbryio/lbry-sdk/blob/master/lbry/docs/api.json";
break;
default:
+2 -3
View File
@@ -16,7 +16,7 @@ let resolve = function(urls) {
return new Promise(function(resolve, reject) {
let options = {
method: "POST",
url: "https://api.lbry.tv/api/v1/proxy",
url: "https://api.lbry.tv/api/proxy",
headers:
{
"Content-Type": "application/json"
@@ -54,7 +54,7 @@ let getTrending = function() {
return new Promise(function(resolve, reject) {
let options = {
method: "POST",
url: "https://api.lbry.tv/api/v1/proxy",
url: "https://api.lbry.tv/api/proxy",
headers:
{
"Content-Type": "application/json"
@@ -107,7 +107,6 @@ let getTrending = function() {
} else
return resolve(daemonResponse.result.items);
});
});
};
+70 -39
View File
@@ -1,7 +1,5 @@
"use strict";
// I M P O R T S
import asyncHtml from "choo-async/html";
@@ -17,24 +15,20 @@ import redirects from "~data/redirects.json";
const cache = new Map();
const filePathBlockchain = "/contrib/devtools/generated/api_v1.json";
const filePathSdk = "/docs/api.json";
const filePathSdk = "/lbry/docs/api.json";
const rawGitHubBase = "https://raw.githubusercontent.com/lbryio/";
const octokit = new Octokit({
auth: `token ${process.env.GITHUB_OAUTH_TOKEN}`
});
// E X P O R T
export default async(state) => {
export default async state => {
const { tag } = state;
const { wildcard } = state.params;
const repository = wildcard === "sdk" ?
"lbry-sdk" :
"lbrycrd";
const repository = wildcard === "sdk" ? "lbry-sdk" : "lbrycrd";
state.lbry = {
title: tag ? tag + " API Documentation" : "API Documentation",
@@ -120,8 +114,6 @@ export default async(state) => {
}
};
// H E L P E R S
function createApiContent(apiDetails) {
@@ -130,20 +122,33 @@ function createApiContent(apiDetails) {
apiDetails.forEach(apiDetail => {
let apiDetailsReturns = "";
if (apiDetail.returns)
apiDetailsReturns = JSON.parse(JSON.stringify(apiDetail.returns));
if (apiDetail.returns) apiDetailsReturns = JSON.parse(JSON.stringify(apiDetail.returns));
apiContent.push(`
<div class="api-content__body">
<h2 id="${apiDetail.name}">${apiDetail.name}</h2>
<p>${apiDetail.description}</p>
${apiDetail.arguments.length ? `<h3>Arguments</h3><ul class="api-content__body-arguments">${renderArguments(apiDetail.arguments).join("")}</ul>` : ""}
${apiDetail.returns ? `<h3>Returns</h3><pre><code>${dedent(apiDetailsReturns)}</code></pre>` : ""}
${
apiDetail.arguments.length ?
`<h3>Arguments</h3><ul class="api-content__body-arguments">${renderArguments(
apiDetail.arguments
).join("")}</ul>` :
""
}
${
apiDetail.returns ?
`<h3>Returns</h3><pre><code>${dedent(apiDetailsReturns)}</code></pre>` :
""
}
</div>
<div class="api-content__example">
${apiDetail.examples && apiDetail.examples.length ? renderExamples(apiDetail.examples).join("") : `<pre><code>// example(s) for ${apiDetail.name} to come later</code></pre>`}
${
apiDetail.examples && apiDetail.examples.length ?
renderExamples(apiDetail.examples).join("") :
`<pre><code>// example(s) for ${apiDetail.name} to come later</code></pre>`
}
</div>
`);
});
@@ -229,7 +234,12 @@ function createSdkSidebar(apiDetails) {
apiSidebar.push(`
<ul class="api-toc__section">
<li class="api-toc__title">${title}</li>
${(commands.map(command => `<li class="api-toc__command"><a href="#${command.name}" title="Go to ${command.name} section">${command.name}</a></li>`)).join("")}
${commands
.map(
command =>
`<li class="api-toc__command"><a href="#${command.name}" title="Go to ${command.name} section">${command.name}</a></li>`
)
.join("")}
</ul>
`);
});
@@ -254,7 +264,17 @@ async function getTags(repositoryName) {
switch(true) {
case repositoryName === "lbry-sdk":
data.forEach(tag => {
if (tag.name >= "v0.52.0") tags.push(tag.name);
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);
});
break;
@@ -266,7 +286,8 @@ async function getTags(repositoryName) {
tag.name !== "v0.3.15" &&
tag.name !== "v0.3-osx" &&
tag.name !== "v0.2-alpha"
) tags.push(tag.name);
)
tags.push(tag.name);
});
break;
@@ -281,11 +302,11 @@ async function parseApiFile({ repo, tag }) {
let apiFileLink = `${rawGitHubBase}${repo}/${tag}`;
switch(true) {
case (repo === "lbrycrd"):
case repo === "lbrycrd":
apiFileLink = `${apiFileLink}${filePathBlockchain}`;
break;
case (repo === "lbry-sdk"):
case repo === "lbry-sdk":
apiFileLink = `${apiFileLink}${filePathSdk}`;
break;
@@ -305,8 +326,7 @@ async function parseApiFile({ repo, tag }) {
function renderArguments(args) {
const argumentContent = [];
if (!args || args.length === 0)
return argumentContent;
if (!args || args.length === 0) return argumentContent;
args.forEach(arg => {
argumentContent.push(`
@@ -316,7 +336,11 @@ function renderArguments(args) {
${arg.is_required === true ? "" : "<span>optional</span>"}<span>${arg.type}</span>
</div>
<div class="right">${typeof arg.description === "string" ? arg.description.replace(/</g, "&lt;").replace(/>/g, "&gt;") : ""}</div>
<div class="right">${
typeof arg.description === "string" ?
arg.description.replace(/</g, "&lt;").replace(/>/g, "&gt;") :
""
}</div>
</li>
`);
});
@@ -340,11 +364,15 @@ function renderExamples(args) {
${arg.lbrynet ? `<pre data-api-example-type="lbrynet"><code>${arg.lbrynet}</code></pre>` : ""}
${arg.python ? `<pre data-api-example-type="python"><code>${arg.python}</code></pre>` : ""}
${arg.output ? `
${
arg.output ?
`
<h3>Output</h3><br/>
<pre><code>${arg.output}</code></pre>
<hr/>
` : ""}
` :
""
}
`);
});
@@ -354,17 +382,14 @@ function renderExamples(args) {
function renderReturns(args) {
let returnContent = [];
if (!args || args.length === 0)
return returnContent;
if (!args || args.length === 0) return returnContent;
returnContent = dedent(JSON.parse(JSON.stringify(args)));
return returnContent;
}
function renderVersionSelector(pageSlug, versions, desiredTag) {
const options = [
"<option disabled>Select a version</option>"
];
const options = ["<option disabled>Select a version</option>"];
let optionIndex = 0;
@@ -372,13 +397,13 @@ function renderVersionSelector(pageSlug, versions, desiredTag) {
optionIndex++;
let selectedOption = false;
if (desiredTag && desiredTag === version)
selectedOption = true;
else if (optionIndex === 1)
selectedOption = true;
if (desiredTag && desiredTag === version) selectedOption = true;
else if (optionIndex === 1) selectedOption = true;
options.push(
`<option value="${pageSlug}-${version}"${selectedOption ? " selected" : ""}>${version}</option>`
`<option value="${pageSlug}-${version}"${
selectedOption ? " selected" : ""
}>${version}</option>`
);
});
@@ -390,9 +415,15 @@ function renderCodeLanguageToggles(pageSlug) {
return [
"<button class='api-content__item menu' id='toggle-menu'>menu</button>",
!onSdkPage ? "<button class='api-content__item' id='toggle-cli' type='button'>cli</button>" : "",
!onSdkPage ?
"<button class='api-content__item' id='toggle-cli' type='button'>cli</button>" :
"",
"<button class='api-content__item' id='toggle-curl' type='button'>curl</button>",
onSdkPage ? "<button class='api-content__item' id='toggle-lbrynet' type='button'>lbrynet</button>" : "",
onSdkPage ? "<button class='api-content__item' id='toggle-python' type='button'>python</button>" : ""
onSdkPage ?
"<button class='api-content__item' id='toggle-lbrynet' type='button'>lbrynet</button>" :
"",
onSdkPage ?
"<button class='api-content__item' id='toggle-python' type='button'>python</button>" :
""
];
}
+1 -1
View File
@@ -83,7 +83,7 @@ export default () => html`
<section class="community">
<div class="inner-wrap">
<h3>Community</h3>
<p>There's literally <a href="https://lbry.tv/@lbrytech:1/dozens:e">12n</a> of us.</p>
<p>There's literally <a href="https://spee.ch/@lbrytech/dozens.mp4">12<sup>n</sup></a> of us.</p>
<ul>
<li><a href="//chat.lbry.com" title="LBRY on Discord">Chat</a></li>
+4 -2
View File
@@ -22,8 +22,10 @@ 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 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. | |
| [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. | |
### Official Applications
| Application | Language (Toolset) | What Is It | Intro Video
+1 -1
View File
@@ -43,7 +43,7 @@ An open, distributed ledger that records transactions in a verifiable and change
### 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.
Similar to the [Short URL](#short-url) but for claims that are signed by channels, both the channel Short URL and claim Short URL are returned (i.e. lbry://@LBRY-Social#d/two#f. A canonical URL will change if the channel is updated, therefore its less permanent than a Short URL which is less permanent than the [Permanent URL](https://spec.lbry.com/#urls).
### Chainquery
-1
View File
@@ -18,4 +18,3 @@ 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)
+1 -1
View File
@@ -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/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/lbry/conf.py).
## Daemon settings configuration
+1 -1
View File
@@ -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 a carriage return.
- Rely on autowrap instead of manually breaking up paragraphs with carriage return.
-100
View File
@@ -1,100 +0,0 @@
# 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.
-10961
View File
File diff suppressed because it is too large. Load diff