Blocked claims #81

Merged
akinwale merged 8 commits from blocked-claims into master 2020-01-07 23:13:39 +01:00
3 changed files with 31 additions and 2 deletions
Showing only changes of commit 8c6c576a31 - Show all commits

View file

@ -30,6 +30,8 @@ class MainController extends AppController {
const tagReceiptAddress = 'bLockNgmfvnnnZw7bM6SPz6hk5BVzhevEp'; const tagReceiptAddress = 'bLockNgmfvnnnZw7bM6SPz6hk5BVzhevEp';
const blockedListUrl = 'https://api.lbry.com/file/list_blocked';
protected $redis; protected $redis;
public function initialize() { public function initialize() {
@ -220,8 +222,23 @@ class MainController extends AppController {
} }
} }
} }
// fetch blocked list
$blockedList = json_decode(self::curl_get(self::blockedListUrl));
$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;
}
}
$this->set('claim', $claim); $this->set('claim', $claim);
$this->set('moreClaims', $moreClaims); $this->set('claimIsBlocked', $claimIsBlocked);
$this->set('moreClaims', $claimIsBlocked ? [] : $moreClaims);
} }
} }

View file

@ -65,6 +65,15 @@ if (strlen(trim($desc)) == 0) {
</div> </div>
<div class="claims-body"> <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 class="claim-info">
<div data-autothumb="<?php echo $autoThumbText ?>" class="thumbnail <?php echo $a[mt_rand(0, count($a) - 1)] ?>"> <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): ?> <?php if (!$claim->is_nsfw && strlen(trim($claim->thumbnail_url)) > 0): ?>
@ -140,6 +149,7 @@ if (strlen(trim($desc)) == 0) {
<div class="clear"></div> <div class="clear"></div>
<?php endif; ?>
<?php if (count($moreClaims) > 0): ?> <?php if (count($moreClaims) > 0): ?>

View file

@ -95,6 +95,8 @@ border-radius: 0 8px 8px 0 }
.claims-grid .claim-grid-item .spacer { height: 16px } .claims-grid .claim-grid-item .spacer { height: 16px }
.claims-body { width: 1200px; margin: 0 auto 0 auto; cursor: default } .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 { 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 { width: 100%; height: 220px; background: #f0f0f0; display: block; position: relative; overflow: hidden }
.claims-body .claim-info .thumbnail img { width: 100% } .claims-body .claim-info .thumbnail img { width: 100% }