From 3b3923210c0ff58e40d68cd86c3b3cb287069755 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=9D=E3=83=BC=E3=83=AB=20=E3=82=A6=E3=82=A7=E3=83=83?= =?UTF-8?q?=E3=83=96?= Date: Fri, 24 Aug 2018 16:58:04 -0500 Subject: [PATCH] Refactoring --- views/pages/home.js | 2 +- views/pages/page.js | 14 +- views/partials/ecosystem.js | 316 ++++-------------- .../partials/ecosystem/module-applications.js | 50 +++ views/partials/ecosystem/module-lbry.js | 51 +++ views/partials/ecosystem/module-lbrycrd.js | 48 +++ .../ecosystem/submodule-chainquery.js | 37 ++ .../ecosystem/submodule-lighthouse.js | 37 ++ .../partials/ecosystem/submodule-reflector.js | 37 ++ views/partials/ecosystem/submodule-wallet.js | 37 ++ views/partials/navigation.js | 2 +- 11 files changed, 369 insertions(+), 262 deletions(-) create mode 100644 views/partials/ecosystem/module-applications.js create mode 100644 views/partials/ecosystem/module-lbry.js create mode 100644 views/partials/ecosystem/module-lbrycrd.js create mode 100644 views/partials/ecosystem/submodule-chainquery.js create mode 100644 views/partials/ecosystem/submodule-lighthouse.js create mode 100644 views/partials/ecosystem/submodule-reflector.js create mode 100644 views/partials/ecosystem/submodule-wallet.js diff --git a/views/pages/home.js b/views/pages/home.js index a27f856..fb6908d 100755 --- a/views/pages/home.js +++ b/views/pages/home.js @@ -4,7 +4,7 @@ // P A C K A G E -const html = require("choo-async/html"); +const html = require("choo/html"); diff --git a/views/pages/page.js b/views/pages/page.js index 2ef897a..d1c9adf 100644 --- a/views/pages/page.js +++ b/views/pages/page.js @@ -5,7 +5,6 @@ // P A C K A G E S const decamelize = require("decamelize"); -const dedent = require("dedent"); const exists = require("fs-exists-sync"); const fm = require("front-matter"); const fs = require("graceful-fs"); @@ -75,7 +74,8 @@ module.exports = exports = () => async state => { const markdownFile = fs.readFileSync(`./documents/${path}.md`, "utf-8"); const markdownFileDetails = fm(markdownFile); - const renderedMarkdown = md.render(partialFinder(markdownFileDetails.body)); + const renderedMarkdown = md.render(markdownFileDetails.body); + const updatedMarkdown = partialFinder(renderedMarkdown); let newMetadata = ""; if (markdownFileDetails.attributes.meta) newMetadata = markdownFileDetails.attributes.meta; @@ -96,7 +96,7 @@ module.exports = exports = () => async state => {
- ${raw(renderedMarkdown)} + ${raw(updatedMarkdown)} ${raw(pageScript)} ${newMetadata.length ? raw(updateMetadata(newMetadata)) : ""}
@@ -152,7 +152,7 @@ function partialFinder(markdownBody) { } } - return dedent(markdownBody); // partials get rendered as code snippets w/o `dedent` + return markdownBody; } function updateMetadata(metadataDetails) { @@ -162,9 +162,7 @@ function updateMetadata(metadataDetails) { generatedMetadata.push(createMetaTags(metadataDetail)); } - return dedent` - + return html` + `; } diff --git a/views/partials/ecosystem.js b/views/partials/ecosystem.js index 728ad4c..a88a5a8 100644 --- a/views/partials/ecosystem.js +++ b/views/partials/ecosystem.js @@ -5,265 +5,77 @@ // P A C K A G E S const Component = require("choo/component"); -const dedent = require("dedent"); -const html = require("choo-async/html"); +const html = require("choo/html"); + +// V A R I A B L E S + +const APPLICATIONS = require("./ecosystem/module-applications"); +const CHAINQUERY = require("./ecosystem/submodule-chainquery"); +const LBRY = require("./ecosystem/module-lbry"); +const LBRYCRD = require("./ecosystem/module-lbrycrd"); +const LIGHTHOUSE = require("./ecosystem/submodule-lighthouse"); +const REFLECTOR = require("./ecosystem/submodule-reflector"); +const WALLET = require("./ecosystem/submodule-wallet"); // E X P O R T -module.exports = exports = class Ecosystem extends Component { - constructor() { - super(); +Ecosystem.prototype = Object.create(Component.prototype); - this.subModuleChainquery = html` -
-

