add several tags pictures

This commit is contained in:
Tykayn 2023-05-19 22:42:32 +02:00 committed by tykayn
parent 0315defb21
commit 788a9eaf48
3 changed files with 23 additions and 17 deletions

View File

@ -199,7 +199,7 @@
<option name="number" value="Default" /> <option name="number" value="Default" />
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1684327639044</updated> <updated>1684327639044</updated>
<workItem from="1684327640262" duration="8472000" /> <workItem from="1684327640262" duration="9102000" />
</task> </task>
<servers /> <servers />
</component> </component>

View File

@ -8,29 +8,34 @@ use Symfony\Component\Routing\Annotation\Route;
class DefaultController extends AbstractController class DefaultController extends AbstractController
{ {
#[Route('/default', name: 'app_default')] #[Route('/default', name: 'app_default')]
public function index(): Response public function index(): Response
{ {
// TODO merge all these post list and deduplicate them // 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/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";
$client = new \GuzzleHttp\Client(); $art = $this->getTagToots('art');
$response = $client->request('GET', $url ); $mastoart = $this->getTagToots('mastoart');
$krita = $this->getTagToots('krita');
//echo $response->getStatusCode(); // 200
// $response->getHeaderLine('content-type'); // 'application/json; charset=utf8'
$body = $response->getBody();
// $content = file_get_contents();
//
$decoded = json_decode($body->getContents());
return $this->render('default/index.html.twig', [ return $this->render('default/index.html.twig', [
'controller_name' => 'DefaultController', '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());
}
} }

View File

@ -4,6 +4,9 @@
{% block body %} {% block body %}
<style> <style>
body{
background: #313543;
}
.example-wrapper { .example-wrapper {
margin: 1em auto; margin: 1em auto;
max-width: 1600px; max-width: 1600px;
@ -71,8 +74,6 @@
</fieldset> </fieldset>
{# <h2>debug</h2>#}
{# {{ dump(data) }}#}
</div> </div>
<style> <style>
img { img {