diff --git a/.env.sample b/.env.sample index dd5ee34..06fe751 100644 --- a/.env.sample +++ b/.env.sample @@ -2,15 +2,9 @@ # HTTPS is assumed for security reasons DAEMON_URL= -# These are for powering the LBRY Developer Program -# /developer-program -GITHUB_APP_ID= -GITHUB_APP_SECRET= -REWARD_URL=api.lbry.com - # https://developer.github.com/apps/building-oauth-apps/creating-an-oauth-app # We use this to show the GitHub feed on the homepage -GITHUB_OAUTH_TOKEN= +GITHUB_TOKEN= # You can use openssl to generate impossible to guess tokens # Ideally you would have a reference to this on your daemon so make sure that server is secure! @@ -22,11 +16,4 @@ LBRY_DAEMON_IMAGES_PATH= # Usually 443 # This is commented-out for local development -PORT= - -# https://devcenter.heroku.com/articles/rediscloud -REDISCLOUD_URL= - -# https://api.slack.com/incoming-webhooks -# We get notified when issues with this app happens, directly in Slack -SLACK_WEBHOOK_URL= +PORT= \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 912041c..33f8cd4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,14 @@ -FROM node:10.2.1 +FROM node:22 WORKDIR /app COPY package.json package.json COPY package-lock.json package-lock.json -RUN npm install +RUN npm install --force COPY . . EXPOSE 8080 -CMD [ "npm", "start" ] \ No newline at end of file +CMD [ "npm", "start", "--force" ] \ No newline at end of file diff --git a/app/client.js b/app/client.js index 01df20d..388c0e8 100755 --- a/app/client.js +++ b/app/client.js @@ -11,8 +11,8 @@ import ssr from "choo-ssr"; // U T I L S -import head from "~component/head"; -import wrapper from "~component/wrapper"; +import head from "./components/head"; +import wrapper from "./components/wrapper"; diff --git a/app/components/client/devprogram-scripts.js b/app/components/client/devprogram-scripts.js deleted file mode 100644 index 8c07c34..0000000 --- a/app/components/client/devprogram-scripts.js +++ /dev/null @@ -1,97 +0,0 @@ -"use strict"; /* global document, fetch, history, send, window */ - - - -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 = ` -
- - - - - -
- -

Need An Address?

-

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 (./lbrynet start).
  4. -
  5. Run ./lbrynet address unused and copy the id field.
  6. -
- `; - - history.replaceState({}, "", window.location.pathname); // clean up URL bar -} - -if (document.getElementById("creditsAcquire")) { - document.getElementById("walletAddress").addEventListener("keyup", event => { - const key = event.keyCode ? event.keyCode : event.which; - - if (key === 13) - document.getElementById("creditsAcquire").click(); - }); - - document.getElementById("creditsAcquire").onclick = () => { - send({ - address: document.getElementById("walletAddress").value, - code: document.getElementById("oauthCode").value, - message: "verify github token" - }); - - document.querySelector("developer-program").innerHTML = "

Awaiting response from LBRY server...

"; - }; -} - -function syncWithApi(data) { // eslint-disable-line no-unused-vars - const address = data.address; - const code = data.code; - - if (code === null) { - document.querySelector("developer-program").innerHTML = - "

There was an issue with accessing GitHub's API. Please try again later.

"; - } - - fetch(`https://api.lbry.com/reward/new?github_token=${code}&reward_type=github_developer&wallet_address=${address}`) - .then(response => response.json()) - .then(result => { - switch(true) { - case result.error === "This reward is limited to 1 per person": - document.querySelector("developer-program").innerHTML = - "

You have already claimed this reward. This reward is limited to ONE per person. Your enthusiasm is appreciated.

"; - return; - - case Boolean(result.error): - document.querySelector("developer-program").innerHTML = - `

${result.error}

`; - return; - - case result.success: - result = result.data; - document.querySelector("developer-program").innerHTML = - `

Success! Your wallet has been credited with ${result.reward_amount} LBC.

We have a great reference for the LBRY SDK here to help you get started.

You can see proof of this transaction on our Blockchain Explorer.

