Add instance post/profile embed config setting

This commit is contained in:
Daniel Supernault 2022-08-16 02:57:52 -06:00
parent 1b9e50f39b
commit 7734dc033b
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
3 changed files with 14 additions and 0 deletions

View file

@ -243,6 +243,10 @@ class ProfileController extends Controller
{
$res = view('profile.embed-removed');
if(!config('instance.embed.profile')) {
return response($res)->withHeaders(['X-Frame-Options' => 'ALLOWALL']);
}
if(strlen($username) > 15 || strlen($username) < 2) {
return response($res)->withHeaders(['X-Frame-Options' => 'ALLOWALL']);
}

View file

@ -106,6 +106,11 @@ class StatusController extends Controller
public function showEmbed(Request $request, $username, int $id)
{
if(!config('instance.embed.post')) {
$res = view('status.embed-removed');
return response($res)->withHeaders(['X-Frame-Options' => 'ALLOWALL']);
}
$profile = Profile::whereNull(['domain','status'])
->whereIsPrivate(false)
->whereUsername($username)

View file

@ -86,4 +86,9 @@ return [
'enable_cc' => env('ENABLE_CONFIG_CACHE', false),
'has_legal_notice' => env('INSTANCE_LEGAL_NOTICE', false),
'embed' => [
'profile' => env('INSTANCE_PROFILE_EMBEDS', true),
'post' => env('INSTANCE_POST_EMBEDS', true),
],
];