Update profile embeds, fix NaN bug and improve performance

This commit is contained in:
Daniel Supernault 2022-01-23 01:47:31 -07:00
parent 803bbac0ea
commit 3bd211d7f5
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
2 changed files with 41 additions and 28 deletions

View file

@ -13,6 +13,7 @@ use App\Story;
use App\User;
use App\UserFilter;
use League\Fractal;
use App\Services\AccountService;
use App\Services\FollowerService;
use App\Util\Lexer\Nickname;
use App\Util\Webfinger\Webfinger;
@ -55,7 +56,6 @@ class ProfileController extends Controller
$owner = false;
$is_following = false;
$is_admin = $user->user->is_admin;
$profile = $user;
$settings = [
'crawlable' => $settings->crawlable,
@ -227,11 +227,12 @@ class ProfileController extends Controller
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();
});
if(AccountService::canEmbed($profile->user_id) == false) {
return response($res)->withHeaders(['X-Frame-Options' => 'ALLOWALL']);
}
return response($content)->withHeaders(['X-Frame-Options' => 'ALLOWALL']);
$profile = AccountService::get($profile->id);
return view('profile.embed', compact('profile'))->withHeaders(['X-Frame-Options' => 'ALLOWALL']);
}
public function stories(Request $request, $username)