-
-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implemented following (AKA discover) & fyp using new endpoints
- Loading branch information
1 parent
96aa280
commit ec61147
Showing
7 changed files
with
132 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
namespace App\Controllers; | ||
|
||
use App\Helpers\ErrorHandler; | ||
use App\Helpers\Misc; | ||
use App\Helpers\Wrappers; | ||
use App\Models\FeedTemplate; | ||
|
||
class FollowingController { | ||
public static function get() { | ||
$cursor = Misc::getCursor(); | ||
|
||
$api = Wrappers::api(); | ||
$following = $api->following(); | ||
$following->feed($cursor); | ||
if ($following->ok()) { | ||
$feed = $following->getFeed(); | ||
Wrappers::latte('following', new FeedTemplate('Following / Discover', $feed)); | ||
} else { | ||
ErrorHandler::showMeta($following->error()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?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)); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{layout '../layouts/default.latte'} | ||
|
||
{block header} | ||
<p class="title">Discover</p> | ||
{/block} | ||
|
||
{block content} | ||
<div class="columns is-multiline is-vcentered"> | ||
{foreach $feed->items as $item} | ||
<div class="column is-one-quarter"> | ||
{embed '../components/card.latte'} | ||
{block content} | ||
<div class="media"> | ||
<!-- Show image if exists --> | ||
{if !empty($item->info->detail->avatarLarger)} | ||
<div class="media-left"> | ||
<figure class="image is-96x96"> | ||
<img loading="lazy" width="96" height="96" src="{url_stream($item->info->detail->avatarLarger)}" /> | ||
</figure> | ||
</div> | ||
{/if} | ||
<div class="media-content"> | ||
<p class="title">{$item->info->detail->nickname}</p> | ||
<p class="subtitle">{$item->info->detail->uniqueId}</p> | ||
</div> | ||
</div> | ||
<div class="content"> | ||
<p>{$item->info->detail->signature}</p> | ||
</div> | ||
{/block} | ||
{block footer} | ||
<a href="{url_user($item->info->detail->uniqueId)}" class="card-footer-item">Go</a> | ||
{/block} | ||
{/embed} | ||
</div> | ||
{/foreach} | ||
</div> | ||
{include '../components/themes/common/controls.latte', feed: $feed} | ||
{/block} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{layout '../layouts/default.latte'} | ||
|
||
{var $has_rss = true} | ||
|
||
{block header} | ||
<p class="title">For you</p> | ||
<p class="subtitle">{include '../components/rss.latte'}</p> | ||
{/block} | ||
|
||
{block content} | ||
{include '../components/feed.latte'} | ||
{/block} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters