diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 59fc4f45..7e66211d 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -5,6 +5,7 @@ namespace App\Http\Controllers; use Illuminate\Http\Request; use Auth; use Cache; +use View; use App\Follower; use App\FollowRequest; use App\Profile; @@ -189,4 +190,29 @@ class ProfileController extends Controller abort_if(!Auth::check(), 404); return redirect(Auth::user()->url()); } + + public function embed(Request $request, $username) + { + $res = view('profile.embed-removed'); + + if(strlen($username) > 15 || strlen($username) < 2) { + return response($res)->withHeaders(['X-Frame-Options' => 'ALLOWALL']); + } + + $profile = Profile::whereUsername($username) + ->whereIsPrivate(false) + ->whereNull('status') + ->whereNull('domain') + ->first(); + + if(!$profile) { + return response($res)->withHeaders(['X-Frame-Options' => 'ALLOWALL']); + } + + $content = Cache::remember('profile:embed:'.$profile->id, now()->addHours(12), function() use($profile) { + return View::make('profile.embed')->with(compact('profile'))->render(); + }); + + return response($content)->withHeaders(['X-Frame-Options' => 'ALLOWALL']); + } } diff --git a/resources/views/profile/embed-removed.blade.php b/resources/views/profile/embed-removed.blade.php new file mode 100644 index 00000000..5cb28218 --- /dev/null +++ b/resources/views/profile/embed-removed.blade.php @@ -0,0 +1,46 @@ + + +
+ + + + + + +