Compare commits

..
Author SHA1 Message Date
Akinwale Ariwodola f08049dc5c remove redundant code 2020-10-28 15:56:09 +01:00
Akinwale Ariwodola ecbd1c82cf skip more claims query 2020-10-28 15:55:11 +01:00
Akinwale Ariwodola 4f49235511 add created_at to field list 2020-10-28 15:51:45 +01:00
Akinwale Ariwodola 179f9c9339 use publisher_id 2020-10-28 15:50:45 +01:00
Akinwale Ariwodola c003a6b23a fix select field list 2020-10-28 15:43:38 +01:00
Akinwale Ariwodola aad314491b additional check for claim publisher 2020-10-28 15:41:17 +01:00
Akinwale Ariwodola b9fe194dc8 check publisher claim_id 2020-10-28 15:37:39 +01:00
Akinwale Ariwodola 15935ec109 fix CQ load when fetching more claims for a publishher 2020-10-28 15:23:28 +01:00
Jeremy Kauffman 7e9851ccfc Merge pull request #80 from lbryio/dependabot/composer/cakephp/cakephp-3.7.7
Bump cakephp/cakephp from 3.7.1 to 3.7.7
2020-03-16 14:04:26 -04:00
Jeremy Kauffman d7fb718dd0 Merge pull request #86 from kcseb/master
Change footer to .com
2020-03-16 14:03:03 -04:00
Kenneth C 6f4fa32078 Updated a missed .io 2020-03-09 20:33:19 -04:00
Kenneth C 8873373465 Update URL to .com 2020-03-09 20:32:16 -04:00
Akinwale Ariwodola a73d65b1c2 Merge pull request #85 from lbryio/fix-utxosupply
fix custom configuration loading and gettxoutsetinfo request
2020-03-04 16:04:37 +01:00
Thomas Zarebczan bb595d0027 update LBRY addresses 2020-02-27 18:22:34 -05:00
Akinwale Ariwodola 52d13987e5 fix custom configuration loading and gettxoutsetinfo request 2020-01-08 22:02:03 +01:00
Niko 57219734c3 Merge pull request #82 from lbryio/fix-utxosupply
Fix utxosupply
2020-01-08 14:06:36 +01:00
Akinwale Ariwodola a7c1b9b346 update community, operational and institutional addresses 2020-01-08 08:04:00 +01:00
Akinwale Ariwodola 77ca91757b fix _gettxoutsetinfo return type 2020-01-07 23:37:50 +01:00
Akinwale Ariwodola a147665e96 fix utxo supply 2020-01-07 23:34:50 +01:00
dependabot[bot] 0f197fc571 Bump cakephp/cakephp from 3.7.1 to 3.7.7
Bumps [cakephp/cakephp](https://github.com/cakephp/cakephp) from 3.7.1 to 3.7.7.
- [Release notes](https://github.com/cakephp/cakephp/releases)
- [Commits](https://github.com/cakephp/cakephp/compare/3.7.1...3.7.7)

Signed-off-by: dependabot[bot] <support@github.com>
2020-01-07 22:14:57 +00:00
Akinwale Ariwodola 31d515e992 Blocked claims (#81)
* handle blocked claims
* fix chainquery endpoint
* channel-level blocking
* don't show blocked claims in the result grid
* optimisation: break out of foreach loop if match found
* add caching for api request
* rename cache key
2020-01-07 23:13:38 +01:00
13 changed files with 241 additions and 181 deletions

No files matched your search

+18 -22
View File
@@ -1,33 +1,29 @@
os: linux
dist: xenial
language: php
services:
- docker
dist: trusty
cache:
directories:
- $HOME/.composer/cache/files
sudo: false
env:
- DATABASE_URL=mysql://lbry:lbry@localhost:15500/chainquery
- DATABASE_TEST_URL=mysql://lbry:lbry@localhost:15500/chainquery
php:
- 7.0
- 7.1
matrix:
fast_finish: true
include:
- php: 7.0
env: PHPCS=1
before_script:
- composer require cakephp/cakephp-codesniffer:~2.1
- composer install
- composer require phpunit/phpunit:"^5.7|^6.0"
- composer run-script post-install-cmd --no-interaction
- echo 'lbrycrdurl="rpc://lbry:lbry@lbrycrd:29245"' > chainqueryconfig.toml
- echo 'mysqldsn="lbry:lbry@tcp(mysql:3306)/chainquery"' >> chainqueryconfig.toml
- echo 'apimysqldsn="lbry:lbry@tcp(mysql:3306)/chainquery"' >> chainqueryconfig.toml
- echo 'blockchainname="lbrycrd_regtest"' >> chainqueryconfig.toml
- docker-compose up -d
- sleep 5
- if [[ $PHPCS = 1 ]]; then composer require cakephp/cakephp-codesniffer:~2.1; fi
- if [[ $PHPCS != 1 ]]; then composer install; fi
- if [[ $PHPCS != 1 ]]; then composer require phpunit/phpunit:"^5.7|^6.0"; fi
- if [[ $PHPCS != 1 ]]; then composer run-script post-install-cmd --no-interaction; fi
script:
- DATABASE_TEST_URL=mysql://lbry:lbry@localhost:15500/chainquery vendor/bin/phpunit
- vendor/bin/phpcs -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests ./config ./webroot
- if [[ $PHPCS != 1 ]]; then vendor/bin/phpunit; fi
- if [[ $PHPCS = 1 ]]; then vendor/bin/phpcs -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests ./config ./webroot; fi
notifications:
email: false
+1 -1
View File
@@ -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
+63 -63
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "bfdd477b9edc64f5c9f04b61d9bb6ae2",
"content-hash": "fcd3128079150fce9ed481f1769e120d",
"packages": [
{
"name": "aura/intl",
@@ -103,16 +103,16 @@
},
{
"name": "cakephp/cakephp",
"version": "3.7.1",
"version": "3.7.7",
"source": {
"type": "git",
"url": "https://github.com/cakephp/cakephp.git",
"reference": "1f6fd21ca27ffc88fa88506a400b94a809e29254"
"reference": "b0aeff37f78e6cca7ed35bc0e49dedd6cf5fb3d6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cakephp/cakephp/zipball/1f6fd21ca27ffc88fa88506a400b94a809e29254",
"reference": "1f6fd21ca27ffc88fa88506a400b94a809e29254",
"url": "https://api.github.com/repos/cakephp/cakephp/zipball/b0aeff37f78e6cca7ed35bc0e49dedd6cf5fb3d6",
"reference": "b0aeff37f78e6cca7ed35bc0e49dedd6cf5fb3d6",
"shasum": ""
},
"require": {
@@ -145,6 +145,7 @@
},
"require-dev": {
"cakephp/cakephp-codesniffer": "^3.0",
"cakephp/chronos": "^1.2.1",
"phpunit/phpunit": "^5.7.14|^6.0"
},
"suggest": {
@@ -187,7 +188,7 @@
"rapid-development",
"validation"
],
"time": "2018-12-18T02:39:37+00:00"
"time": "2019-04-24T01:30:19+00:00"
},
{
"name": "cakephp/chronos",
@@ -300,21 +301,21 @@
},
{
"name": "cakephp/plugin-installer",
"version": "1.2.0",
"version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/cakephp/plugin-installer.git",
"reference": "3be2ea116603341b196592053e973f4abe71e8b2"
"reference": "af9711ee5dfbe62a76e8aa86cb348895fab23b50"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cakephp/plugin-installer/zipball/3be2ea116603341b196592053e973f4abe71e8b2",
"reference": "3be2ea116603341b196592053e973f4abe71e8b2",
"url": "https://api.github.com/repos/cakephp/plugin-installer/zipball/af9711ee5dfbe62a76e8aa86cb348895fab23b50",
"reference": "af9711ee5dfbe62a76e8aa86cb348895fab23b50",
"shasum": ""
},
"require-dev": {
"cakephp/cakephp-codesniffer": "dev-master",
"composer/composer": "^1.0",
"composer/composer": "1.0.*@dev",
"phpunit/phpunit": "^4.8|^5.7|^6.0"
},
"type": "composer-installer",
@@ -323,7 +324,7 @@
},
"autoload": {
"psr-4": {
"Cake\\Composer\\": "src/"
"Cake\\Composer\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -333,11 +334,11 @@
"authors": [
{
"name": "CakePHP Community",
"homepage": "https://cakephp.org"
"homepage": "http://cakephp.org"
}
],
"description": "A composer installer for CakePHP 3.0+ plugins.",
"time": "2019-11-12T10:21:19+00:00"
"time": "2019-07-25T15:43:38+00:00"
},
{
"name": "dasprid/enum",
@@ -383,16 +384,16 @@
},
{
"name": "endroid/qr-code",
"version": "3.7.5",
"version": "3.7.3",
"source": {
"type": "git",
"url": "https://github.com/endroid/qr-code.git",
"reference": "c9097df3a107649c8347d2470c1bc984a4f6123a"
"reference": "a19e3fef5fa5b92d94219947a63944ecf2493e4b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/endroid/qr-code/zipball/c9097df3a107649c8347d2470c1bc984a4f6123a",
"reference": "c9097df3a107649c8347d2470c1bc984a4f6123a",
"url": "https://api.github.com/repos/endroid/qr-code/zipball/a19e3fef5fa5b92d94219947a63944ecf2493e4b",
"reference": "a19e3fef5fa5b92d94219947a63944ecf2493e4b",
"shasum": ""
},
"require": {
@@ -401,7 +402,7 @@
"khanamiryan/qrcode-detector-decoder": "^1.0.2",
"myclabs/php-enum": "^1.5",
"php": ">=7.2",
"symfony/http-foundation": "^3.4||^4.2.12||^5.0",
"symfony/http-foundation": "^3.4||^4.0||^5.0",
"symfony/options-resolver": "^3.4||^4.0||^5.0",
"symfony/property-access": "^3.4||^4.0||^5.0"
},
@@ -439,7 +440,7 @@
"qr",
"qrcode"
],
"time": "2019-12-22T18:55:19+00:00"
"time": "2019-11-23T10:53:01+00:00"
},
{
"name": "fgrosse/phpasn1",
@@ -1234,16 +1235,16 @@
},
{
"name": "symfony/debug",
"version": "v4.4.2",
"version": "v4.4.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/debug.git",
"reference": "5c4c1db977dc70bb3250e1308d3e8c6341aa38f5"
"reference": "b8600a1d7d20b0e80906398bb1f50612fa074a8e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/5c4c1db977dc70bb3250e1308d3e8c6341aa38f5",
"reference": "5c4c1db977dc70bb3250e1308d3e8c6341aa38f5",
"url": "https://api.github.com/repos/symfony/debug/zipball/b8600a1d7d20b0e80906398bb1f50612fa074a8e",
"reference": "b8600a1d7d20b0e80906398bb1f50612fa074a8e",
"shasum": ""
},
"require": {
@@ -1286,11 +1287,11 @@
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
"time": "2019-12-16T14:46:54+00:00"
"time": "2019-11-28T13:33:56+00:00"
},
{
"name": "symfony/filesystem",
"version": "v4.4.2",
"version": "v4.4.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
@@ -1340,16 +1341,16 @@
},
{
"name": "symfony/http-foundation",
"version": "v5.0.2",
"version": "v5.0.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
"reference": "5dd7f6be6e62d86ba6f3154cf40e78936367978b"
"reference": "83eb54b75f5365722d4ccdb6559fb099e799202e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/5dd7f6be6e62d86ba6f3154cf40e78936367978b",
"reference": "5dd7f6be6e62d86ba6f3154cf40e78936367978b",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/83eb54b75f5365722d4ccdb6559fb099e799202e",
"reference": "83eb54b75f5365722d4ccdb6559fb099e799202e",
"shasum": ""
},
"require": {
@@ -1391,11 +1392,11 @@
],
"description": "Symfony HttpFoundation Component",
"homepage": "https://symfony.com",
"time": "2019-12-19T16:01:11+00:00"
"time": "2019-11-28T14:20:16+00:00"
},
{
"name": "symfony/inflector",
"version": "v5.0.2",
"version": "v5.0.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/inflector.git",
@@ -1453,7 +1454,7 @@
},
{
"name": "symfony/mime",
"version": "v5.0.2",
"version": "v5.0.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/mime.git",
@@ -1515,7 +1516,7 @@
},
{
"name": "symfony/options-resolver",
"version": "v5.0.2",
"version": "v5.0.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/options-resolver.git",
@@ -1803,16 +1804,16 @@
},
{
"name": "symfony/property-access",
"version": "v5.0.2",
"version": "v5.0.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/property-access.git",
"reference": "b597c4f4dffc522bc4ed4bedcef9ed08d3ae3d23"
"reference": "542a4f041c4bcbefdecbd537122959d0c388ecd9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/property-access/zipball/b597c4f4dffc522bc4ed4bedcef9ed08d3ae3d23",
"reference": "b597c4f4dffc522bc4ed4bedcef9ed08d3ae3d23",
"url": "https://api.github.com/repos/symfony/property-access/zipball/542a4f041c4bcbefdecbd537122959d0c388ecd9",
"reference": "542a4f041c4bcbefdecbd537122959d0c388ecd9",
"shasum": ""
},
"require": {
@@ -1866,20 +1867,20 @@
"property path",
"reflection"
],
"time": "2019-12-10T11:06:55+00:00"
"time": "2019-12-01T10:51:15+00:00"
},
{
"name": "symfony/translation",
"version": "v4.4.2",
"version": "v4.4.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
"reference": "f7669f48a9633bf8139bc026c755e894b7206677"
"reference": "897fb68ee7933372517b551d6f08c6d4bb0b8c40"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/f7669f48a9633bf8139bc026c755e894b7206677",
"reference": "f7669f48a9633bf8139bc026c755e894b7206677",
"url": "https://api.github.com/repos/symfony/translation/zipball/897fb68ee7933372517b551d6f08c6d4bb0b8c40",
"reference": "897fb68ee7933372517b551d6f08c6d4bb0b8c40",
"shasum": ""
},
"require": {
@@ -1942,7 +1943,7 @@
],
"description": "Symfony Translation Component",
"homepage": "https://symfony.com",
"time": "2019-12-12T12:53:52+00:00"
"time": "2019-11-12T17:18:47+00:00"
},
{
"name": "symfony/translation-contracts",
@@ -2244,16 +2245,16 @@
},
{
"name": "asm89/twig-cache-extension",
"version": "1.4.0",
"version": "1.3.2",
"source": {
"type": "git",
"url": "https://github.com/asm89/twig-cache-extension.git",
"reference": "13787226956ec766f4770722082288097aebaaf3"
"reference": "630ea7abdc3fc62ba6786c02590a1560e449cf55"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/asm89/twig-cache-extension/zipball/13787226956ec766f4770722082288097aebaaf3",
"reference": "13787226956ec766f4770722082288097aebaaf3",
"url": "https://api.github.com/repos/asm89/twig-cache-extension/zipball/630ea7abdc3fc62ba6786c02590a1560e449cf55",
"reference": "630ea7abdc3fc62ba6786c02590a1560e449cf55",
"shasum": ""
},
"require": {
@@ -2261,8 +2262,7 @@
"twig/twig": "^1.0|^2.0"
},
"require-dev": {
"doctrine/cache": "~1.0",
"phpunit/phpunit": "^5.0 || ^4.8.10"
"doctrine/cache": "~1.0"
},
"suggest": {
"psr/cache-implementation": "To make use of PSR-6 cache implementation via PsrCacheAdapter."
@@ -2270,7 +2270,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
"dev-master": "1.3-dev"
}
},
"autoload": {
@@ -2295,7 +2295,7 @@
"extension",
"twig"
],
"time": "2020-01-01T20:47:37+00:00"
"time": "2017-01-10T22:04:15+00:00"
},
{
"name": "cakephp/bake",
@@ -3225,7 +3225,7 @@
},
{
"name": "symfony/finder",
"version": "v4.4.2",
"version": "v4.4.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
@@ -3274,16 +3274,16 @@
},
{
"name": "symfony/process",
"version": "v4.4.2",
"version": "v4.4.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "b84501ad50adb72a94fb460a5b5c91f693e99c9b"
"reference": "51c0135ef3f44c5803b33dc60e96bf4f77752726"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/b84501ad50adb72a94fb460a5b5c91f693e99c9b",
"reference": "b84501ad50adb72a94fb460a5b5c91f693e99c9b",
"url": "https://api.github.com/repos/symfony/process/zipball/51c0135ef3f44c5803b33dc60e96bf4f77752726",
"reference": "51c0135ef3f44c5803b33dc60e96bf4f77752726",
"shasum": ""
},
"require": {
@@ -3319,20 +3319,20 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"time": "2019-12-06T10:06:46+00:00"
"time": "2019-11-28T13:33:56+00:00"
},
{
"name": "symfony/var-dumper",
"version": "v4.4.2",
"version": "v4.4.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
"reference": "be330f919bdb395d1e0c3f2bfb8948512d6bdd99"
"reference": "0a89a1dbbedd9fb2cfb2336556dec8305273c19a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/be330f919bdb395d1e0c3f2bfb8948512d6bdd99",
"reference": "be330f919bdb395d1e0c3f2bfb8948512d6bdd99",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/0a89a1dbbedd9fb2cfb2336556dec8305273c19a",
"reference": "0a89a1dbbedd9fb2cfb2336556dec8305273c19a",
"shasum": ""
},
"require": {
@@ -3395,7 +3395,7 @@
"debug",
"dump"
],
"time": "2019-12-18T13:41:29+00:00"
"time": "2019-11-28T13:33:56+00:00"
},
{
"name": "twig/twig",
+3 -3
View File
@@ -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',
+3 -4
View File
@@ -222,9 +222,8 @@ Type::build('timestamp')
* Debug Kit should not be installed on a production system
*/
if (Configure::read('debug')) {
Plugin::load('DebugKit', ['bootstrap' => true]);
//Application::addPlugin('DebugKit', ['bootstrap' => true]);
//Plugin::load('DebugKit', ['bootstrap' => true]);
Application::addPlugin('DebugKit', ['bootstrap' => true]);
}
Configure::load('lbry','lbry.default');
Configure::load('lbry', 'default');
-47
View File
@@ -1,47 +0,0 @@
version: "3.5"
services:
#############
## Lbrycrd ##
#############
lbrycrd:
image: lbry/lbrycrd:v0.17.3.2-deprecatedrpc
restart: "no"
ports:
- "15201:29246"
- "15200:29245"
expose:
- "29246"
- "29245"
## host volumes for persistent data such as wallet private keys.
volumes:
- "./persist:/data"
environment:
- RUN_MODE=regtest
###########
## MySQL ##
###########
mysql:
image: mysql/mysql-server:5.7.27
restart: "no"
ports:
- "15500:3306"
environment:
- MYSQL_ALLOW_EMPTY_PASSWORD=true
- MYSQL_DATABASE=chainquery
- MYSQL_USER=lbry
- MYSQL_PASSWORD=lbry
- MYSQL_LOG_CONSOLE=true
################
## Chainquery ##
################
chainquery:
image: lbry/chainquery:v2.0.8
restart: "no"
ports:
- 6300:6300
depends_on:
- lbrycrd
- mysql
volumes:
- ./chainqueryconfig.toml:/etc/lbry/chainqueryconfig.toml
entrypoint: wait-for-it -t 0 lbrycrd:29245 -- wait-for-it -t 0 mysql:3306 -- start
+121 -31
View File
@@ -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');
@@ -154,8 +157,10 @@ class MainController extends AppController {
$endLimitId = $maxClaimId;
}
$blockedList = json_decode($this->_getBlockedList());
$claims = $this->Claims->find()->select($this->Claims)->
select(['publisher' => 'C.name'])->leftJoin(['C' => 'claim'], ['C.claim_id = Claims.publisher_id'])->
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();
@@ -173,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);
@@ -203,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;
@@ -220,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);
}
}
@@ -428,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;
@@ -638,7 +669,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');
@@ -661,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)));
@@ -679,7 +709,7 @@ class MainController extends AppController {
}
return (isset($txOutSetInfo->tosi)) ? $txOutSetInfo->tosi : 'N/A';
}
}*/
public function apistatus() {
$this->autoRender = false;
@@ -853,17 +883,27 @@ 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();
$reservedtotal = $this->Addresses->find()->select(['balance' => 'SUM(balance)'])->where(['Addresses.address IN' => $allAddresses])->first();
$circulating = $txoutsetinfo->total_amount - ($reservedtotal->balance);
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) {
@@ -912,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;
}
@@ -922,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);
@@ -957,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;
}
}
+12 -3
View File
@@ -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>
+2 -2
View File
@@ -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>
+11 -1
View File
@@ -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>
+3
View File
@@ -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% }
+2 -2
View File
@@ -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();
});
});
+2 -2
View File
@@ -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();
});
});