mirror of
https://github.com/kevachat/webapp.git
synced 2025-01-22 20:44:59 +00:00
implement identicons
This commit is contained in:
parent
8f93a54eac
commit
96faf9464d
@ -7,6 +7,7 @@
|
|||||||
"php": ">=8.2",
|
"php": ">=8.2",
|
||||||
"ext-ctype": "*",
|
"ext-ctype": "*",
|
||||||
"ext-iconv": "*",
|
"ext-iconv": "*",
|
||||||
|
"jdenticon/jdenticon": "^1.0",
|
||||||
"kevachat/kevacoin": "^1.0",
|
"kevachat/kevacoin": "^1.0",
|
||||||
"symfony/console": "7.0.*",
|
"symfony/console": "7.0.*",
|
||||||
"symfony/dotenv": "7.0.*",
|
"symfony/dotenv": "7.0.*",
|
||||||
|
@ -58,6 +58,32 @@ class RoomController extends AbstractController
|
|||||||
|
|
||||||
foreach ((array) $client->kevaFilter($request->get('namespace')) as $post)
|
foreach ((array) $client->kevaFilter($request->get('namespace')) as $post)
|
||||||
{
|
{
|
||||||
|
// Set identicon if not anonymous user
|
||||||
|
if ($post['key'] === 'anonymous')
|
||||||
|
{
|
||||||
|
$icon = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$identicon = new \Jdenticon\Identicon();
|
||||||
|
|
||||||
|
$identicon->setValue(
|
||||||
|
$post['key']
|
||||||
|
);
|
||||||
|
|
||||||
|
$identicon->setSize(12);
|
||||||
|
|
||||||
|
$identicon->setStyle(
|
||||||
|
[
|
||||||
|
'backgroundColor' => 'rgba(255, 255, 255, 0)',
|
||||||
|
'padding' => 0
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$icon = $identicon->getImageDataUri('webp');
|
||||||
|
}
|
||||||
|
|
||||||
// Skip values with meta keys
|
// Skip values with meta keys
|
||||||
if (false !== stripos($post['key'], '_KEVA_'))
|
if (false !== stripos($post['key'], '_KEVA_'))
|
||||||
{
|
{
|
||||||
@ -69,7 +95,7 @@ class RoomController extends AbstractController
|
|||||||
{
|
{
|
||||||
$feed[] =
|
$feed[] =
|
||||||
[
|
[
|
||||||
'key' => $post['key'],
|
# 'key' => $post['key'],
|
||||||
'value' => $post['value'],
|
'value' => $post['value'],
|
||||||
'height' => $post['height'],
|
'height' => $post['height'],
|
||||||
# 'vout' => $post['vout'],
|
# 'vout' => $post['vout'],
|
||||||
@ -80,7 +106,8 @@ class RoomController extends AbstractController
|
|||||||
'timestamp' => $transaction['time'],
|
'timestamp' => $transaction['time'],
|
||||||
'confirmations' => $transaction['confirmations'],
|
'confirmations' => $transaction['confirmations'],
|
||||||
],
|
],
|
||||||
'sort' => $transaction['time'] // sort order field
|
'icon' => $icon,
|
||||||
|
'sort' => $transaction['time'] // sort order field
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,13 @@
|
|||||||
{% for post in feed %}
|
{% for post in feed %}
|
||||||
<li>
|
<li>
|
||||||
<a name="{{ post.txid }}"></a>
|
<a name="{{ post.txid }}"></a>
|
||||||
<strong>
|
{% if post.icon %}
|
||||||
@{{ post.key }}
|
<img src="{{ post.icon }}" alt="icon" />
|
||||||
</strong>
|
{% else %}
|
||||||
|
<strong>
|
||||||
|
@{{ 'anonymous' | trans }}
|
||||||
|
</strong>
|
||||||
|
{% endif %}
|
||||||
<a href="#{{ post.txid }}" title="{{ 'time:' | trans }} {{ post.transaction.time }} / {{ 'block:' | trans }} {{ post.height }}{# / {{ 'confirmations:' | trans }} {{ post.transaction.confirmations }}#}">
|
<a href="#{{ post.txid }}" title="{{ 'time:' | trans }} {{ post.transaction.time }} / {{ 'block:' | trans }} {{ post.height }}{# / {{ 'confirmations:' | trans }} {{ post.transaction.confirmations }}#}">
|
||||||
{{ post.transaction.timestamp | format_ago }}
|
{{ post.transaction.timestamp | format_ago }}
|
||||||
</a>
|
</a>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user