Removed home.js

Added Discover
This commit is contained in:
Pablo Ferreiro 2022-02-06 00:58:30 +01:00
parent df052dab36
commit 8816f4a1a1
No known key found for this signature in database
GPG key ID: 41FBCE65B779FA24
25 changed files with 213 additions and 145 deletions

View file

@ -0,0 +1,19 @@
<?php
namespace App\Controllers;
use App\Helpers\ErrorHandler;
use App\Helpers\Misc;
use App\Models\FeedTemplate;
class DiscoverController {
static public function get() {
$api = Misc::api();
$feed = $api->getDiscover();
if ($feed->meta->success) {
$latte = Misc::latte();
$latte->render(Misc::getView('discover'), new FeedTemplate('Discover', $feed));
} else {
ErrorHandler::show($feed->meta);
}
}
}

View file

@ -0,0 +1,24 @@
<?php
namespace App\Controllers;
use App\Helpers\Misc;
/**
* Used to be compatible with HTML forms
*/
class RedirectController {
static public function redirect() {
$endpoint = '';
if (isset($_GET['user'])) {
$endpoint = '/@' . $_GET['user'];
} else if (isset($_GET['tag'])) {
$endpoint = '/tag/' . $_GET['tag'];
} else if (isset($_GET['music'])) {
$endpoint = '/music/' . $_GET['music'];
} else if (isset($_GET['video'])) {
$endpoint = '/video/' . $_GET['video'];
}
$url = Misc::url($endpoint);
header("Location: {$url}");
}
}

View file

@ -18,8 +18,7 @@ class SettingsController {
Cookies::set($proxy_element, $_POST[$proxy_element]);
}
}
http_response_code(302);
$url = Misc::env('APP_URL', '');
$url = Misc::url('/settings');
header("Location: {$url}");
}
@ -49,6 +48,7 @@ class SettingsController {
// Build string
$following_string = implode(',', $following);
Cookies::set('following', $following_string);
header('Location: ../settings');
$url = Misc::url('/settings');
header("Location: {$url}");
}
}