Embed payout settings in worker stats
Some checks failed
CodeQL / Analyze (javascript) (push) Failing after 28s
Some checks failed
CodeQL / Analyze (javascript) (push) Failing after 28s
This commit is contained in:
@@ -805,38 +805,43 @@ settings methods
|
||||
*/
|
||||
|
||||
function settings_Setup(api, stats) {
|
||||
|
||||
var address = getCurrentAddress(stats.config.coin);
|
||||
if (address){
|
||||
$(`#yourAddress${stats.config.coin}`).val(address);
|
||||
if (address) {
|
||||
if ($(`#yourAddress${stats.config.coin}`).length) {
|
||||
$(`#yourAddress${stats.config.coin}`).val(address);
|
||||
}
|
||||
settings_GetPayoutLevel(api, address, stats);
|
||||
settings_GetEmailAddress(api, address, stats);
|
||||
if ($(`#yourEmail${stats.config.coin}`).length) {
|
||||
settings_GetEmailAddress(api, address, stats);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle click on Set button
|
||||
$(`#payoutSetButton${stats.config.coin}`).click(function(){
|
||||
var address = $(`#yourAddress${stats.config.coin}`).val().trim();
|
||||
$(`#payoutSetButton${stats.config.coin}`).off('click').click(function(){
|
||||
var address = $(`#yourAddress${stats.config.coin}`).length
|
||||
? $(`#yourAddress${stats.config.coin}`).val().trim()
|
||||
: getCurrentAddress(stats.config.coin);
|
||||
if (!address || address == '') {
|
||||
settings_ShowError('noMinerAddress', 'No miner address specified', '', false);
|
||||
settings_ShowError('noMinerAddress', 'No miner address specified', '', stats);
|
||||
return;
|
||||
}
|
||||
|
||||
var ip = $(`#yourIP${stats.config.coin}`).val().trim();
|
||||
if (!ip || ip == '') {
|
||||
settings_ShowError('noMinerIP', 'No miner IP address specified', '', false);
|
||||
settings_ShowError('noMinerIP', 'No miner IP address specified', '', stats);
|
||||
return;
|
||||
}
|
||||
|
||||
var level = $(`#yourPayoutRate${stats.config.coin}`).val().trim();
|
||||
if (!level || level < 0) {
|
||||
settings_ShowError('noPayoutLevel', 'No payout level specified', '', false);
|
||||
settings_ShowError('noPayoutLevel', 'No payout level specified', '', stats);
|
||||
return;
|
||||
}
|
||||
settings_SetPayoutLevel(api, address, ip, level, stats);
|
||||
});
|
||||
|
||||
// Handle click on Enable button
|
||||
$(`#enableButton${stats.config.coin}`).click(function(){
|
||||
$(`#enableButton${stats.config.coin}`).off('click').click(function(){
|
||||
var address = $(`#yourAddress${stats.config.coin}`).val().trim();
|
||||
var ip = $(`#yourIP${stats.config.coin}`).val().trim();
|
||||
var email = $(`#yourEmail${stats.config.coin}`).val();
|
||||
@@ -844,7 +849,7 @@ function settings_Setup(api, stats) {
|
||||
});
|
||||
|
||||
// Handle click on Disable button
|
||||
$(`#disableButton${stats.config.coin}`).click(function(){
|
||||
$(`#disableButton${stats.config.coin}`).off('click').click(function(){
|
||||
var address = $(`#yourAddress${stats.config.coin}`).val().trim();
|
||||
var ip = $(`#yourIP${stats.config.coin}`).val().trim();
|
||||
var email = $(`#yourEmail${stats.config.coin}`).val();
|
||||
@@ -2054,7 +2059,8 @@ function workerstats_InitTemplate(ranOnce, addressTimeout, xhrAddressPoll, xhrGe
|
||||
Mustache.parse(template)
|
||||
rendered = Mustache.render(template, {coin:coin, active: 'active'})
|
||||
$('#tab-content').append(rendered)
|
||||
workerstats_Setup(lastStats, api, addressTimeout, xhrAddressPoll, xhrGetPayments)
|
||||
workerstats_Setup(lastStats, api, addressTimeout, xhrAddressPoll, xhrGetPayments)
|
||||
settings_Setup(api, lastStats)
|
||||
}
|
||||
|
||||
if (!ranOnce)
|
||||
|
||||
Reference in New Issue
Block a user