chainquery

+Ecosystem.prototype.createElement = () => { + return html` +
+ -
-

Overview

-

The model of Chainquery at its foundation consists of the fundamental data types found in the blockchain. This information is then expounded on with additional columns and tables that make querying the data much easier.

- -

Connection to...

-

- -

Source

- - -
    -
  • Applications
  • -
  • Blockchain
  • -
  • Data Network
  • -
  • ×
  • -
-
-
- `; - - this.subModuleWallet = html` -
-

wallet server

- -
-

Overview

-

The LBRY app is a graphical browser for the decentralized content marketplace provided by the LBRY protocol. It is essentially the lbry daemon bundled with an UI using Electron.

- -

Connection to...

-

- -

Source

- - -
    -
  • Applications
  • -
  • Blockchain
  • -
  • Data Network
  • -
  • ×
  • -
-
-
- `; - - this.subModuleLighthouse = html` -
-

lighthouse

- -
-

Overview

-

Lighthouse is a lightning-fast advanced search engine API for publications on the lbrycrd with autocomplete capabilities.

- -

Connection to...

-

- -

Source

- - -
    -
  • Applications
  • -
  • Blockchain
  • -
  • Data Network
  • -
  • ×
  • -
-
-
- `; - - this.subModuleReflector = html` -
-

reflector

- -
-

Overview

-

A reflector cluster to accept LBRY content for hosting en masse, rehost the content, and make money on data fees (TODO). This code includes Go implementations of the LBRY peer protocol, reflector protocol, and DHT.

- -

Connection to...

-

- -

Source

- - -
    -
  • Applications
  • -
  • Blockchain
  • -
  • Data Network
  • -
  • ×
  • -
-
-
- `; - - this.moduleLbrycrd = html` -
- × - -

- - Blockchain - The foundation of the LBRY protocol - - -
- lbrycrd -
-

- -
-

This section assumes "blockchain" already means something to you. If you're totally new, the key problem solved by blockhain is the ability for distributed, disparate entities to all agree on a rivalrous state of affairs. For a more comprehensive introduction to blockchain, try starting [here]

- -

The LBRY blockchain is a public, proof-of-work of work blockchain consensus. It is the foundation of the protocol stack.

- -

The most salient feature of the LBRY blockchain is the association of a normalized character string with up to 8KB of metadata. This string of characters forms a LBRY URL, e.g. lbry://hellolbry

- -

The LBRY blockchain contains two parallel [[Merkle Tree]]s, one for transactions (ala Bitcoin) and one for storing LBRY URLs and metadata. This allows LBRY URLs to be trustfully resolved even without a full copy of the blockchain.

- -

Conventionally, this metadata contains information about the content, such as the title and creator, the price (if any), and a unique signature allowing the actual content to be fetched from the data network, the next level in the LBRY stack.

- -

Additional Resources

-
    -
  • See the [[Whitepaper]] for a more comprehensive introduction to the LBRY blockchain.
  • -
  • See the [[Resources]] for documentation about the LBRY blockchain, including its API.
  • -
  • See [[Naming]] for learning more about LBRY URLs and how they work.
  • -
  • See [[Identities]] for learning how the LBRY blockchain handles publisher identities.
  • -
-
-
- `; - - this.moduleLbry = html` -
- × - -

- - Data Network - The "nuts and bolts" (fix this) of the LBRY protocol - - -
- lbry - lbryschema - torba -
-

- -
-

While blockchain is the innovation that makes LBRY possible, the Data Network is the layer that actually makes the blockchain useful.

-

The primary component for this level is lbry, a daemon that:

- -
    -
  • Interprets and validates metadata in the LBRY blockchain via [lbryschema].
  • -
  • Accesses and distributes the data referenced by metadata in the LBRY blockchain via a peer-to-peer network.
  • -
  • Provides wallet functionality via an [[SPV]] wallet ([torba]).
  • -
  • Facilitates building applications by being easily bundable and providing a simple, clean API for the LBRY protocol.
  • -
-

Unless choosing to re-implement aspects of the LBRY protocol by hand, most applications that interact with the LBRY network will bundle lbry.

- -

Additional Resources

-
    -
  • See the [[Whitepaper]] for a more comprehensive introduction to the LBRY data network.
  • -
  • See [[Resources]] for documentation of the LBRY APIs.
  • -
  • See [[Whatever]] for learning more about LBRY distributes data.
  • -
  • See [[Build]] for learning how to use the daemon to solve your own problem or build your own app!
  • -
-
-
- `; - - this.moduleApplications = html` -
- × - -

- - Applications - Browsers, spee.ch, and ∞ - - -
- android - desktop - spee.ch -
-

- -
-

Applications are the final level of the LBRY stack, and they represent how most people will actually use LBRY.

-

LBRY Inc. currently releases and maintains three applications:

- -
    -
  • lbry-desktop, a desktop browser for the LBRY network based in React and Electron.
  • -
  • lbry-android, an Android browser for the LBRY network in React Native.
  • -
  • spee.ch, a web-based viewer and link dump for free LBRY content.
  • -
- -

However, the very idea of LBRY is that there's not just one way to interact with the network. Anyone can build on top of LBRY in a permissionless manner. These applications exist to show what's possible and to give new users a user-friendly way to use LBRY.

- -

Additional Resources

-
    -
  • See [[Contribute]] for learning how to contribute to existing LBRY apps.
  • -
  • See [[Something]] for how to set up your own custom instance of spee.ch.
  • -
  • See [[Build]] for learning how to build your own app!
  • -
-
-
- `; - } - - createElement() { - return dedent` -
- -
- ${this.moduleLbrycrd} - ${this.moduleLbry} - ${this.moduleApplications} -
- +
+ ${LBRYCRD()} + ${LBRY()} + ${APPLICATIONS()}
- `; - } - load() { - } - - unload() { - } - - update() { - return false; - } + +
+ `; }; + +/* +module.exports = exports = (state, emit) => { // eslint-disable-line + return html` +
+ + +
+ ${LBRYCRD} + ${LBRY} + ${APPLICATIONS} +
+ + +
+ `; +}; +*/ + +function Ecosystem() { + if (!(this instanceof Ecosystem)) return new Ecosystem(); + Component.call(this); +} + + + +// E X P O R T + +module.exports = exports = Ecosystem; diff --git a/views/partials/ecosystem/module-applications.js b/views/partials/ecosystem/module-applications.js new file mode 100644 index 0000000..052f73d --- /dev/null +++ b/views/partials/ecosystem/module-applications.js @@ -0,0 +1,50 @@ +"use strict"; + + + +// P A C K A G E + +const html = require("choo/html"); + + + +// E X P O R T + +module.exports = exports = () => html` +
+ × + +

+ + Applications + Browsers, spee.ch, and ∞ + + +
+ android + desktop + spee.ch +
+

+ +
+

Applications are the final level of the LBRY stack, and they represent how most people will actually use LBRY.

+

LBRY Inc. currently releases and maintains three applications:

+ +
    +
  • lbry-desktop, a desktop browser for the LBRY network based in React and Electron.
  • +
  • lbry-android, an Android browser for the LBRY network in React Native.
  • +
  • spee.ch, a web-based viewer and link dump for free LBRY content.
  • +
+ +

However, the very idea of LBRY is that there's not just one way to interact with the network. Anyone can build on top of LBRY in a permissionless manner. These applications exist to show what's possible and to give new users a user-friendly way to use LBRY.

+ +

Additional Resources

+
    +
  • See Contribute for learning how to contribute to existing LBRY apps.
  • +
  • See [[Something]] for how to set up your own custom instance of spee.ch.
  • +
  • See Build for learning how to build your own app!
  • +
+
+
+`; diff --git a/views/partials/ecosystem/module-lbry.js b/views/partials/ecosystem/module-lbry.js new file mode 100644 index 0000000..cbe7ba1 --- /dev/null +++ b/views/partials/ecosystem/module-lbry.js @@ -0,0 +1,51 @@ +"use strict"; + + + +// P A C K A G E + +const html = require("choo/html"); + + + +// E X P O R T + +module.exports = exports = () => html` +
+ × + +

