Skip to content

Commit 7734dc0

Browse files
committed
Add instance post/profile embed config setting
1 parent 1b9e50f commit 7734dc0

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

app/Http/Controllers/ProfileController.php

+4
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,10 @@ public function embed(Request $request, $username)
243243
{
244244
$res = view('profile.embed-removed');
245245

246+
if(!config('instance.embed.profile')) {
247+
return response($res)->withHeaders(['X-Frame-Options' => 'ALLOWALL']);
248+
}
249+
246250
if(strlen($username) > 15 || strlen($username) < 2) {
247251
return response($res)->withHeaders(['X-Frame-Options' => 'ALLOWALL']);
248252
}

app/Http/Controllers/StatusController.php

+5
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ public function showId(int $id)
106106

107107
public function showEmbed(Request $request, $username, int $id)
108108
{
109+
if(!config('instance.embed.post')) {
110+
$res = view('status.embed-removed');
111+
return response($res)->withHeaders(['X-Frame-Options' => 'ALLOWALL']);
112+
}
113+
109114
$profile = Profile::whereNull(['domain','status'])
110115
->whereIsPrivate(false)
111116
->whereUsername($username)

config/instance.php

+5
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,9 @@
8686
'enable_cc' => env('ENABLE_CONFIG_CACHE', false),
8787

8888
'has_legal_notice' => env('INSTANCE_LEGAL_NOTICE', false),
89+
90+
'embed' => [
91+
'profile' => env('INSTANCE_PROFILE_EMBEDS', true),
92+
'post' => env('INSTANCE_POST_EMBEDS', true),
93+
],
8994
];

0 commit comments

Comments
 (0)