Compare commits

..

8 commits

Author SHA1 Message Date
Akinwale Ariwodola
0c0f8623e1 rename cache key 2019-12-13 15:31:48 +01:00
Akinwale Ariwodola
caaa716939 add caching for api request 2019-12-13 15:30:55 +01:00
Akinwale Ariwodola
caaf528d14 optimisation: break out of foreach loop if match found 2019-12-13 14:42:19 +01:00
Akinwale Ariwodola
076dfd0597 don't show blocked claims in the result grid 2019-12-13 14:38:32 +01:00
Akinwale Ariwodola
15e4af521b Merge branch 'blocked-claims' of https://github.com/lbryio/block-explorer into blocked-claims 2019-12-13 10:48:29 +01:00
Akinwale Ariwodola
152fbd043c channel-level blocking 2019-12-13 10:46:57 +01:00
Niko Storni
33ac4fab0c fix chainquery endpoint 2019-12-11 17:28:14 +01:00
Akinwale Ariwodola
8c6c576a31 handle blocked claims 2019-12-11 17:24:53 +01:00
16 changed files with 836 additions and 1851 deletions

View file

@ -2,23 +2,18 @@
A simple PHP block explorer for browsing transactions and claims on the [LBRY](https://lbry.com) blockchain. The explorer was developed using CakePHP which is a model-view-controller (MVC) PHP framework.
## Requirements
## Installation
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
* MariaDB 10.2 or higher
* Redis Server (optional, only required for the CakePHP redis cache engine, or to run `forevermempool`)
* PHP 7.4 or higher
* PHP 7.2 or higher
* php-fpm
* [igbinary extension](https://github.com/igbinary/igbinary)
* [phpredis extension](https://github.com/phpredis/phpredis)
* composer (PHP package manager)
on ubuntu you may use this to install php requirements
```bash
sudo apt install php7.4-gmp php7.4-intl php7.4-mbstring php7.4-mysql php7.4-bcmath php7.4-gd
```
### Installation steps
* Clone the Github repository. `git clone https://github.com/lbryio/block-explorer`
* Create a MariaDB database using the DDL found in `block-explorer/sql/lbryexplorer.ddl.sql`

View file

@ -6,7 +6,7 @@
"license": "MIT",
"require": {
"php": ">=5.6",
"cakephp/cakephp": "3.7.7",
"cakephp/cakephp": "3.7.1",
"mobiledetect/mobiledetectlib": "2.*",
"cakephp/migrations": "~1.0",
"psr/simple-cache": "^1.0.0",
@ -41,6 +41,7 @@
"scripts": {
"post-install-cmd": "App\\Console\\Installer::postInstall",
"post-create-project-cmd": "App\\Console\\Installer::postInstall",
"post-autoload-dump": "Cake\\Composer\\Installer\\PluginInstaller::postAutoloadDump",
"check": [
"@test",
"@cs-check"
@ -49,11 +50,5 @@
"cs-fix": "phpcbf --colors --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests",
"test": "phpunit --colors=always"
},
"prefer-stable": true,
"config": {
"allow-plugins": {
"cakephp/plugin-installer": true,
"kylekatarnls/update-helper": true
}
}
"prefer-stable": true
}

2481
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -226,4 +226,5 @@ if (Configure::read('debug')) {
Application::addPlugin('DebugKit', ['bootstrap' => true]);
}
Configure::load('lbry', 'default');
Configure::load('lbry','lbry.default');

2
dev.sh
View file

@ -2,7 +2,7 @@
set -e
PHPBIN=php7.4
PHPBIN=php7.2
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

View file

@ -32,9 +32,9 @@ class ClaimsController extends AppController {
}
$conn = ConnectionManager::get('default');
// $stmt = $conn->execute('SELECT COUNT(Id) AS Total FROM Claims WHERE ThumbnailUrl IS NOT NULL AND LENGTH(TRIM(ThumbnailUrl)) > 0');
// $count = $stmt->fetch(\PDO::FETCH_OBJ);
$numClaims = 23000000;
$stmt = $conn->execute('SELECT COUNT(Id) AS Total FROM Claims WHERE ThumbnailUrl IS NOT NULL AND LENGTH(TRIM(ThumbnailUrl)) > 0');
$count = $stmt->fetch(\PDO::FETCH_OBJ);
$numClaims = $count->Total;
if ($beforeId < 0) {
$beforeId = 0;

View file

@ -19,25 +19,25 @@ use Endroid\QrCode\Response\QrCodeResponse;
class MainController extends AppController {
protected $rpcurl;
public static $rpcurl;
const lbcPriceKey = 'lbc.price';
const txOutSetInfo = 'lbrcrd.tosi';
const bittrexMarketUrl = 'https://api.bittrex.com/v3/markets/LBC-BTC/ticker';
const bittrexMarketUrl = 'https://bittrex.com/api/v1.1/public/getticker?market=BTC-LBC';
const blockchainTickerUrl = 'https://blockchain.info/ticker';
const tagReceiptAddress = 'bLockNgmfvnnnZw7bM6SPz6hk5BVzhevEp';
const blockedListUrl = 'https://api.odysee.com/file/list_blocked';
const blockedListUrl = 'https://api.lbry.com/file/list_blocked';
protected $redis;
public function initialize() {
parent::initialize();
$this->rpcurl = Configure::read('Lbry.RpcUrl');
self::$rpcurl = Configure::read('Lbry.RpcUrl');
$this->redis = new \Predis\Client(Configure::read('Redis.Url'));
try {
$this->redis->info('mem');
@ -72,13 +72,13 @@ class MainController extends AppController {
$btrxjson = json_decode(self::curl_get(self::bittrexMarketUrl));
$blckjson = json_decode(self::curl_get(self::blockchainTickerUrl));
if ($btrxjson) {
$onelbc = $btrxjson->bidRate;
if ($btrxjson->success) {
$onelbc = $btrxjson->result->Bid;
$lbcPrice = 0;
if (isset($blckjson->USD)) {
$lbcPrice = $onelbc * $blckjson->USD->buy;
if ($lbcPrice > 0) {
$priceInfo->price = number_format($lbcPrice, 3, '.', '');
$priceInfo->price = number_format($lbcPrice, 2, '.', '');
$priceInfo->time = $now->format('c');
if ($this->redis) {
$this->redis->set(self::lbcPriceKey, json_encode($priceInfo));
@ -99,7 +99,11 @@ class MainController extends AppController {
$lbcUsdPrice = $this->_getLatestPrice();
$this->set('lbcUsdPrice', $lbcUsdPrice);
$blocks = $this->Blocks->find()->select(['chainwork', 'confirmations', 'difficulty', 'hash', 'height', 'block_time', 'block_size','tx_count'])->order(['height' => 'desc'])->limit(6)->toArray();
$blocks = $this->Blocks->find()->select(['chainwork', 'confirmations', 'difficulty', 'hash', 'height', 'transaction_hashes', 'block_time', 'block_size'])->order(['height' => 'desc'])->limit(6)->toArray();
for ($i = 0; $i < count($blocks); $i++) {
$tx_hashes = preg_split('#,#', $blocks[$i]->transaction_hashes);
$blocks[$i]->transaction_count = count($tx_hashes);
}
// hash rate
$hashRate = $this->_formatHashRate($this->_gethashrate());
@ -131,9 +135,9 @@ class MainController extends AppController {
$page = intval($this->request->query('page'));
$conn = ConnectionManager::get('default');
// $stmt = $conn->execute('SELECT COUNT(id) AS Total FROM claim');
// $count = $stmt->fetch(\PDO::FETCH_OBJ);
$numClaims = 20000000;
$stmt = $conn->execute('SELECT COUNT(id) AS Total FROM claim');
$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);
@ -215,15 +219,7 @@ class MainController extends AppController {
$moreClaims = [];
if (isset($claim->publisher) || $claim->claim_type == 1) {
// find more claims for the publisher
$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();
}
$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();
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;
@ -258,7 +254,11 @@ class MainController extends AppController {
$this->loadModel('Outputs');
// load 10 blocks and transactions
$blocks = $this->Blocks->find()->select(['height', 'block_time', 'tx_count'])->order(['height' => 'desc'])->limit(10)->toArray();
$blocks = $this->Blocks->find()->select(['height', 'block_time', 'transaction_hashes'])->order(['height' => 'desc'])->limit(10)->toArray();
for ($i = 0; $i < count($blocks); $i++) {
$tx_hashes = preg_split('#,#', $blocks[$i]->transaction_hashes);
$blocks[$i]->transaction_count = count($tx_hashes);
}
$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();
@ -327,7 +327,7 @@ class MainController extends AppController {
$page = intval($this->request->query('page'));
$conn = ConnectionManager::get('default');
$stmt = $conn->execute('SELECT height AS Total FROM block order by id desc limit 1');
$stmt = $conn->execute('SELECT COUNT(id) AS Total FROM block');
$count = $stmt->fetch(\PDO::FETCH_OBJ);
$numBlocks = $count->Total;
@ -342,7 +342,7 @@ class MainController extends AppController {
$offset = ($page - 1) * $pageLimit;
$currentBlock = $this->Blocks->find()->select(['height'])->order(['height' => 'DESC'])->first();
$blocks = $this->Blocks->find()->select(
['height', 'difficulty', 'block_size', 'nonce', 'block_time','tx_count']
['height', 'difficulty', 'transaction_hashes', 'block_size', 'nonce', 'block_time']
)->offset($offset)->limit($pageLimit)->order(['height' => 'DESC'])->toArray();
$this->set('currentBlock', $currentBlock);
$this->set('blocks', $blocks);
@ -451,7 +451,7 @@ class MainController extends AppController {
}
}
$lbryAddresses = ['rEqocTgdPdoD8NEbrECTUPfpquJ4zPVCJ8', 'rKaAUDxr24hHNNTQuNtRvNt8SGYJMdLXo3', 'r7hj61jdbGXcsccxw8UmEFCReZoCWLRr7t', 'bRo4FEeqqxY7nWFANsZsuKEWByEgkvz8Qt', 'bU2XUzckfpdEuQNemKvhPT1gexQ3GG3SC2', 'bay3VA6YTQBL4WLobbG7CthmoGeUKXuXkD', 'bLPbiXBp6Vr3NSnsHzDsLNzoy5o36re9Cz', 'bVUrbCK8hcZ5XWti7b9eNxKEBxzc1rr393', 'bZja2VyhAC84a9hMwT8dwTU6rDRXowrjxH', 'bMgqQqYfwzWWYBk5o5dBMXtCndVAoeqy6h', 'bMvUBo1h5WS46ThHtmfmXftz3z33VHL7wc', 'bX6napXtY2nVTBRc8PwULBuGWn2i3SCtrN', 'bG1fEEqDVepDy3AbvM8outQ3FQUu76aDot'];
$lbryAddresses = ['rFLUohPG4tP3gZHYoyhvADCtrDMiaYb7Qd', 'r9PGXsejVJb9ZfMf3QVdDEJCzxkd9JLxzL', 'r9srwX7DEN7Mex3a8oR1mKSqQmLBizoJvi', 'bRo4FEeqqxY7nWFANsZsuKEWByEgkvz8Qt', 'bU2XUzckfpdEuQNemKvhPT1gexQ3GG3SC2', 'bay3VA6YTQBL4WLobbG7CthmoGeUKXuXkD', 'bLPbiXBp6Vr3NSnsHzDsLNzoy5o36re9Cz', 'bVUrbCK8hcZ5XWti7b9eNxKEBxzc1rr393', 'bZja2VyhAC84a9hMwT8dwTU6rDRXowrjxH', 'bMgqQqYfwzWWYBk5o5dBMXtCndVAoeqy6h', 'bMvUBo1h5WS46ThHtmfmXftz3z33VHL7wc'];
$totalBalance = 0;
$maxBalance = 0;
$minBalance = 0;
@ -642,7 +642,12 @@ class MainController extends AppController {
// Load 10 blocks
$this->autoRender = false;
$this->loadModel('Blocks');
$blocks = $this->Blocks->find()->select(['Height' => 'height', 'BlockTime' => 'block_time', 'TransactionCount'=>'tx_count'])->order(['Height' => 'desc'])->limit(10)->toArray();
$blocks = $this->Blocks->find()->select(['Height' => 'height', 'BlockTime' => 'block_time', 'transaction_hashes'])->order(['Height' => 'desc'])->limit(10)->toArray();
for ($i = 0; $i < count($blocks); $i++) {
$tx_hashes = preg_split('#,#', $blocks[$i]->transaction_hashes);
$blocks[$i]->TransactionCount = count($tx_hashes);
unset($blocks[$i]->transaction_hashes);
}
$this->_jsonResponse(['success' => true, 'blocks' => $blocks]);
}
@ -656,7 +661,7 @@ 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');
@ -679,6 +684,7 @@ class MainController extends AppController {
}
if ($shouldRefreshSet) {
$req = ['method' => 'gettxoutsetinfo', 'params' => []];
try {
$res = json_decode(self::curl_json_post(self::$rpcurl, json_encode($req)));
@ -696,7 +702,7 @@ class MainController extends AppController {
}
return (isset($txOutSetInfo->tosi)) ? $txOutSetInfo->tosi : 'N/A';
}*/
}
public function apistatus() {
$this->autoRender = false;
@ -724,9 +730,12 @@ class MainController extends AppController {
public function apirecentblocks() {
$this->autoRender = false;
$this->loadModel('Blocks');
$blocks = $this->Blocks->find()->select(['Difficulty' => 'difficulty', 'Hash' => 'hash', 'Height' => 'height', 'BlockTime' => 'block_time', 'BlockSize' => 'block_size', 'TransactionCount' => 'tx_count'])->order(['Height' => 'desc'])->limit(6)->toArray();
$blocks = $this->Blocks->find()->select(['Difficulty' => 'difficulty', 'Hash' => 'hash', 'Height' => 'height', 'transaction_hashes', 'BlockTime' => 'block_time', 'BlockSize' => 'block_size'])->order(['Height' => 'desc'])->limit(6)->toArray();
for ($i = 0; $i < count($blocks); $i++) {
$tx_hashes = preg_split('#,#', $blocks[$i]->transaction_hashes);
$blocks[$i]->TransactionCount = count($tx_hashes);
$blocks[$i]->Difficulty = number_format($blocks[$i]->Difficulty, 2, '.', '');
unset($blocks[$i]->transaction_hashes);
}
return $this->_jsonResponse(['success' => true, 'blocks' => $blocks]);
}
@ -867,27 +876,17 @@ class MainController extends AppController {
$circulating = 0;
$txoutsetinfo = $this->_gettxoutsetinfo();
$reservedcommunity = ['rEqocTgdPdoD8NEbrECTUPfpquJ4zPVCJ8'];
$reservedoperational = ['r7hj61jdbGXcsccxw8UmEFCReZoCWLRr7t'];
$reservedinstitutional = ['rKaAUDxr24hHNNTQuNtRvNt8SGYJMdLXo3'];
$reservedaux = [
'bRo4FEeqqxY7nWFANsZsuKEWByEgkvz8Qt',
'bU2XUzckfpdEuQNemKvhPT1gexQ3GG3SC2',
'bay3VA6YTQBL4WLobbG7CthmoGeUKXuXkD',
'bLPbiXBp6Vr3NSnsHzDsLNzoy5o36re9Cz',
'bMvUBo1h5WS46ThHtmfmXftz3z33VHL7wc',
'bVUrbCK8hcZ5XWti7b9eNxKEBxzc1rr393',
'bZja2VyhAC84a9hMwT8dwTU6rDRXowrjxH',
'bCrboXVztuSbZzVToCWSsu1pEr2oxKHu9v',
'bMgqQqYfwzWWYBk5o5dBMXtCndVAoeqy6h',
'bX6napXtY2nVTBRc8PwULBuGWn2i3SCtrN'
];
$reservedcommunity = ['rFLUohPG4tP3gZHYoyhvADCtrDMiaYb7Qd'];
$reservedoperational = ['r9PGXsejVJb9ZfMf3QVdDEJCzxkd9JLxzL'];
$reservedinstitutional = ['r9srwX7DEN7Mex3a8oR1mKSqQmLBizoJvi'];
$reservedaux = ['bRo4FEeqqxY7nWFANsZsuKEWByEgkvz8Qt', 'bU2XUzckfpdEuQNemKvhPT1gexQ3GG3SC2', 'bay3VA6YTQBL4WLobbG7CthmoGeUKXuXkD', 'bLPbiXBp6Vr3NSnsHzDsLNzoy5o36re9Cz', 'bMvUBo1h5WS46ThHtmfmXftz3z33VHL7wc', 'bVUrbCK8hcZ5XWti7b9eNxKEBxzc1rr393', 'bZja2VyhAC84a9hMwT8dwTU6rDRXowrjxH', 'bCrboXVztuSbZzVToCWSsu1pEr2oxKHu9v', 'bMgqQqYfwzWWYBk5o5dBMXtCndVAoeqy6h'];
$allAddresses = array_merge($reservedcommunity, $reservedoperational, $reservedinstitutional, $reservedaux);
$reservedtotal = $this->Addresses->find()->select(['balance' => 'SUM(balance)'])->where(['Addresses.address IN' => $allAddresses])->first();
$reservedtotal = $this->Addresses->find()->select(['id', 'balance' => 'SUM(balance)'])->where(['Addresses.address IN' => $allAddresses])->first();
$circulating = (isset($txoutsetinfo) ? $txoutsetinfo->total_amount : 0) - ($reservedtotal->balance);
return $this->_jsonResponse(['success' => true, 'utxosupply' => ['total' => isset($txoutsetinfo) ? $txoutsetinfo->total_amount : 0, 'circulating' => $circulating]]);
$circulating = $txoutsetinfo->total_amount - ($reservedtotal->balance);
return $this->_jsonResponse(['success' => true, 'utxosupply' => ['total' => $txoutsetinfo->total_amount, 'circulating' => $circulating]]);
}
protected function _formatHashRate($value) {
@ -936,7 +935,7 @@ class MainController extends AppController {
private function _gethashrate() {
$req = ['method' => 'getnetworkhashps', 'params' => []];
try {
$res = json_decode(self::curl_json_post($this->rpcurl, json_encode($req)));
$res = json_decode(self::curl_json_post(self::$rpcurl, json_encode($req)));
if (!isset($res->result)) {
return 0;
}
@ -946,6 +945,19 @@ 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);
@ -997,29 +1009,6 @@ class MainController extends AppController {
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) {

View file

@ -13,7 +13,7 @@ class AuxShell extends Shell {
public static $rpcurl;
const bittrex = 'https://api.bittrex.com/v3/markets/LBC-BTC/ticker';
const bittrex = 'https://bittrex.com/api/v1.1/public/getticker?market=BTC-LBC';
const blockchainticker = 'https://blockchain.info/ticker';
@ -150,13 +150,13 @@ class AuxShell extends Shell {
$btrxjson = json_decode(self::curl_get(self::bittrex));
$blckjson = json_decode(self::curl_get(self::blockchainticker));
if ($btrxjson) {
$btc = $btrxjson->bidRate;
if ($btrxjson->success) {
$btc = $btrxjson->result->Bid;
$usd = 0;
if (isset($blckjson->USD)) {
$usd = $btc * $blckjson->USD->buy;
$priceInfo = new \stdClass();
$priceInfo->price = number_format($usd, 3, '.', '');
$priceInfo->price = number_format($usd, 2, '.', '');
$priceInfo->time = $now->format('c');
if ($redis) {
$redis->set(self::lbcpricekey, json_encode($priceInfo));

View file

@ -29,7 +29,7 @@ $ctTag = $claim->getContentTag();
<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): ?>
<img src="<?php echo htmlspecialchars('https://thumbnails.odycdn.com/optimize/s:1280:720/quality:85/plain/'.$claim->thumbnail_url) ?>" alt="" />
<img src="<?php echo htmlspecialchars($claim->thumbnail_url) ?>" alt="" />
<?php else: ?>
<div class="autothumb"><?php echo $autoThumbText ?></div>
<?php endif; ?>

View file

@ -17,7 +17,7 @@
<script>try{Typekit.load({ async: true });}catch(e){}</script>
<!-- Analytics -->
<?php if ($_SERVER['HTTP_HOST'] === 'explorer.lbry.com'): ?>
<?php if ($_SERVER['HTTP_HOST'] === 'explorer.lbry.io'): ?>
<!-- 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.com">LBRY</a>
<a href="https://lbry.io">LBRY</a>
<div class="page-time">Page took <?php echo round((microtime(true) - TIME_START) * 1000, 0) ?>ms</div>
</div>

View file

@ -184,7 +184,7 @@
<td class="right"><a href="/blocks/<?php echo $block->height ?>"><?php echo $block->height ?></a></td>
<td class="pad-left"><?php echo number_format($block->difficulty, 8, '.', '') ?></td>
<td class="right"><?php echo number_format((($currentBlock->height - $block->height) + 1), 0, '', ',') ?></td>
<td class="right"><?php echo $block->tx_count ?></td>
<td class="right"><?php echo count(preg_split('#,#', $block->transaction_hashes)) ?></td>
<td class="right"><?php echo round($block->block_size / 1024, 2) . 'KB' ?></td>
<td class="right pad-left"><?php echo $block->nonce ?></td>
<td class="pad-left"><?php echo \DateTime::createFromFormat('U', $block->block_time)->format('d M Y H:i:s') ?> UTC</td>

View file

@ -77,7 +77,7 @@ if (strlen(trim($desc)) == 0) {
<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): ?>
<img src="<?php echo htmlspecialchars('https://thumbnails.odycdn.com/optimize/s:1280:720/quality:85/plain/'.$claim->thumbnail_url) ?>" alt="" />
<img src="<?php echo htmlspecialchars($claim->thumbnail_url) ?>" alt="" />
<?php else: ?>
<div class="autothumb"><?php echo $autoThumbText ?></div>
<?php endif; ?>
@ -136,7 +136,9 @@ if (strlen(trim($desc)) == 0) {
<!--
<div class="value half-width"<?php if(strlen(trim($claim->license)) > 0): ?> title="<?php echo $claim->license ?>"<?php endif; ?>>
<?php if (strlen(trim($claim->license_url)) > 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>' ?>
<?php if (strlen(trim($claim->LicenseUrl))): ?></a><?php endif; ?>
</div>
-->
<div class="value half-width"><?php echo strlen(trim($claim->language)) > 0 ? ($claim->language == 'en' ? 'English' : '') : '<em>Unspecified</em>' ?></div>

View file

@ -171,7 +171,7 @@
<td><a href="/blocks/<?php echo $block->height ?>"><?php echo $block->height ?></a></td>
<td><?php echo \Carbon\Carbon::createFromTimestamp($block->block_time)->diffForHumans(); ?></td>
<td class="right"><?php echo round($block->block_size / 1024, 2) . 'KB' ?></td>
<td class="right"><?php echo $block->tx_count ?></td>
<td class="right"><?php echo $block->transaction_count ?></td>
<td class="right"><?php echo number_format($block->difficulty, 2, '.', '') ?></td>
<td class="last-cell"><?php echo DateTime::createFromFormat('U', $block->block_time)->format('d M Y H:i:s') . ' UTC' ?></td>
</tr>
@ -203,7 +203,7 @@
<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): ?>
<img src="<?php echo strip_tags('https://thumbnails.odycdn.com/optimize/s:1280:720/quality:85/plain/'.$claim->thumbnail_url) ?>" alt="" />
<img src="<?php echo strip_tags($claim->thumbnail_url) ?>" alt="" />
<?php else: ?>
<div class="autothumb"><?php echo $autoThumbText ?></div>
<?php endif; ?>

View file

@ -131,7 +131,7 @@
<tr data-height="<?php echo $block->height ?>" data-time="<?php echo $block->block_time ?>">
<td><a href="/blocks/<?php echo $block->height ?>" target="_blank"><?php echo $block->height ?></a></td>
<td><?php echo \Carbon\Carbon::createFromTimestamp($block->block_time)->diffForHumans(); ?></td>
<td class="right"><?php echo $block->tx_count ?></td>
<td class="right"><?php echo $block->transaction_count ?></td>
</tr>
<?php endforeach; ?>
</tbody>

View file

@ -38,7 +38,7 @@ function buildChartData(claimsData) {
}
function loadChartData() {
var api_url = "https://chainquery.odysee.tv/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');

View file

@ -97,7 +97,7 @@ function buildChartData(blockData) {
}
function loadChartData() {
var api_url = "https://chainquery.odysee.tv/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');