`; - return; - - default: - console.info(data); // eslint-disable-line no-console - document.querySelector("developer-program").innerHTML = - "

No success or error was received so the LBRY API might be down.
Please try again later.

"; - } - }) - .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 = - "

LBRY API is down. Please try again later.

"; - }); -} diff --git a/app/components/developer-program.js b/app/components/developer-program.js deleted file mode 100644 index c69085f..0000000 --- a/app/components/developer-program.js +++ /dev/null @@ -1,32 +0,0 @@ -"use strict"; - - - -// I M P O R T - -import html from "choo/html"; - - - -// E X P O R T - -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/components/ecosystem/module-applications.js b/app/components/ecosystem/module-applications.js index a816388..2eff060 100644 --- a/app/components/ecosystem/module-applications.js +++ b/app/components/ecosystem/module-applications.js @@ -4,7 +4,7 @@ // U T I L -import markdown from "~component/markdown"; +import markdown from "../../components/markdown"; diff --git a/app/components/ecosystem/module-lbry.js b/app/components/ecosystem/module-lbry.js index 8f19d9d..c74ce99 100644 --- a/app/components/ecosystem/module-lbry.js +++ b/app/components/ecosystem/module-lbry.js @@ -4,7 +4,7 @@ // U T I L -import markdown from "~component/markdown"; +import markdown from "../../components/markdown"; diff --git a/app/components/ecosystem/module-lbrycrd.js b/app/components/ecosystem/module-lbrycrd.js index 85c6ee2..ab8f76a 100644 --- a/app/components/ecosystem/module-lbrycrd.js +++ b/app/components/ecosystem/module-lbrycrd.js @@ -4,7 +4,7 @@ // U T I L -import markdown from "~component/markdown"; +import markdown from "../../components/markdown"; diff --git a/app/components/ecosystem/submodule-chainquery.js b/app/components/ecosystem/submodule-chainquery.js index cc72452..f5ebb8e 100644 --- a/app/components/ecosystem/submodule-chainquery.js +++ b/app/components/ecosystem/submodule-chainquery.js @@ -4,7 +4,7 @@ // U T I L -import markdown from "~component/markdown"; +import markdown from "../../components/markdown"; diff --git a/app/components/ecosystem/submodule-lighthouse.js b/app/components/ecosystem/submodule-lighthouse.js index 9dd107b..45dece8 100644 --- a/app/components/ecosystem/submodule-lighthouse.js +++ b/app/components/ecosystem/submodule-lighthouse.js @@ -4,7 +4,7 @@ // U T I L -import markdown from "~component/markdown"; +import markdown from "../../components/markdown"; diff --git a/app/components/ecosystem/submodule-reflector.js b/app/components/ecosystem/submodule-reflector.js index 8439a59..2693fd3 100644 --- a/app/components/ecosystem/submodule-reflector.js +++ b/app/components/ecosystem/submodule-reflector.js @@ -4,7 +4,7 @@ // U T I L -import markdown from "~component/markdown"; +import markdown from "../../components/markdown"; diff --git a/app/components/ecosystem/submodule-wallet.js b/app/components/ecosystem/submodule-wallet.js index cab0636..b8101d3 100644 --- a/app/components/ecosystem/submodule-wallet.js +++ b/app/components/ecosystem/submodule-wallet.js @@ -4,7 +4,7 @@ // U T I L -import markdown from "~component/markdown"; +import markdown from "../../components/markdown"; diff --git a/app/components/edit-link.js b/app/components/edit-link.js index a281b07..c933251 100644 --- a/app/components/edit-link.js +++ b/app/components/edit-link.js @@ -8,7 +8,7 @@ import html from "choo/html"; // U T I L -import config from "~root/config"; +import config from "../../config"; diff --git a/app/components/footer.js b/app/components/footer.js index 9d097de..08055e3 100644 --- a/app/components/footer.js +++ b/app/components/footer.js @@ -9,7 +9,6 @@ import html from "choo/html"; // U T I L S import editLink from "./edit-link"; -import emailSubscribe from "./email-subscribe"; @@ -20,15 +19,11 @@ export default state => { return ""; return html` -
- ${emailSubscribe()} -
- - `; }; diff --git a/app/components/head.js b/app/components/head.js index 773f2e4..06cf200 100644 --- a/app/components/head.js +++ b/app/components/head.js @@ -8,7 +8,7 @@ import html from "choo/html"; // U T I L -import config from "~root/config"; +import config from "../../config"; @@ -61,8 +61,8 @@ export default (state, emit) => { - - + + diff --git a/app/components/link-grid.js b/app/components/link-grid.js index 0c821d0..8e73ed9 100644 --- a/app/components/link-grid.js +++ b/app/components/link-grid.js @@ -26,7 +26,7 @@ export default links => { // H E L P E R function returnLinkTemplate(title, description, destination, label) { - return ` + return html`