mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 17:47:26 +00:00
add publish support to quickstart
This commit is contained in:
parent
1ee041d467
commit
1a27f5999b
4 changed files with 22 additions and 16 deletions
|
@ -52,7 +52,7 @@ class DeveloperActions extends Actions
|
||||||
return $vars + [
|
return $vars + [
|
||||||
'defaultWalletAddress' => Session::get(Session::KEY_DEVELOPER_CREDITS_WALLET_ADDRESS),
|
'defaultWalletAddress' => Session::get(Session::KEY_DEVELOPER_CREDITS_WALLET_ADDRESS),
|
||||||
'error' => Session::get(Session::KEY_DEVELOPER_LAST_FORM) == "new_developer" ? Session::getFlash(Session::KEY_DEVELOPER_CREDITS_ERROR) : '',
|
'error' => Session::get(Session::KEY_DEVELOPER_LAST_FORM) == "new_developer" ? Session::getFlash(Session::KEY_DEVELOPER_CREDITS_ERROR) : '',
|
||||||
'apiUrl' => LBRY::getApiUrl('/user/new_github')
|
'apiUrl' => LBRY::getApiUrl('/reward/new?reward_type=new_developer')
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ class DeveloperActions extends Actions
|
||||||
return $vars + [
|
return $vars + [
|
||||||
'defaultWalletAddress' => Session::get(Session::KEY_DEVELOPER_CREDITS_WALLET_ADDRESS),
|
'defaultWalletAddress' => Session::get(Session::KEY_DEVELOPER_CREDITS_WALLET_ADDRESS),
|
||||||
'error' => Session::get(Session::KEY_DEVELOPER_LAST_FORM) == "new_publish" ? Session::getFlash(Session::KEY_DEVELOPER_CREDITS_ERROR) : '',
|
'error' => Session::get(Session::KEY_DEVELOPER_LAST_FORM) == "new_publish" ? Session::getFlash(Session::KEY_DEVELOPER_CREDITS_ERROR) : '',
|
||||||
'apiUrl' => LBRY::getApiUrl('/reward/new')
|
'apiUrl' => LBRY::getApiUrl('/reward/new?reward_type=first_publish')
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ lbry.quickstartForm('#form-new-publish-reward', "<?php echo $apiUrl ?>");
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="wallet">Publishing Transaction ID</label>
|
<label for="wallet">Publishing Transaction ID</label>
|
||||||
<div class="form-input">
|
<div class="form-input">
|
||||||
<input type="text" name="transaction_hash" value="<?php echo '' ?>"
|
<input type="text" name="transaction_id" value="<?php echo '' ?>"
|
||||||
class="required standard " placeholder="e99240e60499b372371a4e461ca25506745686b4c8fa3dd646a83f44ad358255">
|
class="required standard " placeholder="e99240e60499b372371a4e461ca25506745686b4c8fa3dd646a83f44ad358255">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -13,9 +13,6 @@
|
||||||
<code class="code-bash"><span class="code-bash__prompt">$</span>curl 'http://localhost:5279/lbryapi' --data '{"method":"wallet_balance"}'
|
<code class="code-bash"><span class="code-bash__prompt">$</span>curl 'http://localhost:5279/lbryapi' --data '{"method":"wallet_balance"}'
|
||||||
<span class="code-bash__response">[50.00000000]</span></code>
|
<span class="code-bash__response">[50.00000000]</span></code>
|
||||||
<h3 id="publish">Publishing</h3>
|
<h3 id="publish">Publishing</h3>
|
||||||
<div class="notice notice-info spacer1">
|
|
||||||
The credit reward for this portion of the guide does not work yet. It will be added shortly. However, you can still follow this section to learn how to publish.
|
|
||||||
</div>
|
|
||||||
<p>Publishing to LBRY is just as easy as everything else! If you publish something, we'll send you an additional 200 LBC for further use.</p>
|
<p>Publishing to LBRY is just as easy as everything else! If you publish something, we'll send you an additional 200 LBC for further use.</p>
|
||||||
<p>Not sure what to publish? We recommend your favorite picture or home video. Or just grab something from <a class="link-primary" href="https://archive.org/details/movies">here</a>.</p>
|
<p>Not sure what to publish? We recommend your favorite picture or home video. Or just grab something from <a class="link-primary" href="https://archive.org/details/movies">here</a>.</p>
|
||||||
<code class="code-bash"><span class="code-bash__prompt">$</span>curl 'http://localhost:5279/lbryapi' --data '{"method":"publish", "params": {
|
<code class="code-bash"><span class="code-bash__prompt">$</span>curl 'http://localhost:5279/lbryapi' --data '{"method":"publish", "params": {
|
||||||
|
@ -24,17 +21,26 @@
|
||||||
"bid": 1,
|
"bid": 1,
|
||||||
"metadata": { } <span class="code-bash__comment">//this should match the metadata returned by resolve_name </span>
|
"metadata": { } <span class="code-bash__comment">//this should match the metadata returned by resolve_name </span>
|
||||||
}}'
|
}}'
|
||||||
<span class="code-bash__response">[whatever this response looks like]</span></code>
|
<span class="code-bash__response">[
|
||||||
|
{
|
||||||
|
"claim_id": "2081486f32dc493980c77bdaa0502950b532af13",
|
||||||
|
"fee": 0.000329,
|
||||||
|
"nout": 0,
|
||||||
|
"tx": "0100000001a2dcee285b3f552fb8b3eef416c9f17...",
|
||||||
|
"txid": "d71d63ebb3e10067bfd0b302433bc1ab09fbdd5dc9bc687f50aeb6809d1770fe" <span class="code-bash__comment">//this is the value you need to copy</span>
|
||||||
|
}
|
||||||
|
]</span></code>
|
||||||
<div class="quickstart__claim-form content-light content" id="new-publish">
|
<div class="quickstart__claim-form content-light content" id="new-publish">
|
||||||
<?php echo View::render('developer/_formCreditsPublish', [
|
<?php echo View::render('developer/_formCreditsPublish', [
|
||||||
'returnUrl' => Request::getRelativeUri() . '#new-developer'
|
'returnUrl' => Request::getRelativeUri() . '#new-developer'
|
||||||
]) ?>
|
]) ?>
|
||||||
</div>
|
</div>
|
||||||
<h3>Enjoy a Hollywood Film</h3>
|
<h3>Enjoy a Hollywood Film</h3>
|
||||||
|
<p><a href="http://www.imdb.com/title/tt1995341/" class="link-primary">It's a Disaster</a> starring David Cross is just one of tens of thousands of great pieces of content available. Check it out!</p>
|
||||||
<code class="code-bash"><span class="code-bash__prompt">$</span>curl 'http://localhost:5279/lbryapi' --data '{"method":"get","params":{"name":"itsadisaster"} }'
|
<code class="code-bash"><span class="code-bash__prompt">$</span>curl 'http://localhost:5279/lbryapi' --data '{"method":"get","params":{"name":"itsadisaster"} }'
|
||||||
<span class="code-bash__response">["d5169241150022f996fa7cd6a9a1c421937276a3275eb912790bd07ba7aec1fac5fd45431d226b8fb402691e79aeb24b"]</span></code>
|
<span class="code-bash__response">["d5169241150022f996fa7cd6a9a1c421937276a3275eb912790bd07ba7aec1fac5fd45431d226b8fb402691e79aeb24b"]</span></code>
|
||||||
<h3>Try the UI</h3>
|
<h3>Try the UI</h3>
|
||||||
<p>LBRY comes with a UI so that normal people can use it too. You can download it <a href="https://lbry.io/get" class="link-primary">here</a>.</p>
|
<p>LBRY comes with a UI so that normal people can use it too. You can download it <a href="https://github.com/lbryio/lbry-app/releases" class="link-primary">here</a>.</p>
|
||||||
<h3 id="community">You Did It! What's Next?</h3>
|
<h3 id="community">You Did It! What's Next?</h3>
|
||||||
<p>
|
<p>
|
||||||
Start building something awesome! LBRY works as a discovery and distribution backend for everything from films to CAD files.
|
Start building something awesome! LBRY works as a discovery and distribution backend for everything from films to CAD files.
|
||||||
|
|
|
@ -2,7 +2,7 @@ lbry.quickstartForm = function (selector, apiUrl) {
|
||||||
var form = $(selector),
|
var form = $(selector),
|
||||||
accessToken = form.find(':input[name="access_token"]').val(),
|
accessToken = form.find(':input[name="access_token"]').val(),
|
||||||
walletAddressInput = form.find(':input[name="wallet_address"]'),
|
walletAddressInput = form.find(':input[name="wallet_address"]'),
|
||||||
transactionHashInput = form.find(':input[name="transaction_hash"]'),
|
transactionIdInput = form.find(':input[name="transaction_id"]'),
|
||||||
storageKey = form.attr('id') + "SuccessHTML",
|
storageKey = form.attr('id') + "SuccessHTML",
|
||||||
submitButton = form.find(':input[type="submit"]'),
|
submitButton = form.find(':input[type="submit"]'),
|
||||||
isAutomaticSubmit = false,
|
isAutomaticSubmit = false,
|
||||||
|
@ -11,7 +11,7 @@ lbry.quickstartForm = function (selector, apiUrl) {
|
||||||
function resetFormState() {
|
function resetFormState() {
|
||||||
isSubmitting = false;
|
isSubmitting = false;
|
||||||
walletAddressInput.attr('readonly', null);
|
walletAddressInput.attr('readonly', null);
|
||||||
transactionHashInput.attr('readonly', null);
|
transactionIdInput.attr('readonly', null);
|
||||||
submitButton.val(submitButton.data('submitLabel')).attr('disabled', null);
|
submitButton.val(submitButton.data('submitLabel')).attr('disabled', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,29 +39,29 @@ lbry.quickstartForm = function (selector, apiUrl) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (transactionHashInput.length) {
|
if (transactionIdInput.length) {
|
||||||
if (!transactionHashInput.val()) {
|
if (!transactionIdInput.val()) {
|
||||||
resetFormState();
|
resetFormState();
|
||||||
if (!isAutomaticSubmit) {
|
if (!isAutomaticSubmit) {
|
||||||
form.find('.notice-error').html("Please supply a transaction ID.").show();
|
form.find('.notice-error').html("Please supply a transaction ID.").show();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
postData.transaction_hash = transactionHashInput.val();
|
postData.transaction_id = transactionIdInput.val();
|
||||||
}
|
}
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
walletAddressInput.attr('readonly', 'readonly');
|
walletAddressInput.attr('readonly', 'readonly');
|
||||||
transactionHashInput.attr('readonly', 'readonly');
|
transactionIdInput.attr('readonly', 'readonly');
|
||||||
submitButton.val(submitButton.data('submittingLabel')).attr('disabled', 'disabled');
|
submitButton.val(submitButton.data('submittingLabel')).attr('disabled', 'disabled');
|
||||||
|
|
||||||
$.post(apiUrl, postData)
|
$.post(apiUrl, postData)
|
||||||
.done(function (responseData) {
|
.done(function (responseData) {
|
||||||
var data = responseData.data;
|
var data = responseData.data;
|
||||||
var anchor = $('<a class="link-primary--break-word"></a>');
|
var anchor = $('<a class="link-primary--break-word"></a>');
|
||||||
anchor.attr("href", "https://explorer.lbry.io/tx/" + data.TransactionHash);
|
anchor.attr("href", "https://explorer.lbry.io/tx/" + data.transactionId);
|
||||||
anchor.html(data.TransactionHash)
|
anchor.html(data.transactionId)
|
||||||
form.find('.notice-success')
|
form.find('.notice-success')
|
||||||
.html(data.RewardAmount + " credits sent in transaction ")
|
.html(data.RewardAmount + " credits sent in transaction ")
|
||||||
.append(anchor)
|
.append(anchor)
|
||||||
|
|
Loading…
Add table
Reference in a new issue