diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 3423565..ced6587 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -199,7 +199,7 @@
1684327639044
-
+
diff --git a/src/Controller/DefaultController.php b/src/Controller/DefaultController.php
index 14852e5..eb04f50 100644
--- a/src/Controller/DefaultController.php
+++ b/src/Controller/DefaultController.php
@@ -8,29 +8,34 @@ use Symfony\Component\Routing\Annotation\Route;
class DefaultController extends AbstractController
{
+
#[Route('/default', name: 'app_default')]
public function index(): Response
{
// TODO merge all these post list and deduplicate them
- $url = "https://mastodon.cipherbliss.com/api/v1/timelines/public?remote=false&allow_local_only=true&only_media=true";
- $url = "https://mastodon.cipherbliss.com/api/v1/timelines/tag/art";
- $url = "https://mastodon.cipherbliss.com/api/v1/timelines/tag/mastoart";
+// $url = "https://mastodon.cipherbliss.com/api/v1/timelines/public?remote=false&allow_local_only=true&only_media=true";
- $client = new \GuzzleHttp\Client();
-$response = $client->request('GET', $url );
-
-//echo $response->getStatusCode(); // 200
-// $response->getHeaderLine('content-type'); // 'application/json; charset=utf8'
-$body = $response->getBody();
-
-// $content = file_get_contents();
-//
- $decoded = json_decode($body->getContents());
+ $art = $this->getTagToots('art');
+ $mastoart = $this->getTagToots('mastoart');
+ $krita = $this->getTagToots('krita');
return $this->render('default/index.html.twig', [
'controller_name' => 'DefaultController',
- 'data' => $decoded,
+ 'data' => array_merge($krita, $art, $mastoart),
]);
}
+
+ public function getTagToots($tagName)
+ {
+ $url = "https://mastodon.cipherbliss.com/api/v1/timelines/tag/$tagName";
+
+
+ $client = new \GuzzleHttp\Client();
+
+ $response = $client->request('GET', $url);
+ $body = $response->getBody();
+
+ return json_decode($body->getContents());
+ }
}
diff --git a/templates/default/index.html.twig b/templates/default/index.html.twig
index 17861ca..5a0b3b9 100644
--- a/templates/default/index.html.twig
+++ b/templates/default/index.html.twig
@@ -4,6 +4,9 @@
{% block body %}