LBRY Developer Program #255

Merged
NetOpWibby merged 15 commits from 209-quickstart into master 2019-02-19 23:22:28 +01:00
9 changed files with 76 additions and 38 deletions
Showing only changes of commit 48efa9da73 - Show all commits

View file

@ -1,11 +1,37 @@
"use strict"; /* global document, send */
"use strict"; /* global document, history, send, window */
document.getElementById("get-started").addEventListener("click", event => {
document.getElementById("get-started").onclick = event => {
event.preventDefault();
send({
message: "auth me with github"
});
};
if (window.location.search.includes("?code=")) {
document.querySelector("developer-program").innerHTML = `
<form>
<input-submit>
kauffj commented 2019-02-19 19:22:38 +01:00 (Migrated from github.com)
Review

This is still not styled correctly for me. Sending you a screenshot on Slack.

This is still not styled correctly for me. Sending you a screenshot on Slack.
<input id="walletAddress" placeholder="Your LBRY wallet address" type="text"/>
kauffj commented 2019-02-17 22:12:35 +01:00 (Migrated from github.com)
Review

Can this look stylistically similar or identical (and use the same classes/elements) to the input + button on the playground?

Can this look stylistically similar or identical (and use the same classes/elements) to the input + button on the playground?
NetOpWibby commented 2019-02-18 20:11:43 +01:00 (Migrated from github.com)
Review

Do you mean having lbry inside the input? Otherwise, the input/button on Playground is going to match what's on this page (not the other way around). It's the new component.

Do you mean having `lbry` inside the input? Otherwise, the input/button on Playground is going to match what's on this page (not the other way around). It's the new component.
kauffj commented 2019-02-18 23:03:29 +01:00 (Migrated from github.com)
Review

OK, if they're the same, consider this resolved. I thought they looked different when I checked, will confirm when PR is ready for review again.

OK, if they're the same, consider this resolved. I thought they looked different when I checked, will confirm when PR is ready for review again.
<input id="oauthCode" type="hidden" value="${window.location.search.split("?code=").pop()}"/>
<button id="creditsAcquire" title="Get LBRY credits" type="button">Get credits</button>
</input-submit>
</form>
`;
history.replaceState({}, "", window.location.pathname); // clean up URL bar
}
if (document.getElementById("creditsAcquire")) {
document.getElementById("creditsAcquire").onclick = () => {
send({
address: document.getElementById("walletAddress").value,
code: document.getElementById("oauthCode").value,
message: "verify github auth"
});
document.querySelector("developer-program").innerHTML = "<p><em>Awaiting response from internal LBRY API</em></p>";
};
}

View file

@ -0,0 +1,17 @@
kauffj commented 2019-02-17 22:14:10 +01:00 (Migrated from github.com)
Review

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".
kauffj commented 2019-02-17 22:14:35 +01:00 (Migrated from github.com)
Review

I was going to change this myself, but we don't have a button style?!

I was going to change this myself, but we don't have a button style?!
kauffj commented 2019-02-17 22:16:03 +01:00 (Migrated from github.com)
Review

This component should error cleanly if the relevant GitHub values aren't set.

This component should error cleanly if the relevant GitHub values aren't set.
kauffj commented 2019-02-17 22:14:10 +01:00 (Migrated from github.com)
Review

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".
kauffj commented 2019-02-17 22:14:35 +01:00 (Migrated from github.com)
Review

I was going to change this myself, but we don't have a button style?!

I was going to change this myself, but we don't have a button style?!
kauffj commented 2019-02-17 22:16:03 +01:00 (Migrated from github.com)
Review

This component should error cleanly if the relevant GitHub values aren't set.

This component should error cleanly if the relevant GitHub values aren't set.
"use strict";
kauffj commented 2019-02-17 22:14:10 +01:00 (Migrated from github.com)
Review

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".
kauffj commented 2019-02-17 22:14:35 +01:00 (Migrated from github.com)
Review

I was going to change this myself, but we don't have a button style?!

I was going to change this myself, but we don't have a button style?!
kauffj commented 2019-02-17 22:16:03 +01:00 (Migrated from github.com)
Review

This component should error cleanly if the relevant GitHub values aren't set.

This component should error cleanly if the relevant GitHub values aren't set.
kauffj commented 2019-02-17 22:14:10 +01:00 (Migrated from github.com)
Review

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".
kauffj commented 2019-02-17 22:14:35 +01:00 (Migrated from github.com)
Review

I was going to change this myself, but we don't have a button style?!

I was going to change this myself, but we don't have a button style?!
kauffj commented 2019-02-17 22:16:03 +01:00 (Migrated from github.com)
Review

This component should error cleanly if the relevant GitHub values aren't set.

This component should error cleanly if the relevant GitHub values aren't set.
kauffj commented 2019-02-17 22:14:10 +01:00 (Migrated from github.com)
Review

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".
kauffj commented 2019-02-17 22:14:35 +01:00 (Migrated from github.com)
Review

I was going to change this myself, but we don't have a button style?!

I was going to change this myself, but we don't have a button style?!
kauffj commented 2019-02-17 22:16:03 +01:00 (Migrated from github.com)
Review

This component should error cleanly if the relevant GitHub values aren't set.

This component should error cleanly if the relevant GitHub values aren't set.
kauffj commented 2019-02-17 22:14:10 +01:00 (Migrated from github.com)
Review

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".
kauffj commented 2019-02-17 22:14:35 +01:00 (Migrated from github.com)
Review

I was going to change this myself, but we don't have a button style?!

I was going to change this myself, but we don't have a button style?!
kauffj commented 2019-02-17 22:16:03 +01:00 (Migrated from github.com)
Review

This component should error cleanly if the relevant GitHub values aren't set.

This component should error cleanly if the relevant GitHub values aren't set.
// I M P O R T
kauffj commented 2019-02-17 22:14:10 +01:00 (Migrated from github.com)
Review

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".
kauffj commented 2019-02-17 22:14:35 +01:00 (Migrated from github.com)
Review

I was going to change this myself, but we don't have a button style?!

I was going to change this myself, but we don't have a button style?!
kauffj commented 2019-02-17 22:16:03 +01:00 (Migrated from github.com)
Review

This component should error cleanly if the relevant GitHub values aren't set.

This component should error cleanly if the relevant GitHub values aren't set.
kauffj commented 2019-02-17 22:14:10 +01:00 (Migrated from github.com)
Review

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".
kauffj commented 2019-02-17 22:14:35 +01:00 (Migrated from github.com)
Review

I was going to change this myself, but we don't have a button style?!

I was going to change this myself, but we don't have a button style?!
kauffj commented 2019-02-17 22:16:03 +01:00 (Migrated from github.com)
Review

This component should error cleanly if the relevant GitHub values aren't set.

This component should error cleanly if the relevant GitHub values aren't set.
import html from "choo/html";
kauffj commented 2019-02-17 22:14:10 +01:00 (Migrated from github.com)
Review

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".
kauffj commented 2019-02-17 22:14:35 +01:00 (Migrated from github.com)
Review

I was going to change this myself, but we don't have a button style?!

I was going to change this myself, but we don't have a button style?!
kauffj commented 2019-02-17 22:16:03 +01:00 (Migrated from github.com)
Review

This component should error cleanly if the relevant GitHub values aren't set.

This component should error cleanly if the relevant GitHub values aren't set.
kauffj commented 2019-02-17 22:14:10 +01:00 (Migrated from github.com)
Review

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".
kauffj commented 2019-02-17 22:14:35 +01:00 (Migrated from github.com)
Review

I was going to change this myself, but we don't have a button style?!

I was going to change this myself, but we don't have a button style?!
kauffj commented 2019-02-17 22:16:03 +01:00 (Migrated from github.com)
Review

This component should error cleanly if the relevant GitHub values aren't set.

This component should error cleanly if the relevant GitHub values aren't set.
kauffj commented 2019-02-17 22:14:10 +01:00 (Migrated from github.com)
Review

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".
kauffj commented 2019-02-17 22:14:35 +01:00 (Migrated from github.com)
Review

I was going to change this myself, but we don't have a button style?!

I was going to change this myself, but we don't have a button style?!
kauffj commented 2019-02-17 22:16:03 +01:00 (Migrated from github.com)
Review

This component should error cleanly if the relevant GitHub values aren't set.

This component should error cleanly if the relevant GitHub values aren't set.
kauffj commented 2019-02-17 22:14:10 +01:00 (Migrated from github.com)
Review

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".
kauffj commented 2019-02-17 22:14:35 +01:00 (Migrated from github.com)
Review

I was going to change this myself, but we don't have a button style?!

I was going to change this myself, but we don't have a button style?!
kauffj commented 2019-02-17 22:16:03 +01:00 (Migrated from github.com)
Review

This component should error cleanly if the relevant GitHub values aren't set.

This component should error cleanly if the relevant GitHub values aren't set.
// E X P O R T
kauffj commented 2019-02-17 22:14:10 +01:00 (Migrated from github.com)
Review

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".
kauffj commented 2019-02-17 22:14:35 +01:00 (Migrated from github.com)
Review

I was going to change this myself, but we don't have a button style?!

I was going to change this myself, but we don't have a button style?!
kauffj commented 2019-02-17 22:16:03 +01:00 (Migrated from github.com)
Review

This component should error cleanly if the relevant GitHub values aren't set.

This component should error cleanly if the relevant GitHub values aren't set.
kauffj commented 2019-02-17 22:14:10 +01:00 (Migrated from github.com)
Review

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".
kauffj commented 2019-02-17 22:14:35 +01:00 (Migrated from github.com)
Review

I was going to change this myself, but we don't have a button style?!

I was going to change this myself, but we don't have a button style?!
kauffj commented 2019-02-17 22:16:03 +01:00 (Migrated from github.com)
Review

This component should error cleanly if the relevant GitHub values aren't set.

This component should error cleanly if the relevant GitHub values aren't set.
export default () => html`
kauffj commented 2019-02-17 22:14:10 +01:00 (Migrated from github.com)
Review

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".
kauffj commented 2019-02-17 22:14:35 +01:00 (Migrated from github.com)
Review

I was going to change this myself, but we don't have a button style?!

I was going to change this myself, but we don't have a button style?!
kauffj commented 2019-02-17 22:16:03 +01:00 (Migrated from github.com)
Review

This component should error cleanly if the relevant GitHub values aren't set.

This component should error cleanly if the relevant GitHub values aren't set.
<developer-program>
kauffj commented 2019-02-17 22:14:10 +01:00 (Migrated from github.com)
Review

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".
kauffj commented 2019-02-17 22:14:35 +01:00 (Migrated from github.com)
Review

I was going to change this myself, but we don't have a button style?!

I was going to change this myself, but we don't have a button style?!
kauffj commented 2019-02-17 22:16:03 +01:00 (Migrated from github.com)
Review

This component should error cleanly if the relevant GitHub values aren't set.

This component should error cleanly if the relevant GitHub values aren't set.
<p>If this sounds like you, <a href="#" class="no-smooth" id="get-started">get started here</a>!</p>
kauffj commented 2019-02-17 22:14:10 +01:00 (Migrated from github.com)
Review

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".
kauffj commented 2019-02-17 22:14:35 +01:00 (Migrated from github.com)
Review

I was going to change this myself, but we don't have a button style?!

I was going to change this myself, but we don't have a button style?!
kauffj commented 2019-02-17 22:16:03 +01:00 (Migrated from github.com)
Review

This component should error cleanly if the relevant GitHub values aren't set.

This component should error cleanly if the relevant GitHub values aren't set.
</developer-program>
kauffj commented 2019-02-17 22:14:10 +01:00 (Migrated from github.com)
Review

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".
kauffj commented 2019-02-17 22:14:35 +01:00 (Migrated from github.com)
Review

I was going to change this myself, but we don't have a button style?!

I was going to change this myself, but we don't have a button style?!
kauffj commented 2019-02-17 22:16:03 +01:00 (Migrated from github.com)
Review

This component should error cleanly if the relevant GitHub values aren't set.

This component should error cleanly if the relevant GitHub values aren't set.
`;
kauffj commented 2019-02-17 22:14:10 +01:00 (Migrated from github.com)
Review

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".

Can this be a single centered button labeled "Claim Developer LBC" with smaller/meta text below it that says "This will authenticate you with GitHub to prove eligibility as well as mark you as a follower of LBRY".
kauffj commented 2019-02-17 22:14:35 +01:00 (Migrated from github.com)
Review

I was going to change this myself, but we don't have a button style?!

I was going to change this myself, but we don't have a button style?!
kauffj commented 2019-02-17 22:16:03 +01:00 (Migrated from github.com)
Review

This component should error cleanly if the relevant GitHub values aren't set.

This component should error cleanly if the relevant GitHub values aren't set.

View file

@ -90,6 +90,5 @@ function scrollToElementOnLoad() {
function validateEmail(email) {
const emailRegex = /^(([^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@(([^<>()[\].,;:\s@"]+\.)+[^<>()[\\.,;:\s@"]{2,})$/i;
return emailRegex.test(String(email));
return emailRegex.test(String(email)); // eslint-disable-line padding-line-between-statements
}

View file

@ -1,4 +1,4 @@
"use strict"; /* global document, location, WebSocket */
"use strict"; /* global document, location, WebSocket, window */
@ -25,6 +25,20 @@ function initializeWebSocketConnection() {
const data = JSON.parse(socket.data);
switch(true) {
case data.message === "notification": // TODO: Make work with appending so multiple notifications can be sent
document.getElementById("flash-container").innerHTML =
`<div class="flash active${data.type ? " " + data.type : ""}">${data.details}</div>`;
setTimeout(() => {
document.getElementById("flash-container").innerHTML = "";
}, 2100);
break;
case data.message === "redirect":
window.location.href = data.url;
break;
case data.message === "show result":
if (!data.example)
return;
@ -83,16 +97,6 @@ function initializeWebSocketConnection() {
break;
case data.message === "notification": // TODO: Make work with appending so multiple notifications can be sent
document.getElementById("flash-container").innerHTML =
`<div class="flash active${data.type ? " " + data.type : ""}">${data.details}</div>`;
setTimeout(() => {
document.getElementById("flash-container").innerHTML = "";
}, 2100);
break;
default:
console.log(data); // eslint-disable-line no-console
break;

View file

@ -336,24 +336,6 @@ function generateUrl(type, event) {
}
}
async function getGitHubUserToken() {
// const clientWithAuth = new Octokit({
// auth: `token ${process.env.GITHUB_APP_TOKEN}`
// });
const result = await octokit.oauthAuthorizations.createAuthorization({ // eslint-disable-line no-unused-vars
client_id: process.env.GITHUB_APP_ID,
client_secret: process.env.GITHUB_APP_TOKEN,
note: "LBRY Developer Auth",
scopes: [
"public_repo"
]
});
// console.log(result);
// console.log("—————");
}
function updateGithubFeed() {
octokit.activity.listPublicEventsForOrg({
org: "lbryio",
@ -397,6 +379,5 @@ export {
generateEvent,
generateGitHubFeed,
generateUrl,
getGitHubUserToken,
updateGithubFeed
};

View file

@ -22,6 +22,7 @@
@import "pages/api";
@import "pages/contributing";
@import "pages/developer";
@import "pages/documentation";
@import "pages/home";
@import "pages/page";

View file

@ -0,0 +1,3 @@
developer-program {
@extend %markdown;
}

View file

@ -10,7 +10,7 @@ import html from "choo/html";
// U T I L S
import fetchMetadata from "@helper/fetch-metadata";
import { generateGitHubFeed, getGitHubUserToken } from "@helper/github";
import { generateGitHubFeed } from "@helper/github";
import messageSlack from "@helper/slack";
@ -23,7 +23,7 @@ export default (socket, action) => {
switch(true) {
case action.message === "auth me with github":
getGitHubUserToken();
getGitHubUserToken(socket);
break;
case action.message === "fetch metadata":
@ -332,6 +332,13 @@ function generateMemeCreator(socket) {
});
}
function getGitHubUserToken(socket) {
send(socket, {
message: "redirect",
url: `https://github.com/login/oauth/authorize?client_id=${process.env.GITHUB_APP_ID}`
});
}
async function getTrendingContent() {
try {
const response = await got("https://api.lbry.io/file/list_trending");

View file

@ -9,6 +9,6 @@ To qualify for free LBC you must:
NetOpWibby commented 2019-02-14 18:10:42 +01:00 (Migrated from github.com)
Review

More copy you may want to change.

More copy you may want to change.
kauffj commented 2019-02-17 22:15:03 +01:00 (Migrated from github.com)
Review

^ what this says

^ what this says
NetOpWibby commented 2019-02-14 18:10:42 +01:00 (Migrated from github.com)
Review

More copy you may want to change.

More copy you may want to change.
kauffj commented 2019-02-17 22:15:03 +01:00 (Migrated from github.com)
Review

^ what this says

^ what this says
- have a GitHub account, and
- have a public PR (pull request) in the past year
If this sounds like you, <a href="#" class="no-smooth" id="get-started">get started here</a>!
NetOpWibby commented 2019-02-14 18:10:42 +01:00 (Migrated from github.com)
Review

More copy you may want to change.

More copy you may want to change.
kauffj commented 2019-02-17 22:15:03 +01:00 (Migrated from github.com)
Review

^ what this says

^ what this says
<DeveloperProgram/>
NetOpWibby commented 2019-02-14 18:10:42 +01:00 (Migrated from github.com)
Review

More copy you may want to change.

More copy you may want to change.
kauffj commented 2019-02-17 22:15:03 +01:00 (Migrated from github.com)
Review

^ what this says

^ what this says
If you have not downloaded our SDK yet, [you should]() and generate a wallet address so we know where to send your LBC!

NetOpWibby commented 2019-02-14 18:10:42 +01:00 (Migrated from github.com)
Review

More copy you may want to change.

More copy you may want to change.
kauffj commented 2019-02-17 22:15:03 +01:00 (Migrated from github.com)
Review

^ what this says

^ what this says
NetOpWibby commented 2019-02-14 18:10:42 +01:00 (Migrated from github.com)
Review

More copy you may want to change.

More copy you may want to change.
kauffj commented 2019-02-17 22:15:03 +01:00 (Migrated from github.com)
Review

^ what this says

^ what this says