+ + Data Network + The "nuts and bolts" (fix this) of the LBRY protocol + + +
+ lbry + lbryschema + torba +
+

+ +
+

While blockchain is the innovation that makes LBRY possible, the Data Network is the layer that actually makes the blockchain useful.

+

The primary component for this level is lbry, a daemon that:

+ +
    +
  • Interprets and validates metadata in the LBRY blockchain via [lbryschema].
  • +
  • Accesses and distributes the data referenced by metadata in the LBRY blockchain via a peer-to-peer network.
  • +
  • Provides wallet functionality via an [[SPV]] wallet ([torba]).
  • +
  • Facilitates building applications by being easily bundable and providing a simple, clean API for the LBRY protocol.
  • +
+

Unless choosing to re-implement aspects of the LBRY protocol by hand, most applications that interact with the LBRY network will bundle lbry.

+ +

Additional Resources

+
    +
  • See the Whitepaper for a more comprehensive introduction to the LBRY data network.
  • +
  • See Resources for documentation of the LBRY APIs.
  • +
  • See [[Whatever]] for learning more about LBRY distributes data.
  • +
  • See Build for learning how to use the daemon to solve your own problem or build your own app!
  • +
+
+
+`; diff --git a/views/partials/ecosystem/module-lbrycrd.js b/views/partials/ecosystem/module-lbrycrd.js new file mode 100644 index 0000000..9e483c7 --- /dev/null +++ b/views/partials/ecosystem/module-lbrycrd.js @@ -0,0 +1,48 @@ +"use strict"; + + + +// P A C K A G E + +const html = require("choo/html"); + + + +// E X P O R T + +module.exports = exports = () => html` +
+ × + +

+ + Blockchain + The foundation of the LBRY protocol + + +
+ lbrycrd +
+

+ +
+

This section assumes "blockchain" already means something to you. If you're totally new, the key problem solved by blockhain is the ability for distributed, disparate entities to all agree on a rivalrous state of affairs. For a more comprehensive introduction to blockchain, try starting [here]

+ +

The LBRY blockchain is a public, proof-of-work of work blockchain consensus. It is the foundation of the protocol stack.

+ +

The most salient feature of the LBRY blockchain is the association of a normalized character string with up to 8KB of metadata. This string of characters forms a LBRY URL, e.g. lbry://hellolbry

+ +

The LBRY blockchain contains two parallel [[Merkle Tree]]s, one for transactions (ala Bitcoin) and one for storing LBRY URLs and metadata. This allows LBRY URLs to be trustfully resolved even without a full copy of the blockchain.

+ +

Conventionally, this metadata contains information about the content, such as the title and creator, the price (if any), and a unique signature allowing the actual content to be fetched from the data network, the next level in the LBRY stack.

+ +

Additional Resources

+
    +
  • See the Whitepaper for a more comprehensive introduction to the LBRY blockchain.
  • +
  • See the Resources for documentation about the LBRY blockchain, including its API.
  • +
  • See [[Naming]] for learning more about LBRY URLs and how they work.
  • +
  • See [[Identities]] for learning how the LBRY blockchain handles publisher identities.
  • +
+
+
+`; diff --git a/views/partials/ecosystem/submodule-chainquery.js b/views/partials/ecosystem/submodule-chainquery.js new file mode 100644 index 0000000..03f7449 --- /dev/null +++ b/views/partials/ecosystem/submodule-chainquery.js @@ -0,0 +1,37 @@ +"use strict"; + + + +// P A C K A G E + +const html = require("choo/html"); + + + +// E X P O R T + +module.exports = exports = () => html` +
+

chainquery

+ +
+

Overview

+

The model of Chainquery at its foundation consists of the fundamental data types found in the blockchain. This information is then expounded on with additional columns and tables that make querying the data much easier.

+ +

Connection to...

+

+ +

Source

+ + +
    +
  • Applications
  • +
  • Blockchain
  • +
  • Data Network
  • +
  • ×
  • +
+
+
+`; diff --git a/views/partials/ecosystem/submodule-lighthouse.js b/views/partials/ecosystem/submodule-lighthouse.js new file mode 100644 index 0000000..32917ba --- /dev/null +++ b/views/partials/ecosystem/submodule-lighthouse.js @@ -0,0 +1,37 @@ +"use strict"; + + + +// P A C K A G E + +const html = require("choo/html"); + + + +// E X P O R T + +module.exports = exports = () => html` +
+

lighthouse

+ +
+

Overview

+

Lighthouse is a lightning-fast advanced search engine API for publications on the lbrycrd with autocomplete capabilities.

+ +

Connection to...

+

+ +

Source

+ + +
    +
  • Applications
  • +
  • Blockchain
  • +
  • Data Network
  • +
  • ×
  • +
+
+
+`; diff --git a/views/partials/ecosystem/submodule-reflector.js b/views/partials/ecosystem/submodule-reflector.js new file mode 100644 index 0000000..558a531 --- /dev/null +++ b/views/partials/ecosystem/submodule-reflector.js @@ -0,0 +1,37 @@ +"use strict"; + + + +// P A C K A G E + +const html = require("choo/html"); + + + +// E X P O R T + +module.exports = exports = () => html` +
+

reflector

+ +
+

Overview

+

A reflector cluster to accept LBRY content for hosting en masse, rehost the content, and make money on data fees (TODO). This code includes Go implementations of the LBRY peer protocol, reflector protocol, and DHT.

+ +

Connection to...

+

+ +

Source

+ + +
    +
  • Applications
  • +
  • Blockchain
  • +
  • Data Network
  • +
  • ×
  • +
+
+
+`; diff --git a/views/partials/ecosystem/submodule-wallet.js b/views/partials/ecosystem/submodule-wallet.js new file mode 100644 index 0000000..4fba9eb --- /dev/null +++ b/views/partials/ecosystem/submodule-wallet.js @@ -0,0 +1,37 @@ +"use strict"; + + + +// P A C K A G E + +const html = require("choo/html"); + + + +// E X P O R T + +module.exports = exports = () => html` +
+

wallet server

+ +
+

Overview

+

The LBRY app is a graphical browser for the decentralized content marketplace provided by the LBRY protocol. It is essentially the lbry daemon bundled with an UI using Electron.

+ +

Connection to...

+

+ +

Source

+ + +
    +
  • Applications
  • +
  • Blockchain
  • +
  • Data Network
  • +
  • ×
  • +
+
+
+`; diff --git a/views/partials/navigation.js b/views/partials/navigation.js index 8867406..3253884 100755 --- a/views/partials/navigation.js +++ b/views/partials/navigation.js @@ -4,7 +4,7 @@ // P A C K A G E -const html = require("choo-async/html"); +const html = require("choo/html"); // V A R I A B L E