That... Could have gone better
This commit is contained in:
parent
605e204453
commit
c62df9d631
|
@ -24,6 +24,11 @@ class JSONCache {
|
|||
return false;
|
||||
}
|
||||
|
||||
public function exists(string $cache_key): bool {
|
||||
$filename = $this->cache_path . '/' . $cache_key . '.json';
|
||||
return is_file($filename);
|
||||
}
|
||||
|
||||
public function set(string $cache_key, mixed $data, $timeout = 3600) {
|
||||
file_put_contents($this->cache_path . '/' . $cache_key . '.json', json_encode([
|
||||
'data' => $data,
|
||||
|
|
|
@ -27,7 +27,11 @@ class RedisCache {
|
|||
return null;
|
||||
}
|
||||
|
||||
public function set(string $cache_key, array $data, $timeout = 3600) {
|
||||
$this->client->set($cache_key, json_encode($data), $timeout);
|
||||
public function exists(string $cache_key): bool {
|
||||
return $this->client->exists($cache_key);
|
||||
}
|
||||
|
||||
public function set(string $cache_key, string $data, $timeout = 3600) {
|
||||
$this->client->set($cache_key, $data, $timeout);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ class TagController {
|
|||
static public function get(string $name) {
|
||||
$cursor = Misc::getCursor();
|
||||
$api = Misc::api();
|
||||
$feed = $api->getChallengeFeed($name, $cursor);
|
||||
$feed = $api->getHashtagFeed($name, $cursor);
|
||||
if ($feed->meta->success) {
|
||||
$latte = Misc::latte();
|
||||
$latte->render(Misc::getView('tag'), new FeedTemplate('Tag', $feed));
|
||||
|
@ -21,9 +21,9 @@ class TagController {
|
|||
|
||||
static public function rss(string $name) {
|
||||
$api = Misc::api();
|
||||
$feed = $api->getChallengeFeed($name);
|
||||
$feed = $api->getHashtagFeed($name);
|
||||
if ($feed->meta->success) {
|
||||
$feed = RSS::build("/tag/{$name}", "{$name} Tag", $feed->info->detail->challenge->desc, $feed->items);
|
||||
$feed = RSS::build("/tag/{$name}", "{$name} Tag", $feed->info->detail->desc, $feed->items);
|
||||
// Setup headers
|
||||
RSS::setHeaders('tag.rss');
|
||||
echo $feed;
|
||||
|
|
|
@ -18,7 +18,7 @@ class UserController {
|
|||
exit;
|
||||
}
|
||||
$latte = Misc::latte();
|
||||
$latte->render(Misc::getView('user'), new FeedTemplate($feed->info->detail->user->nickname, $feed));
|
||||
$latte->render(Misc::getView('user'), new FeedTemplate($feed->info->detail->nickname, $feed));
|
||||
} else {
|
||||
ErrorHandler::show($feed->meta);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ class UserController {
|
|||
$api = Misc::api();
|
||||
$feed = $api->getUserFeed($username);
|
||||
if ($feed->meta->success) {
|
||||
$feed = RSS::build('/@'.$username, $feed->info->detail->user->nickname, $feed->info->detail->user->signature, $feed->items);
|
||||
$feed = RSS::build('/@'.$username, $feed->info->detail->nickname, $feed->info->detail->signature, $feed->items);
|
||||
// Setup headers
|
||||
RSS::setHeaders('user.rss');
|
||||
echo $feed;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "pablouser1/proxitok",
|
||||
"description": "An alternative frontend for TikTok",
|
||||
"version": "2.0.0.1",
|
||||
"version": "2.0.0.2",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"type": "project",
|
||||
"homepage": "https://github.com/pablouser1/ProxiTok",
|
||||
|
|
2
composer.lock
generated
2
composer.lock
generated
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "ee56c4949779c846be760de720c1eaf6",
|
||||
"content-hash": "2e80bafe776f5af404ce602d03f554b6",
|
||||
"packages": [
|
||||
{
|
||||
"name": "bramus/router",
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{layout '../layouts/default.latte'}
|
||||
|
||||
{block header}
|
||||
<p class="title">{$feed->info->detail->music->title}</p>
|
||||
<p class="subtitle">{$feed->info->detail->music->desc}</p>
|
||||
<p>Videos: {number($feed->info->detail->stats->videoCount)}</p>
|
||||
<p class="title">{$feed->info->detail->title}</p>
|
||||
<p class="subtitle">{$feed->info->detail->desc}</p>
|
||||
<p>Videos: {number($feed->info->stats->videoCount)}</p>
|
||||
{/block}
|
||||
|
||||
{block content}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{layout '../layouts/default.latte'}
|
||||
|
||||
{block header}
|
||||
<p class="title">{$feed->info->detail->challenge->title}</p>
|
||||
<p class="subtitle">{$feed->info->detail->challenge->desc}</p>
|
||||
<p>Videos: {number($feed->info->detail->stats->videoCount)} / Views: {number($feed->info->detail->stats->viewCount)}</p>
|
||||
<a href="{path('tag/' . $feed->info->detail->challenge->title . '/rss')}">RSS</a>
|
||||
<p class="title">{$feed->info->detail->title}</p>
|
||||
<p class="subtitle">{$feed->info->detail->desc}</p>
|
||||
<p>Videos: {number($feed->info->stats->videoCount)} / Views: {number($feed->info->stats->viewCount)}</p>
|
||||
<a href="{path('tag/' . $feed->info->detail->title . '/rss')}">RSS</a>
|
||||
{/block}
|
||||
|
||||
{block content}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
{block header}
|
||||
<p class="title">Trending</p>
|
||||
<a href="{path('trending/rss')}">RSS</a>
|
||||
<a href="{path('/trending/rss')}">RSS</a>
|
||||
{/block}
|
||||
|
||||
{block content}
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
{block header}
|
||||
<figure class="figure is-96x96">
|
||||
<img src="{path('/stream?url=' . urlencode($feed->info->detail->user->avatarThumb))}" />
|
||||
<img src="{path('/stream?url=' . urlencode($feed->info->detail->avatarThumb))}" />
|
||||
</figure>
|
||||
<p class="title">{$feed->info->detail->user->uniqueId}'s profile</p>
|
||||
<p class="subtitle">{$feed->info->detail->user->signature}</p>
|
||||
<p>Following: {number($feed->info->detail->stats->followingCount)} / Followers: {number($feed->info->detail->stats->followerCount)}</p>
|
||||
<p>Hearts: {number($feed->info->detail->stats->heartCount)} / Videos: {$feed->info->detail->stats->videoCount}</p>
|
||||
<a href="{path('/@' . $feed->info->detail->user->uniqueId . '/rss')}">RSS</a>
|
||||
<p class="title">{$feed->info->detail->uniqueId}'s profile</p>
|
||||
<p class="subtitle">{$feed->info->detail->signature}</p>
|
||||
<p>Following: {number($feed->info->stats->followingCount)} / Followers: {number($feed->info->stats->followerCount)}</p>
|
||||
<p>Hearts: {number($feed->info->stats->heartCount)} / Videos: {$feed->info->stats->videoCount}</p>
|
||||
<a href="{path('/@' . $feed->info->detail->uniqueId . '/rss')}">RSS</a>
|
||||
{/block}
|
||||
|
||||
{block content}
|
||||
|
|
|
@ -4,18 +4,12 @@
|
|||
{do $item = $feed->items[0]}
|
||||
<div class="columns is-centered is-vcentered">
|
||||
<div class="column">
|
||||
<<<<<<< HEAD
|
||||
<video controls poster="{path('/stream?url=' . urlencode($item->video->originCover))}">
|
||||
<source src="{path('/stream?url=' . urlencode($item->video->playAddr))}" type="video/mp4" />
|
||||
=======
|
||||
<video controls poster="{path('/stream?url=' . urlencode($item->items[0]->video->originCover))}">
|
||||
<source src="{path('/stream?url=' . urlencode($item->items[0]->video->playAddr))}" type="video/mp4" />
|
||||
>>>>>>> master
|
||||
</video>
|
||||
</div>
|
||||
<div class="column has-text-centered">
|
||||
<div class="box">
|
||||
<<<<<<< HEAD
|
||||
<p class="title">Video by <a href="{path('/@'.$feed->info->detail->uniqueId)}">{$feed->info->detail->uniqueId}</a></p>
|
||||
<p class="subtitle">{$item->desc}</p>
|
||||
<p>Played {number($feed->info->stats->playCount)} times</p>
|
||||
|
@ -34,16 +28,6 @@
|
|||
</div>
|
||||
<p>{$item->music->title}</p>
|
||||
<audio src="{path('/stream?url=' . urlencode($item->music->playUrl))}" controls preload="none"></audio>
|
||||
=======
|
||||
<p class="title">Video by <a href="{path('/@'.$item->info->detail->user->uniqueId)}">{$item->info->detail->user->uniqueId}</a></p>
|
||||
<p class="subtitle">{$item->items[0]->desc}</p>
|
||||
<p>Played {number($item->info->detail->stats->playCount)} times</p>
|
||||
<p>Shared {number($item->info->detail->stats->shareCount)} times / {number($item->info->detail->stats->commentCount)} comments</p>
|
||||
<hr />
|
||||
<a href="{path('/stream?url=' . urlencode($item->items[0]->video->playAddr) . '&download=1')}" class="button is-info">Download video</a>
|
||||
<p>{$item->items[0]->music->title}</p>
|
||||
<audio src="{path('/stream?url=' . urlencode($item->items[0]->music->playUrl))}" controls preload="none"></audio>
|
||||
>>>>>>> master
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue