lbry.tech/app/components/client/devprogram-scripts.js

47 lines
1.6 KiB
JavaScript
Raw Normal View History

2019-02-12 00:47:01 +01:00
"use strict"; /* global document, history, send, window */
2019-02-05 00:42:52 +01:00
2019-02-12 00:47:01 +01:00
document.getElementById("get-started").onclick = event => {
2019-02-05 00:42:52 +01:00
event.preventDefault();
send({
message: "auth me with github"
});
2019-02-12 00:47:01 +01:00
};
if (window.location.search.includes("?code=")) {
document.querySelector("developer-program").innerHTML = `
<form>
<input-submit>
<input id="walletAddress" placeholder="Your LBRY wallet address" type="text"/>
<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>
2019-02-18 21:31:48 +01:00
2019-02-19 19:17:32 +01:00
<h4>Need An Address?</h4>
2019-02-18 21:31:48 +01:00
<p>To receive your LBC, you'll need a wallet address. While graphical wallets are available, the recommended path for engineers is to:</p>
<ol>
2019-02-19 19:17:32 +01:00
<li>Download <a href="https://github.com/lbryio/lbry/releases">the LBRY SDK</a>.</li>
<li>Launch the command-line utility (<code>./lbrynet start</code>).</li>
<li>Run <code>./lbrynet address list</code> and copy the <code>id</code> field.</li>
2019-02-18 21:31:48 +01:00
</ol>
2019-02-12 00:47:01 +01:00
`;
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"
});
2019-02-19 19:17:32 +01:00
document.querySelector("developer-program").innerHTML = "<p><em>Awaiting response from LBRY server...</em></p>";
2019-02-12 00:47:01 +01:00
};
}