don't show blocked claims in the result grid
This commit is contained in:
parent
15e4af521b
commit
076dfd0597
4 changed files with 665 additions and 462 deletions
1055
composer.lock
generated
1055
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -156,8 +156,10 @@ class MainController extends AppController {
|
||||||
$endLimitId = $maxClaimId;
|
$endLimitId = $maxClaimId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$blockedList = json_decode(self::curl_get(self::blockedListUrl));
|
||||||
$claims = $this->Claims->find()->select($this->Claims)->
|
$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])->
|
where(['Claims.id >' => $startLimitId, 'Claims.id <=' => $endLimitId])->
|
||||||
order(['Claims.id' => 'DESC'])->toArray();
|
order(['Claims.id' => 'DESC'])->toArray();
|
||||||
|
|
||||||
|
@ -175,6 +177,17 @@ class MainController extends AppController {
|
||||||
$claims[$i]->LicenseUrl = $json->metadata->licenseUrl;
|
$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);
|
$this->set('pageLimit', $pageLimit);
|
||||||
|
@ -225,24 +238,8 @@ class MainController extends AppController {
|
||||||
|
|
||||||
// fetch blocked list
|
// fetch blocked list
|
||||||
$blockedList = json_decode(self::curl_get(self::blockedListUrl));
|
$blockedList = json_decode(self::curl_get(self::blockedListUrl));
|
||||||
$blockedOutpoints = $blockedList->data->outpoints;
|
$claimChannel = $this->Claims->find()->select(['transaction_hash_id', 'vout'])->where(['claim_id' => $claim->publisher_id])->first();
|
||||||
$claimIsBlocked = false;
|
$claimIsBlocked = $this->_isClaimBlocked($claim, $claimChannel, $blockedList);
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if the publisher (channel) is blocked
|
|
||||||
// block the channel if that's the case
|
|
||||||
if (isset($claim->publisher) &&
|
|
||||||
$claim->publisher->transaction_hash_id == $parts[0] &&
|
|
||||||
$claim->publisher->vout == $parts[1]) {
|
|
||||||
$claimIsBlocked = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->set('claim', $claim);
|
$this->set('claim', $claim);
|
||||||
$this->set('claimIsBlocked', $claimIsBlocked);
|
$this->set('claimIsBlocked', $claimIsBlocked);
|
||||||
|
@ -982,4 +979,25 @@ class MainController extends AppController {
|
||||||
// Close any open file handle
|
// Close any open file handle
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function _isClaimBlocked($claim, $claimChannel, $blockedList) {
|
||||||
|
$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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $claimIsBlocked;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,14 @@ $ctTag = $claim->getContentTag();
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</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="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="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>
|
<div class="link" title="<?php echo $claim->getLbryLink() ?>"><a href="<?php echo $claim->getLbryLink() ?>" rel="nofollow"><?php echo $claim->getLbryLink() ?></a></div>
|
||||||
|
@ -73,4 +81,5 @@ $ctTag = $claim->getContentTag();
|
||||||
-->
|
-->
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
</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 .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 .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 .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 .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 .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 }
|
.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 }
|
||||||
|
|
Loading…
Reference in a new issue