Skip to content

Commit

Permalink
Add instance post/profile embed config setting
Browse files Browse the repository at this point in the history
  • Loading branch information
dansup committed Aug 16, 2022
1 parent 1b9e50f commit 7734dc0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/Http/Controllers/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ public function embed(Request $request, $username)
{
$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']);
}
Expand Down
5 changes: 5 additions & 0 deletions app/Http/Controllers/StatusController.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ public function showId(int $id)

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)
Expand Down
5 changes: 5 additions & 0 deletions config/instance.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,9 @@
'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),
],
];

0 comments on commit 7734dc0

Please sign in to comment.