From 18a0a71594b747db27e9aade474d21110daf86fd 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: Mon, 18 Feb 2019 14:31:48 -0600 Subject: [PATCH] Fixes --- .env.sample | 5 ----- app/components/client/devprogram-scripts.js | 8 +++++++ app/components/developer-program.js | 25 ++++++++++++++++----- app/dist/scripts/api.js | 11 +++------ app/sass/pages/_developer.scss | 11 +++++++++ app/sockets.js | 18 +++++++-------- documents/developer-program.md | 8 ------- 7 files changed, 50 insertions(+), 36 deletions(-) diff --git a/.env.sample b/.env.sample index e678ba4..ad58247 100644 --- a/.env.sample +++ b/.env.sample @@ -6,12 +6,7 @@ DAEMON_URL= # /developer-program GITHUB_APP_ID= GITHUB_APP_SECRET= - -GITHUB_APP_ID_TEST= -GITHUB_APP_SECRET_TEST= - REWARD_URL= -REWARD_URL_TEST= # https://developer.github.com/apps/building-oauth-apps/creating-an-oauth-app # We use this to show the GitHub feed on the homepage diff --git a/app/components/client/devprogram-scripts.js b/app/components/client/devprogram-scripts.js index 822855f..da03f97 100644 --- a/app/components/client/devprogram-scripts.js +++ b/app/components/client/devprogram-scripts.js @@ -19,6 +19,14 @@ if (window.location.search.includes("?code=")) { + +

To receive your LBC, you'll need a wallet address. While graphical wallets are available, the recommended path for engineers is to:

+ +
    +
  1. Download the LBRY SDK.
  2. +
  3. Launch the command-line utility.
  4. +
  5. Run the address_unused command.
  6. +
`; history.replaceState({}, "", window.location.pathname); // clean up URL bar diff --git a/app/components/developer-program.js b/app/components/developer-program.js index 53bae6b..c69085f 100644 --- a/app/components/developer-program.js +++ b/app/components/developer-program.js @@ -10,8 +10,23 @@ import html from "choo/html"; // E X P O R T -export default () => html` - -

If this sounds like you, get started here!

-
-`; +export default () => { + if ( + !process.env.GITHUB_APP_ID || + !process.env.GITHUB_APP_SECRET || + !process.env.REWARD_URL + ) { + return html` + +

Environment variables required to enable functionality are missing.

+
+ `; + } + + return html` + + + This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY. + + `; +}; diff --git a/app/dist/scripts/api.js b/app/dist/scripts/api.js index bb6f8d2..f9869a7 100644 --- a/app/dist/scripts/api.js +++ b/app/dist/scripts/api.js @@ -45,14 +45,9 @@ function handleApiLanguageToggles(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"); + examples.forEach(example => example.classList.remove("active")); + codeExamples.forEach(example => example.classList.add("active")); + toggles.forEach(example => example.classList.remove("active")); document.getElementById(`toggle-${language}`).classList.add("active"); }); diff --git a/app/sass/pages/_developer.scss b/app/sass/pages/_developer.scss index a22be52..661b663 100644 --- a/app/sass/pages/_developer.scss +++ b/app/sass/pages/_developer.scss @@ -1,3 +1,14 @@ developer-program { @extend %markdown; + + .button { + margin: 2rem auto 1rem; + display: block; + } + + small { + display: block; + font-size: 0.8rem; + text-align: center; + } } diff --git a/app/sockets.js b/app/sockets.js index bf309b8..f18bc32 100644 --- a/app/sockets.js +++ b/app/sockets.js @@ -13,17 +13,15 @@ import fetchMetadata from "@helper/fetch-metadata"; import { generateGitHubFeed } from "@helper/github"; import messageSlack from "@helper/slack"; -const apiUrl = process.env.NODE_ENV === "development" ? - process.env.REWARD_URL_TEST : - process.env.REWARD_URL; +let apiUrl = process.env.REWARD_URL; +let githubAppId = process.env.GITHUB_APP_ID; +let githubAppSecret = process.env.GITHUB_APP_SECRET; -const githubAppId = process.env.NODE_ENV === "development" ? - process.env.GITHUB_APP_ID_TEST : - process.env.GITHUB_APP_ID; - -const githubAppSecret = process.env.NODE_ENV === "development" ? - process.env.GITHUB_APP_SECRET_TEST : - process.env.GITHUB_APP_SECRET; +if (process.env.NODE_ENV === "development") { + apiUrl = process.env.REWARD_URL_TEST; + githubAppId = process.env.GITHUB_APP_ID_TEST; + githubAppSecret = process.env.GITHUB_APP_SECRET_TEST; +} diff --git a/documents/developer-program.md b/documents/developer-program.md index 435e80c..fa8102b 100644 --- a/documents/developer-program.md +++ b/documents/developer-program.md @@ -10,11 +10,3 @@ To qualify you must: - Have made a public pull request within the past year. - -(below here should be hidden until click) - -To receive your LBC, you'll need a wallet address. While graphical wallets are available, the recommended path for engineers is to: - -1. Download [the LBRY SDK](https://github/lbryio/lbry). -1. Launch the command-line utility. -1. Run the [`address_unused`](https://lbry.tech/api/sdk#address_unused) command.