Merge pull request #112 from TheSerapher/issue-111
Adding support for public API polling
This commit is contained in:
commit
21f8278f90
26
public/include/pages/api/public.inc.php
Normal file
26
public/include/pages/api/public.inc.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
// Make sure we are called from index.php
|
||||
if (!defined('SECURITY'))
|
||||
die('Hacking attempt');
|
||||
|
||||
// {"pool_name":"Pool-X.eu","hashrate":"511128.99","workers":"2104","shares_this_round":92450,"last_block":"365294","network_hashrate":17327056.06}
|
||||
|
||||
// Fetch last block information
|
||||
$aLastBlock = $block->getLast();
|
||||
$aShares = $statistics->getRoundShares();
|
||||
|
||||
echo json_encode(
|
||||
array(
|
||||
'pool_name' => $config['website']['name'],
|
||||
'hashrate' => $statistics->getCurrentHashrate(),
|
||||
'workers' => $worker->getCountAllActiveWorkers(),
|
||||
'shares_this_round' => $aShares['valid'],
|
||||
'last_block' => $aLastBlock['height'],
|
||||
'network_hashrate' => '0'
|
||||
)
|
||||
);
|
||||
|
||||
// Supress master template
|
||||
$supress_master = 1;
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user