|
|
|
@ -76,38 +76,55 @@ class RoomController extends AbstractController
@@ -76,38 +76,55 @@ class RoomController extends AbstractController
|
|
|
|
|
// Get room feed |
|
|
|
|
$feed = []; |
|
|
|
|
|
|
|
|
|
foreach ((array) $client->kevaFilter($request->get('namespace')) as $post) |
|
|
|
|
// Get pending paradise |
|
|
|
|
foreach ((array) $client->kevaPending() as $pending) |
|
|
|
|
{ |
|
|
|
|
// Skip values with meta keys |
|
|
|
|
if (false !== stripos($post['key'], '_KEVA_')) |
|
|
|
|
// Ignore pending posts from other rooms |
|
|
|
|
if ($pending['namespace'] !== $request->get('namespace')) |
|
|
|
|
{ |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Set identicon if not anonymous user |
|
|
|
|
if ($post['key'] === '@anonymous') |
|
|
|
|
// Ignore everything in pending queue but keva_put nodes |
|
|
|
|
if ($pending['op'] !== 'keva_put') |
|
|
|
|
{ |
|
|
|
|
$icon = false; |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
else |
|
|
|
|
// Skip values with meta keys |
|
|
|
|
if (false !== stripos($pending['key'], '_KEVA_')) |
|
|
|
|
{ |
|
|
|
|
$identicon = new \Jdenticon\Identicon(); |
|
|
|
|
|
|
|
|
|
$identicon->setValue( |
|
|
|
|
$post['key'] |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$identicon->setSize(12); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$identicon->setStyle( |
|
|
|
|
// Get more info |
|
|
|
|
if ($transaction = $client->getRawTransaction($pending['txid'])) |
|
|
|
|
{ |
|
|
|
|
$feed[] = |
|
|
|
|
[ |
|
|
|
|
'pending' => true, |
|
|
|
|
'key' => $pending['key'], |
|
|
|
|
'value' => $pending['value'], |
|
|
|
|
'txid' => $pending['txid'], |
|
|
|
|
'transaction' => |
|
|
|
|
[ |
|
|
|
|
'backgroundColor' => 'rgba(255, 255, 255, 0)', |
|
|
|
|
'padding' => 0 |
|
|
|
|
] |
|
|
|
|
); |
|
|
|
|
'time' => date('c', $transaction['time']), |
|
|
|
|
'timestamp' => $transaction['time'], |
|
|
|
|
'confirmations' => $transaction['confirmations'], |
|
|
|
|
], |
|
|
|
|
'icon' => $this->_identicon($pending['key']), |
|
|
|
|
'sort' => 0//$transaction['time'] // sort order field |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$icon = $identicon->getImageDataUri('webp'); |
|
|
|
|
// Get regular posts |
|
|
|
|
foreach ((array) $client->kevaFilter($request->get('namespace')) as $post) |
|
|
|
|
{ |
|
|
|
|
// Skip values with meta keys |
|
|
|
|
if (false !== stripos($post['key'], '_KEVA_')) |
|
|
|
|
{ |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Get more info |
|
|
|
@ -115,18 +132,19 @@ class RoomController extends AbstractController
@@ -115,18 +132,19 @@ class RoomController extends AbstractController
|
|
|
|
|
{ |
|
|
|
|
$feed[] = |
|
|
|
|
[ |
|
|
|
|
# 'key' => $post['key'], |
|
|
|
|
'value' => $post['value'], |
|
|
|
|
'height' => $post['height'], |
|
|
|
|
# 'vout' => $post['vout'], |
|
|
|
|
'txid' => $post['txid'], |
|
|
|
|
'pending' => false, |
|
|
|
|
'key' => $post['key'], |
|
|
|
|
'value' => $post['value'], |
|
|
|
|
'height' => $post['height'], |
|
|
|
|
# 'vout' => $post['vout'], |
|
|
|
|
'txid' => $post['txid'], |
|
|
|
|
'transaction' => |
|
|
|
|
[ |
|
|
|
|
'time' => date('c', $transaction['time']), |
|
|
|
|
'timestamp' => $transaction['time'], |
|
|
|
|
'confirmations' => $transaction['confirmations'], |
|
|
|
|
], |
|
|
|
|
'icon' => $icon, |
|
|
|
|
'icon' => $this->_identicon($post['key']), |
|
|
|
|
'sort' => $transaction['time'] // sort order field |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
@ -371,4 +389,30 @@ class RoomController extends AbstractController
@@ -371,4 +389,30 @@ class RoomController extends AbstractController
|
|
|
|
|
] |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private function _identicon(string $key) |
|
|
|
|
{ |
|
|
|
|
if ($key === 'anonymous') |
|
|
|
|
{ |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
$identicon = new \Jdenticon\Identicon(); |
|
|
|
|
|
|
|
|
|
$identicon->setValue($key); |
|
|
|
|
|
|
|
|
|
$identicon->setSize(12); |
|
|
|
|
|
|
|
|
|
$identicon->setStyle( |
|
|
|
|
[ |
|
|
|
|
'backgroundColor' => 'rgba(255, 255, 255, 0)', |
|
|
|
|
'padding' => 0 |
|
|
|
|
] |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
return $identicon->getImageDataUri('webp'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |