From d9ff794932d46803ad221c3d0498a70270b259c8 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 4 Dec 2019 20:24:27 -0700 Subject: [PATCH] Update SiteController --- app/Http/Controllers/SiteController.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/app/Http/Controllers/SiteController.php b/app/Http/Controllers/SiteController.php index 68d92fc3..93b4b1e5 100644 --- a/app/Http/Controllers/SiteController.php +++ b/app/Http/Controllers/SiteController.php @@ -7,6 +7,7 @@ use App, Auth, Cache, View; use App\Util\Lexer\PrettyNumber; use App\{Follower, Page, Profile, Status, User, UserFilter}; use App\Util\Localization\Localization; +use App\Services\FollowerService; class SiteController extends Controller { @@ -98,4 +99,24 @@ class SiteController extends Controller }); return View::make('site.terms')->with(compact('page'))->render(); } + + public function redirectUrl(Request $request) + { + $this->validate($request, [ + 'url' => 'required|url' + ]); + $url = urldecode(request()->input('url')); + return view('site.redirect', compact('url')); + } + + public function followIntent(Request $request) + { + $this->validate($request, [ + 'user' => 'string|min:1|max:15|exists:users,username', + ]); + $profile = Profile::whereUsername($request->input('user'))->firstOrFail(); + $user = $request->user(); + $following = $user != null ? FollowerService::follows($user->profile_id, $profile->id) : false; + return view('site.intents.follow', compact('profile', 'user', 'following')); + } }