Compare commits
26
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f08049dc5c | ||
|
|
ecbd1c82cf | ||
|
|
4f49235511 | ||
|
|
179f9c9339 | ||
|
|
c003a6b23a | ||
|
|
aad314491b | ||
|
|
b9fe194dc8 | ||
|
|
15935ec109 | ||
|
|
7e9851ccfc | ||
|
|
d7fb718dd0 | ||
|
|
6f4fa32078 | ||
|
|
8873373465 | ||
|
|
a73d65b1c2 | ||
|
|
bb595d0027 | ||
|
|
52d13987e5 | ||
|
|
57219734c3 | ||
|
|
a7c1b9b346 | ||
|
|
77ca91757b | ||
|
|
a147665e96 | ||
|
|
0f197fc571 | ||
|
|
31d515e992 | ||
|
|
02551e98d7 | ||
|
|
007cf0d34c | ||
|
|
c18431394c | ||
|
|
04cbdbcaee | ||
|
|
9b3a1f4097 |
No files matched your search
@@ -6,7 +6,6 @@ A simple PHP block explorer for browsing transactions and claims on the [LBRY](h
|
||||
There are some prerequisites that need to be installed before the explorer can be accessed.
|
||||
* Web server - Apache, caddy or nginx
|
||||
* [lbrycrd](https://github.com/lbryio/lbrycrd) with txindex turned on
|
||||
* [Python claims decoder](https://github.com/cryptodevorg/lbry-decoder)
|
||||
* MariaDB 10.2 or higher
|
||||
* Redis Server (optional, only required for the CakePHP redis cache engine, or to run `forevermempool`)
|
||||
* PHP 7.2 or higher
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": ">=5.6",
|
||||
"cakephp/cakephp": "3.7.1",
|
||||
"cakephp/cakephp": "3.7.7",
|
||||
"mobiledetect/mobiledetectlib": "2.*",
|
||||
"cakephp/migrations": "~1.0",
|
||||
"psr/simple-cache": "^1.0.0",
|
||||
|
||||
Generated
+623
-446
File diff suppressed because it is too large.
Load diff
@@ -222,7 +222,7 @@ return [
|
||||
'className' => 'Cake\Database\Connection',
|
||||
'driver' => 'Cake\Database\Driver\Mysql',
|
||||
'persistent' => false,
|
||||
'host' => 'chainquery.lbry.io',
|
||||
'host' => 'chainquery.lbry.com',
|
||||
/**
|
||||
* CakePHP will use the default DB port based on the driver selected
|
||||
* MySQL on MAMP uses port 8889, MAMP users will want to uncomment
|
||||
@@ -257,9 +257,9 @@ return [
|
||||
*/
|
||||
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
|
||||
|
||||
'url' => env('DATABASE_URL', 'chainquery.lbry.io:3600'),
|
||||
'url' => env('DATABASE_URL', 'chainquery.lbry.com:3600'),
|
||||
],
|
||||
|
||||
|
||||
'localdb' => [ // Local db for price history
|
||||
'className' => 'Cake\Database\Connection',
|
||||
'driver' => 'Cake\Database\Driver\Mysql',
|
||||
|
||||
@@ -226,5 +226,4 @@ if (Configure::read('debug')) {
|
||||
Application::addPlugin('DebugKit', ['bootstrap' => true]);
|
||||
}
|
||||
|
||||
Configure::load('lbry','lbry.default');
|
||||
|
||||
Configure::load('lbry', 'default');
|
||||
@@ -7,6 +7,7 @@ use Mdanter\Ecc\Crypto\Signature\Signer;
|
||||
use Mdanter\Ecc\Serializer\PublicKey\PemPublicKeySerializer;
|
||||
use Mdanter\Ecc\Serializer\PublicKey\DerPublicKeySerializer;
|
||||
use Mdanter\Ecc\Serializer\Signature\DerSignatureSerializer;
|
||||
use Cake\Cache\Cache;
|
||||
use Cake\Core\Configure;
|
||||
use Cake\Datasource\ConnectionManager;
|
||||
use Cake\Log\Log;
|
||||
@@ -18,7 +19,7 @@ use Endroid\QrCode\Response\QrCodeResponse;
|
||||
|
||||
class MainController extends AppController {
|
||||
|
||||
public static $rpcurl;
|
||||
protected $rpcurl;
|
||||
|
||||
const lbcPriceKey = 'lbc.price';
|
||||
|
||||
@@ -30,11 +31,13 @@ class MainController extends AppController {
|
||||
|
||||
const tagReceiptAddress = 'bLockNgmfvnnnZw7bM6SPz6hk5BVzhevEp';
|
||||
|
||||
const blockedListUrl = 'https://api.lbry.com/file/list_blocked';
|
||||
|
||||
protected $redis;
|
||||
|
||||
public function initialize() {
|
||||
parent::initialize();
|
||||
self::$rpcurl = Configure::read('Lbry.RpcUrl');
|
||||
$this->rpcurl = Configure::read('Lbry.RpcUrl');
|
||||
$this->redis = new \Predis\Client(Configure::read('Redis.Url'));
|
||||
try {
|
||||
$this->redis->info('mem');
|
||||
@@ -136,6 +139,10 @@ class MainController extends AppController {
|
||||
$count = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
$numClaims = $count->Total;
|
||||
|
||||
$stmt = $conn->execute('SELECT MAX(id) AS MaxId FROM claim');
|
||||
$res = $stmt->fetch(\PDO::FETCH_OBJ);
|
||||
$maxClaimId = $res->MaxId;
|
||||
|
||||
$numPages = ceil($numClaims / $pageLimit);
|
||||
if ($page < 1) {
|
||||
$page = 1;
|
||||
@@ -144,14 +151,24 @@ class MainController extends AppController {
|
||||
$page = $numPages;
|
||||
}
|
||||
|
||||
$offset = ($page - 1) * $pageLimit;
|
||||
$claims = $this->Claims->find()->select($this->Claims)->select(['publisher' => 'C.name'])->leftJoin(['C' => 'claim'], ['C.claim_id = Claims.publisher_id'])->order(['Claims.created_at' => 'DESC'])->offset($offset)->limit($pageLimit)->toArray();
|
||||
$startLimitId = $maxClaimId - ($page * $pageLimit);
|
||||
$endLimitId = $startLimitId + $pageLimit;
|
||||
if ($endLimitId > $maxClaimId) {
|
||||
$endLimitId = $maxClaimId;
|
||||
}
|
||||
|
||||
$blockedList = json_decode($this->_getBlockedList());
|
||||
$claims = $this->Claims->find()->select($this->Claims)->
|
||||
select(['publisher' => 'C.name', 'publisher_transaction_hash_id' => 'C.transaction_hash_id', 'publisher_vout' => 'C.vout'])->
|
||||
leftJoin(['C' => 'claim'], ['C.claim_id = Claims.publisher_id'])->
|
||||
where(['Claims.id >' => $startLimitId, 'Claims.id <=' => $endLimitId])->
|
||||
order(['Claims.id' => 'DESC'])->toArray();
|
||||
|
||||
for ($i = 0; $i < count($claims); $i++) {
|
||||
if ($canConvert && $claims[$i]->fee > 0 && $claims[$i]->fee_currency == 'USD') {
|
||||
$claims[$i]->price = $claims[$i]->fee / $priceInfo->price;
|
||||
}
|
||||
|
||||
|
||||
if (isset($claims[$i]->Stream)) {
|
||||
$json = json_decode($claims[$i]->Stream->Stream);
|
||||
if (isset($json->metadata->license)) {
|
||||
@@ -161,6 +178,17 @@ class MainController extends AppController {
|
||||
$claims[$i]->LicenseUrl = $json->metadata->licenseUrl;
|
||||
}
|
||||
}
|
||||
|
||||
$claimChannel = null;
|
||||
if ($claims[$i]->publisher_transaction_hash_id) {
|
||||
$claimChannel = new \stdClass();
|
||||
$claimChannel->transaction_hash_id = $claims[$i]->publisher_transaction_hash_id;
|
||||
$claimChannel->vout = $claims[$i]->publisher_vout;
|
||||
}
|
||||
|
||||
$blocked = $this->_isClaimBlocked($claims[$i], $claimChannel, $blockedList);
|
||||
$claims[$i]->isBlocked = $blocked;
|
||||
$claims[$i]->thumbnail_url = $blocked ? null : $claims[$i]->thumbnail_url; // don't show the thumbnails too
|
||||
}
|
||||
|
||||
$this->set('pageLimit', $pageLimit);
|
||||
@@ -191,7 +219,15 @@ class MainController extends AppController {
|
||||
$moreClaims = [];
|
||||
if (isset($claim->publisher) || $claim->claim_type == 1) {
|
||||
// find more claims for the publisher
|
||||
$moreClaims = $this->Claims->find()->select($this->Claims)->select(['publisher' => 'C.name'])->leftJoin(['C' => 'claim'], ['C.claim_id = Claims.publisher_id'])->where(['Claims.claim_type' => 1, 'Claims.id <>' => $claim->id, 'Claims.publisher_id' => isset($claim->publisher) ? $claim->publisher_id : $claim->claim_id])->limit(9)->order(['Claims.fee' => 'DESC', 'RAND()' => 'DESC'])->toArray();
|
||||
$moreClaimsQuery = $this->Claims->find()->select([
|
||||
'claim_id', 'bid_state', 'fee', 'fee_currency', 'is_nsfw', 'claim_type', 'name',
|
||||
'title', 'description', 'content_type', 'language', 'author', 'license', 'content_type',
|
||||
'created_at'
|
||||
])->select(['publisher' => 'C.name'])->leftJoin(['C' => 'claim'], ['C.claim_id = Claims.publisher_id'])->where(['Claims.claim_type' => 1, 'Claims.id <>' => $claim->id, 'Claims.publisher_id' => isset($claim->publisher) ? $claim->publisher_id : $claim->claim_id])->limit(9);
|
||||
if (isset($claim->publisher) && $claim->publisher_id !== 'f2cf43b86b9d70175dc22dbb9ff7806241d90780') { // prevent ORDER BY for this particular claim
|
||||
$moreClaimsQuery = $moreClaimsQuery->order(['Claims.fee' => 'DESC', 'RAND()' => 'DESC']);
|
||||
$moreClaims = $moreClaimsQuery->toArray();
|
||||
}
|
||||
for ($i = 0; $i < count($moreClaims); $i++) {
|
||||
if ($canConvert && $moreClaims[$i]->fee > 0 && $moreClaims[$i]->fee_currency == 'USD') {
|
||||
$moreClaims[$i]->price = $moreClaims[$i]->fee / $priceInfo->price;
|
||||
@@ -208,8 +244,15 @@ class MainController extends AppController {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// fetch blocked list
|
||||
$blockedList = json_decode($this->_getBlockedList());
|
||||
$claimChannel = $this->Claims->find()->select(['transaction_hash_id', 'vout'])->where(['claim_id' => $claim->publisher_id])->first();
|
||||
$claimIsBlocked = $this->_isClaimBlocked($claim, $claimChannel, $blockedList);
|
||||
|
||||
$this->set('claim', $claim);
|
||||
$this->set('moreClaims', $moreClaims);
|
||||
$this->set('claimIsBlocked', $claimIsBlocked);
|
||||
$this->set('moreClaims', $claimIsBlocked ? [] : $moreClaims);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,7 +269,7 @@ class MainController extends AppController {
|
||||
}
|
||||
|
||||
$transactions = $this->Transactions->find()->select(['Transactions.id', 'Transactions.hash', 'Transactions.value', 'Transactions.input_count', 'Transactions.output_count', 'Transactions.transaction_time', 'Transactions.created_at'])->order(['Transactions.created_at' => 'desc'])->limit(10)->toArray();
|
||||
|
||||
|
||||
$this->set('blocks', $blocks);
|
||||
$this->set('txs', $transactions);
|
||||
}
|
||||
@@ -359,21 +402,21 @@ class MainController extends AppController {
|
||||
else {
|
||||
$last_block = $this->Blocks->find()->select(['height'])->order(['height' => 'desc'])->first();
|
||||
$confirmations = $last_block->height - $block->height + 1;
|
||||
}
|
||||
}
|
||||
$inputs = $this->Inputs->find()->where(['transaction_id' => $tx->id])->order(['prevout_n' => 'asc'])->toArray();
|
||||
foreach($inputs as $input) {
|
||||
$inputAddresses = $this->Addresses->find()->select(['id', 'address'])->where(['id' => $input->input_address_id])->toArray();
|
||||
$input->input_addresses = $inputAddresses;
|
||||
}
|
||||
|
||||
|
||||
$outputs = $this->Outputs->find()->select($this->Outputs)->select(['spend_input_hash' => 'I.transaction_hash', 'spend_input_id' => 'I.id'])->where(['Outputs.transaction_id' => $tx->id])->leftJoin(['I' => 'input'], ['I.id = Outputs.spent_by_input_id'])->order(['Outputs.vout' => 'asc'])->toArray();
|
||||
for ($i = 0; $i < count($outputs); $i++) {
|
||||
for ($i = 0; $i < count($outputs); $i++) {
|
||||
$outputs[$i]->IsClaim = (strpos($outputs[$i]->script_pub_key_asm, 'CLAIM') > -1);
|
||||
$outputs[$i]->IsSupportClaim = (strpos($outputs[$i]->script_pub_key_asm, 'SUPPORT_CLAIM') > -1);
|
||||
$outputs[$i]->IsUpdateClaim = (strpos($outputs[$i]->script_pub_key_asm, 'UPDATE_CLAIM') > -1);
|
||||
$claim = $this->Claims->find()->select(['id', 'claim_id', 'claim_address', 'vout', 'transaction_hash_id'])->where(['transaction_hash_id' => $tx->hash, 'vout' => $outputs[$i]->vout])->first();
|
||||
$outputs[$i]->Claim = $claim;
|
||||
|
||||
|
||||
$output_address = trim($outputs[$i]->address_list, '[""]');
|
||||
if(!$output_address && $claim) {
|
||||
$output_address = $claim->claim_address;
|
||||
@@ -416,7 +459,7 @@ class MainController extends AppController {
|
||||
}
|
||||
}
|
||||
|
||||
$lbryAddresses = ['rFLUohPG4tP3gZHYoyhvADCtrDMiaYb7Qd', 'r9PGXsejVJb9ZfMf3QVdDEJCzxkd9JLxzL', 'r9srwX7DEN7Mex3a8oR1mKSqQmLBizoJvi', 'bRo4FEeqqxY7nWFANsZsuKEWByEgkvz8Qt', 'bU2XUzckfpdEuQNemKvhPT1gexQ3GG3SC2', 'bay3VA6YTQBL4WLobbG7CthmoGeUKXuXkD', 'bLPbiXBp6Vr3NSnsHzDsLNzoy5o36re9Cz', 'bVUrbCK8hcZ5XWti7b9eNxKEBxzc1rr393', 'bZja2VyhAC84a9hMwT8dwTU6rDRXowrjxH', 'bMgqQqYfwzWWYBk5o5dBMXtCndVAoeqy6h', 'bMvUBo1h5WS46ThHtmfmXftz3z33VHL7wc'];
|
||||
$lbryAddresses = ['rEqocTgdPdoD8NEbrECTUPfpquJ4zPVCJ8', 'rKaAUDxr24hHNNTQuNtRvNt8SGYJMdLXo3', 'r7hj61jdbGXcsccxw8UmEFCReZoCWLRr7t', 'bRo4FEeqqxY7nWFANsZsuKEWByEgkvz8Qt', 'bU2XUzckfpdEuQNemKvhPT1gexQ3GG3SC2', 'bay3VA6YTQBL4WLobbG7CthmoGeUKXuXkD', 'bLPbiXBp6Vr3NSnsHzDsLNzoy5o36re9Cz', 'bVUrbCK8hcZ5XWti7b9eNxKEBxzc1rr393', 'bZja2VyhAC84a9hMwT8dwTU6rDRXowrjxH', 'bMgqQqYfwzWWYBk5o5dBMXtCndVAoeqy6h', 'bMvUBo1h5WS46ThHtmfmXftz3z33VHL7wc', 'bX6napXtY2nVTBRc8PwULBuGWn2i3SCtrN'];
|
||||
$totalBalance = 0;
|
||||
$maxBalance = 0;
|
||||
$minBalance = 0;
|
||||
@@ -477,7 +520,7 @@ class MainController extends AppController {
|
||||
$canTag = true;
|
||||
$transactionAddresses = $this->TransactionAddresses->find()->where(['address_id' => $address->id])->toArray();
|
||||
$numTransactions = count($transactionAddresses);
|
||||
|
||||
|
||||
$all = $this->request->query('all');
|
||||
if ($all === 'true') {
|
||||
$offset = 0;
|
||||
@@ -495,7 +538,7 @@ class MainController extends AppController {
|
||||
|
||||
$offset = ($page - 1) * $pageLimit;
|
||||
}
|
||||
|
||||
|
||||
$stmt = $conn->execute(sprintf(
|
||||
'SELECT T.id, T.hash, T.input_count, T.output_count, T.block_hash_id, ' .
|
||||
' TA.debit_amount, TA.credit_amount, ' .
|
||||
@@ -552,7 +595,7 @@ class MainController extends AppController {
|
||||
echo $qrCode->writeString();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
public function apiblocksize($timePeriod = '24h') {
|
||||
$this->autoRender = false;
|
||||
|
||||
@@ -587,7 +630,7 @@ class MainController extends AppController {
|
||||
$resultSet[$price->TimePeriod]['AvgUSD'] = (float) $price->AvgUSD;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
$conn = ConnectionManager::get('default');
|
||||
// get avg block sizes for the time period
|
||||
$stmt = $conn->execute("SELECT AVG(block_size) AS AvgBlockSize, DATE_FORMAT(FROM_UNIXTIME(block_time), '$sqlDateFormat') AS TimePeriod " .
|
||||
@@ -602,7 +645,7 @@ class MainController extends AppController {
|
||||
|
||||
return $this->_jsonResponse(['success' => true, 'data' => $resultSet]);
|
||||
}
|
||||
|
||||
|
||||
public function apirealtimeblocks() {
|
||||
// Load 10 blocks
|
||||
$this->autoRender = false;
|
||||
@@ -616,7 +659,7 @@ class MainController extends AppController {
|
||||
|
||||
$this->_jsonResponse(['success' => true, 'blocks' => $blocks]);
|
||||
}
|
||||
|
||||
|
||||
public function apirealtimetx() {
|
||||
// Load 10 transactions
|
||||
$this->autoRender = false;
|
||||
@@ -625,8 +668,8 @@ class MainController extends AppController {
|
||||
|
||||
$this->_jsonResponse(['success' => true, 'txs' => $txs]);
|
||||
}
|
||||
|
||||
protected function _gettxoutsetinfo() {
|
||||
|
||||
/*protected function _gettxoutsetinfo() {
|
||||
$now = new \DateTime('now', new \DateTimeZone('UTC'));
|
||||
$txOutSetInfo = new \stdClass();
|
||||
$txOutSetInfo->time = $now->format('c');
|
||||
@@ -649,7 +692,6 @@ class MainController extends AppController {
|
||||
}
|
||||
|
||||
if ($shouldRefreshSet) {
|
||||
|
||||
$req = ['method' => 'gettxoutsetinfo', 'params' => []];
|
||||
try {
|
||||
$res = json_decode(self::curl_json_post(self::$rpcurl, json_encode($req)));
|
||||
@@ -667,7 +709,7 @@ class MainController extends AppController {
|
||||
}
|
||||
|
||||
return (isset($txOutSetInfo->tosi)) ? $txOutSetInfo->tosi : 'N/A';
|
||||
}
|
||||
}*/
|
||||
|
||||
public function apistatus() {
|
||||
$this->autoRender = false;
|
||||
@@ -775,12 +817,12 @@ class MainController extends AppController {
|
||||
if (!isset($base58address)) {
|
||||
return $this->_jsonError('Base58 address not specified.', 400);
|
||||
}
|
||||
|
||||
|
||||
$address = $this->Addresses->find()->select(['id', 'balance'])->where(['address' => $base58address])->first();
|
||||
if (!$address) {
|
||||
return $this->_jsonError('Could not find address.', 400);
|
||||
}
|
||||
|
||||
|
||||
return $this->_jsonResponse(['success' => true, ['balance' => ['confirmed' => $address->balance, 'unconfirmed' => 0]]]);
|
||||
}
|
||||
|
||||
@@ -840,20 +882,30 @@ class MainController extends AppController {
|
||||
|
||||
$circulating = 0;
|
||||
$txoutsetinfo = $this->_gettxoutsetinfo();
|
||||
|
||||
$reservedcommunity = ['rFLUohPG4tP3gZHYoyhvADCtrDMiaYb7Qd'];
|
||||
$reservedoperational = ['r9PGXsejVJb9ZfMf3QVdDEJCzxkd9JLxzL'];
|
||||
$reservedinstitutional = ['r9srwX7DEN7Mex3a8oR1mKSqQmLBizoJvi'];
|
||||
$reservedaux = ['bRo4FEeqqxY7nWFANsZsuKEWByEgkvz8Qt', 'bU2XUzckfpdEuQNemKvhPT1gexQ3GG3SC2', 'bay3VA6YTQBL4WLobbG7CthmoGeUKXuXkD', 'bLPbiXBp6Vr3NSnsHzDsLNzoy5o36re9Cz', 'bMvUBo1h5WS46ThHtmfmXftz3z33VHL7wc', 'bVUrbCK8hcZ5XWti7b9eNxKEBxzc1rr393', 'bZja2VyhAC84a9hMwT8dwTU6rDRXowrjxH', 'bCrboXVztuSbZzVToCWSsu1pEr2oxKHu9v', 'bMgqQqYfwzWWYBk5o5dBMXtCndVAoeqy6h'];
|
||||
|
||||
$reservedcommunity = ['rEqocTgdPdoD8NEbrECTUPfpquJ4zPVCJ8'];
|
||||
$reservedoperational = ['r7hj61jdbGXcsccxw8UmEFCReZoCWLRr7t'];
|
||||
$reservedinstitutional = ['rKaAUDxr24hHNNTQuNtRvNt8SGYJMdLXo3'];
|
||||
$reservedaux = [
|
||||
'bRo4FEeqqxY7nWFANsZsuKEWByEgkvz8Qt',
|
||||
'bU2XUzckfpdEuQNemKvhPT1gexQ3GG3SC2',
|
||||
'bay3VA6YTQBL4WLobbG7CthmoGeUKXuXkD',
|
||||
'bLPbiXBp6Vr3NSnsHzDsLNzoy5o36re9Cz',
|
||||
'bMvUBo1h5WS46ThHtmfmXftz3z33VHL7wc',
|
||||
'bVUrbCK8hcZ5XWti7b9eNxKEBxzc1rr393',
|
||||
'bZja2VyhAC84a9hMwT8dwTU6rDRXowrjxH',
|
||||
'bCrboXVztuSbZzVToCWSsu1pEr2oxKHu9v',
|
||||
'bMgqQqYfwzWWYBk5o5dBMXtCndVAoeqy6h',
|
||||
'bX6napXtY2nVTBRc8PwULBuGWn2i3SCtrN'
|
||||
];
|
||||
$allAddresses = array_merge($reservedcommunity, $reservedoperational, $reservedinstitutional, $reservedaux);
|
||||
|
||||
$reservedtotal = $this->Addresses->find()->select(['id', 'balance' => 'SUM(balance)'])->where(['Addresses.address IN' => $allAddresses])->first();
|
||||
|
||||
$circulating = $txoutsetinfo->total_amount - ($reservedtotal->balance);
|
||||
$reservedtotal = $this->Addresses->find()->select(['balance' => 'SUM(balance)'])->where(['Addresses.address IN' => $allAddresses])->first();
|
||||
|
||||
return $this->_jsonResponse(['success' => true, 'utxosupply' => ['total' => $txoutsetinfo->total_amount, 'circulating' => $circulating]]);
|
||||
$circulating = (isset($txoutsetinfo) ? $txoutsetinfo->total_amount : 0) - ($reservedtotal->balance);
|
||||
return $this->_jsonResponse(['success' => true, 'utxosupply' => ['total' => isset($txoutsetinfo) ? $txoutsetinfo->total_amount : 0, 'circulating' => $circulating]]);
|
||||
}
|
||||
|
||||
|
||||
protected function _formatHashRate($value) {
|
||||
if ($value === 'N/A') {
|
||||
return $value;
|
||||
@@ -900,7 +952,7 @@ class MainController extends AppController {
|
||||
private function _gethashrate() {
|
||||
$req = ['method' => 'getnetworkhashps', 'params' => []];
|
||||
try {
|
||||
$res = json_decode(self::curl_json_post(self::$rpcurl, json_encode($req)));
|
||||
$res = json_decode(self::curl_json_post($this->rpcurl, json_encode($req)));
|
||||
if (!isset($res->result)) {
|
||||
return 0;
|
||||
}
|
||||
@@ -910,19 +962,6 @@ class MainController extends AppController {
|
||||
}
|
||||
}
|
||||
|
||||
// private function _gettxoutsetinfo() {
|
||||
// $req = ['method' => 'gettxoutsetinfo', 'params' => []];
|
||||
// try {
|
||||
// $res = json_decode(self::curl_json_post(self::$rpcurl, json_encode($req)));
|
||||
// if (!isset($res->result)) {
|
||||
// return 0;
|
||||
// }
|
||||
// return $res->result;
|
||||
// } catch (\Exception $e) {
|
||||
// return 'N/A';
|
||||
// }
|
||||
// }
|
||||
|
||||
private static function curl_json_post($url, $data, $headers = []) {
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
@@ -945,4 +984,67 @@ class MainController extends AppController {
|
||||
// Close any open file handle
|
||||
return $response;
|
||||
}
|
||||
|
||||
private function _isClaimBlocked($claim, $claimChannel, $blockedList) {
|
||||
if (!$blockedList || !isset($blockedList->data)) {
|
||||
// invalid blockedList response
|
||||
return false;
|
||||
}
|
||||
|
||||
$blockedOutpoints = $blockedList->data->outpoints;
|
||||
$claimIsBlocked = false;
|
||||
foreach ($blockedOutpoints as $outpoint) {
|
||||
// $parts[0] = txid
|
||||
// $parts[1] = vout
|
||||
$parts = explode(':', $outpoint);
|
||||
if ($claim->transaction_hash_id == $parts[0] && $claim->vout == $parts[1]) {
|
||||
$claimIsBlocked = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// check if the publisher (channel) is blocked
|
||||
// block the channel if that's the case
|
||||
if ($claimChannel && $claimChannel->transaction_hash_id == $parts[0] && $claimChannel->vout == $parts[1]) {
|
||||
$claimIsBlocked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $claimIsBlocked;
|
||||
}
|
||||
|
||||
private function _gettxoutsetinfo() {
|
||||
$cachedOutsetInfo = Cache::read('gettxoutsetinfo', 'api_requests');
|
||||
if ($cachedOutsetInfo !== false) {
|
||||
$res = json_decode($cachedOutsetInfo);
|
||||
if (isset($res->result)) {
|
||||
return $res->result;
|
||||
}
|
||||
}
|
||||
|
||||
$req = ['method' => 'gettxoutsetinfo', 'params' => []];
|
||||
try {
|
||||
$response = self::curl_json_post($this->rpcurl, json_encode($req));
|
||||
$res = json_decode($response);
|
||||
if (!isset($res->result)) {
|
||||
return null;
|
||||
}
|
||||
Cache::write('gettxoutsetinfo', $response, 'api_requests');
|
||||
return $res->result;
|
||||
} catch (\Exception $e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private function _getBlockedList() {
|
||||
$cachedList = Cache::read('list_blocked', 'api_requests');
|
||||
if ($cachedList !== false) {
|
||||
return $cachedList;
|
||||
}
|
||||
|
||||
// get the result from the api
|
||||
$response = self::curl_get(self::blockedListUrl);
|
||||
Cache::write('list_blocked', $response, 'api_requests');
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,14 @@ $ctTag = $claim->getContentTag();
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php if ($claim->isBlocked): ?>
|
||||
|
||||
<div class="blocked-info">
|
||||
In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this content from our applications. For more information, please refer to <a href="https://lbry.com/faq/dmca" target="_blank">DMCA takedown requests</a>
|
||||
</div>
|
||||
|
||||
<?php else: ?>
|
||||
|
||||
<div class="metadata">
|
||||
<div class="title" title="<?php echo $claim->claim_type == 1 ? $claim->name : ((strlen(trim($claim->title)) > 0) ? $claim->title : '') ?>"><?php echo $claim->claim_type == 1 ? $claim->name : ((strlen(trim($claim->title)) > 0) ? $claim->title : '<em>No Title</em>') ?></div>
|
||||
<div class="link" title="<?php echo $claim->getLbryLink() ?>"><a href="<?php echo $claim->getLbryLink() ?>" rel="nofollow"><?php echo $claim->getLbryLink() ?></a></div>
|
||||
@@ -61,10 +69,10 @@ $ctTag = $claim->getContentTag();
|
||||
|
||||
<!--<div class="label half-width">Author</div>
|
||||
<div class="label half-width">License</div>-->
|
||||
|
||||
|
||||
|
||||
|
||||
<!--<div class="value half-width" title="<?php echo strlen(trim($claim->author)) > 0 ? $claim->author : '<em>Unspecified</em>' ?>"><?php echo strlen(trim($claim->author)) > 0 ? $claim->author : '<em>Unspecified</em>' ?></div>
|
||||
|
||||
|
||||
<div class="value half-width" title="<?php echo strlen(trim($claim->license)) > 0 ? $claim->license : '' ?>">
|
||||
<?php if (strlen(trim($claim->LicenseUrl)) > 0): ?><a href="<?php echo $claim->LicenseUrl ?>" rel="nofollow" target="_blank"><?php endif; ?>
|
||||
<?php echo strlen(trim($claim->License)) > 0 ? $claim->License : '<em>Unspecified</em>' ?>
|
||||
@@ -73,4 +81,5 @@ $ctTag = $claim->getContentTag();
|
||||
-->
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
@@ -17,7 +17,7 @@
|
||||
<script>try{Typekit.load({ async: true });}catch(e){}</script>
|
||||
|
||||
<!-- Analytics -->
|
||||
<?php if ($_SERVER['HTTP_HOST'] === 'explorer.lbry.io'): ?>
|
||||
<?php if ($_SERVER['HTTP_HOST'] === 'explorer.lbry.com'): ?>
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="//www.googletagmanager.com/gtag/js?id=UA-60403362-1"></script>
|
||||
<script>
|
||||
@@ -57,7 +57,7 @@
|
||||
<?php echo $this->fetch('content') ?>
|
||||
<footer>
|
||||
<div class="content">
|
||||
<a href="https://lbry.io">LBRY</a>
|
||||
<a href="https://lbry.com">LBRY</a>
|
||||
|
||||
<div class="page-time">Page took <?php echo round((microtime(true) - TIME_START) * 1000, 0) ?>ms</div>
|
||||
</div>
|
||||
|
||||
@@ -65,6 +65,15 @@ if (strlen(trim($desc)) == 0) {
|
||||
</div>
|
||||
|
||||
<div class="claims-body">
|
||||
<?php if ($claimIsBlocked): ?>
|
||||
|
||||
<div class="blocked-claim-info">
|
||||
<div class="content">
|
||||
In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this content from our applications. For more information, please refer to <a href="https://lbry.com/faq/dmca" target="_blank">DMCA takedown requests</a>.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php else: ?>
|
||||
<div class="claim-info">
|
||||
<div data-autothumb="<?php echo $autoThumbText ?>" class="thumbnail <?php echo $a[mt_rand(0, count($a) - 1)] ?>">
|
||||
<?php if (!$claim->is_nsfw && strlen(trim($claim->thumbnail_url)) > 0): ?>
|
||||
@@ -140,6 +149,7 @@ if (strlen(trim($desc)) == 0) {
|
||||
|
||||
<div class="clear"></div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (count($moreClaims) > 0): ?>
|
||||
|
||||
@@ -155,7 +165,7 @@ if (strlen(trim($desc)) == 0) {
|
||||
$row++;
|
||||
}
|
||||
echo $this->element('claimbox', array('claim' => $claim, 'idx' => $idx, 'last_row' => $last_row));
|
||||
$idx++;
|
||||
$idx++;
|
||||
endforeach; ?>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
@@ -83,6 +83,7 @@ border-radius: 0 8px 8px 0 }
|
||||
.claims-grid .claim-grid-item .tags .nsfw { background: #e53935; text-align: center; color: #fff; position: relative; left: 1px }
|
||||
.claims-grid .claim-grid-item .tags .bid-state { background: #551CA1; text-align: center; color: #fff; }
|
||||
.claims-grid .claim-grid-item .tags .content-type { background: #880e4f; text-align: center; color: #fff; }
|
||||
.claims-grid .claim-grid-item .blocked-info { padding: 24px; font-size: 90%; }
|
||||
.claims-grid .claim-grid-item .metadata { padding: 24px; font-size: 90% }
|
||||
.claims-grid .claim-grid-item .title { font-size: 120%; height: 25px; line-height: 25px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
|
||||
.claims-grid .claim-grid-item .desc { font-size: 90%; font-weight: 300; height: 72px; overflow: hidden; text-overflow: ellipsis; margin: 8px 0 20px 0; line-height: 24px }
|
||||
@@ -95,6 +96,8 @@ border-radius: 0 8px 8px 0 }
|
||||
.claims-grid .claim-grid-item .spacer { height: 16px }
|
||||
|
||||
.claims-body { width: 1200px; margin: 0 auto 0 auto; cursor: default }
|
||||
.claims-body .blocked-claim-info { border: 1px solid rgba(0,0,0,.15); cursor: default }
|
||||
.claims-body .blocked-claim-info .content { padding: 48px }
|
||||
.claims-body .claim-info { width: 400px; float: left; /*box-shadow: 0 2px 4px rgba(0,0,0,.175);*/ border: 1px solid rgba(0,0,0,.15); cursor: default }
|
||||
.claims-body .claim-info .thumbnail { width: 100%; height: 220px; background: #f0f0f0; display: block; position: relative; overflow: hidden }
|
||||
.claims-body .claim-info .thumbnail img { width: 100% }
|
||||
|
||||
@@ -38,7 +38,7 @@ function buildChartData(claimsData) {
|
||||
}
|
||||
|
||||
function loadChartData() {
|
||||
var api_url = "https://chainquery.lbry.io/api/sql?query=";
|
||||
var api_url = "https://chainquery.lbry.com/api/sql?query=";
|
||||
var query = "SELECT c1.claim_type, c1.bid_state, c1.effective_amount, c1.transaction_time, o.transaction_time AS 'spent_time' FROM claim c1 LEFT JOIN (SELECT output.claim_id, tx.transaction_time FROM output INNER JOIN input ON input.prevout_hash = output.transaction_hash AND input.prevout_n = output.vout INNER JOIN transaction tx ON tx.id = input.transaction_id) o ON o.claim_id=c1.claim_id AND c1.bid_state='Spent' ORDER BY c1.transaction_time ASC";
|
||||
var url = api_url + query;
|
||||
var loadProgress = $('.bids-chart-container .load-progress');
|
||||
@@ -167,4 +167,4 @@ divId: 'chart-export'
|
||||
}
|
||||
});
|
||||
loadChartData();
|
||||
});
|
||||
});
|
||||
@@ -97,7 +97,7 @@ function buildChartData(blockData) {
|
||||
}
|
||||
|
||||
function loadChartData() {
|
||||
var api_url = "https://chainquery.lbry.io/api/sql?query=";
|
||||
var api_url = "https://chainquery.lbry.com/api/sql?query=";
|
||||
var query = "SELECT height, block_time FROM block WHERE confirmations > 0 ORDER BY height";
|
||||
var url = api_url + query;
|
||||
var loadProgress = $('.mining-inflation-chart-container .load-progress');
|
||||
@@ -261,4 +261,4 @@ divId: 'chart-export'
|
||||
}
|
||||
});
|
||||
loadChartData();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user