Browse Source

Cleanup and such

imwald
Nuša Pukšič 3 months ago
parent
commit
58f701893e
  1. 4
      src/Controller/ArticleController.php
  2. 3
      src/Controller/DefaultController.php
  3. 11
      templates/event/index.html.twig
  4. 14
      templates/pages/latest-articles.html.twig

4
src/Controller/ArticleController.php

@ -97,10 +97,10 @@ class ArticleController extends AbstractController
$cacheKey = 'article_' . $article->getEventId(); $cacheKey = 'article_' . $article->getEventId();
$cacheItem = $articlesCache->getItem($cacheKey); $cacheItem = $articlesCache->getItem($cacheKey);
//if (!$cacheItem->isHit()) { if (!$cacheItem->isHit()) {
$cacheItem->set($converter->convertToHTML($article->getContent())); $cacheItem->set($converter->convertToHTML($article->getContent()));
$articlesCache->save($cacheItem); $articlesCache->save($cacheItem);
//} }
$key = new Key(); $key = new Key();
$npub = $key->convertPublicKeyToBech32($article->getPubkey()); $npub = $key->convertPublicKeyToBech32($article->getPubkey());

3
src/Controller/DefaultController.php

@ -60,10 +60,10 @@ class DefaultController extends AbstractController
$key = new Key(); $key = new Key();
$excludedPubkeys = [ $excludedPubkeys = [
$key->convertToHex('npub10akm29ejpdns52ca082skmc3hr75wmv3ajv4987c9lgyrfynrmdqduqwlx'), // Discreet Log (News Bot)
$key->convertToHex('npub1etsrcjz24fqewg4zmjze7t5q8c6rcwde5zdtdt4v3t3dz2navecscjjz94'), // Bitcoin Magazine (News Bot) $key->convertToHex('npub1etsrcjz24fqewg4zmjze7t5q8c6rcwde5zdtdt4v3t3dz2navecscjjz94'), // Bitcoin Magazine (News Bot)
$key->convertToHex('npub1m7szwpud3jh2k3cqe73v0fd769uzsj6rzmddh4dw67y92sw22r3sk5m3ys'), // No Bullshit Bitcoin (News Bot) $key->convertToHex('npub1m7szwpud3jh2k3cqe73v0fd769uzsj6rzmddh4dw67y92sw22r3sk5m3ys'), // No Bullshit Bitcoin (News Bot)
$key->convertToHex('npub13wke9s6njrmugzpg6mqtvy2d49g4d6t390ng76dhxxgs9jn3f2jsmq82pk'), // TFTC (News Bot) $key->convertToHex('npub13wke9s6njrmugzpg6mqtvy2d49g4d6t390ng76dhxxgs9jn3f2jsmq82pk'), // TFTC (News Bot)
$key->convertToHex('npub10akm29ejpdns52ca082skmc3hr75wmv3ajv4987c9lgyrfynrmdqduqwlx'), // Discreet Log (News Bot)
$key->convertToHex('npub13uvnw9qehqkds68ds76c4nfcn3y99c2rl9z8tr0p34v7ntzsmmzspwhh99'), // Batcoinz (Just annoying) $key->convertToHex('npub13uvnw9qehqkds68ds76c4nfcn3y99c2rl9z8tr0p34v7ntzsmmzspwhh99'), // Batcoinz (Just annoying)
$key->convertToHex('npub1fls5au5fxj6qj0t36sage857cs4tgfpla0ll8prshlhstagejtkqc9s2yl'), // AGORA Marketplace - feed 𝚋𝚘𝚝 (Just annoying) $key->convertToHex('npub1fls5au5fxj6qj0t36sage857cs4tgfpla0ll8prshlhstagejtkqc9s2yl'), // AGORA Marketplace - feed 𝚋𝚘𝚝 (Just annoying)
]; ];
@ -92,6 +92,7 @@ class DefaultController extends AbstractController
return $this->render('pages/latest-articles.html.twig', [ return $this->render('pages/latest-articles.html.twig', [
'articles' => $cacheItem->get(), 'articles' => $cacheItem->get(),
'newsBots' => array_slice($excludedPubkeys, 0, 4)
]); ]);
} }

11
templates/event/index.html.twig

@ -115,9 +115,9 @@
</div> </div>
</article> </article>
<pre> <div class="notice mt-4">
{{ event|json_encode(constant('JSON_PRETTY_PRINT')) }} <p>This is a work in progress. If your event didn't render right, we apologize. Working on it!</p>
</pre> </div>
<div class="container"> <div class="container">
{% if nostrLinks is defined and nostrLinks|length > 0 %} {% if nostrLinks is defined and nostrLinks|length > 0 %}
@ -153,6 +153,11 @@
{% endif %} {% endif %}
{% if is_granted('ROLE_ADMIN') %} {% if is_granted('ROLE_ADMIN') %}
<h2>Raw Event Data</h2>
<pre>
{{ event|json_encode(constant('JSON_PRETTY_PRINT')) }}
</pre>
<div class="event-tags"> <div class="event-tags">
{% if event.tags is defined and event.tags|length > 0 %} {% if event.tags is defined and event.tags|length > 0 %}
<ul> <ul>

14
templates/pages/latest-articles.html.twig

@ -19,3 +19,17 @@
</section> </section>
{% endblock %} {% endblock %}
{% block aside %}
<div class="d-flex gap-3 center mt-3 mb-3 ln-section--reader">
<h2>News Bots</h2>
<p class="eyebrow">Automated news curators</p>
</div>
{# Use list of pubkeys in newsBots to show cards for newsbots #}
{% for bot in newsBots %}
<div class="card mt-3">
<div class="card-body text-center">
<twig:Molecules:UserFromNpub :ident="bot" />
</div>
</div>
{% endfor %}
{% endblock %}

Loading…
Cancel
Save