Files
ProxiTok/app/Controllers/ForYouController.php
T
Pablo Ferreiro ec611478e3
Docker / build (push) Has been cancelled
Create Tag / build (push) Has been cancelled
implemented following (AKA discover) & fyp using new endpoints
2024-08-28 14:34:02 +02:00

34 lines
893 B
PHP

<?php
namespace App\Controllers;
use App\Helpers\ErrorHandler;
use App\Helpers\Misc;
use App\Helpers\Wrappers;
use App\Models\FeedTemplate;
use App\Models\RSSTemplate;
class ForYouController {
public static function get() {
$api = Wrappers::api();
$fyp = $api->foryou();
$fyp->feed();
if ($fyp->ok()) {
$feed = $fyp->getFeed();
Wrappers::latte('foryou', new FeedTemplate('For you', $feed));
} else {
ErrorHandler::showMeta($fyp->error());
}
}
public static function rss() {
$api = Wrappers::api();
$fyp = $api->foryou();
$fyp->feed();
if ($fyp->ok()) {
$feed = $fyp->getFeed();
Misc::rss('For you');
Wrappers::latte('rss', new RSSTemplate('For you', 'For you Page', '', Misc::url('/foryou'), $feed->items));
}
}
}