mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 06:21:27 +00:00
Update FederationController, increase webfinger cache ttl from 12 hours to 14 days
This commit is contained in:
parent
8db6a79de9
commit
745c35807c
1 changed files with 5 additions and 5 deletions
|
@ -58,17 +58,17 @@ class FederationController extends Controller
|
|||
if($cached = Cache::get($key)) {
|
||||
return response()->json($cached, 200, [], JSON_UNESCAPED_SLASHES);
|
||||
}
|
||||
$domain = config('pixelfed.domain.app');
|
||||
abort_if(strpos($resource, $domain) == false, 404);
|
||||
$parsed = Nickname::normalizeProfileUrl($resource);
|
||||
if(empty($parsed) || $parsed['domain'] !== config('pixelfed.domain.app')) {
|
||||
if(empty($parsed) || $parsed['domain'] !== $domain) {
|
||||
abort(404);
|
||||
}
|
||||
$username = $parsed['username'];
|
||||
$profile = Profile::whereNull('domain')->whereUsername($username)->firstOrFail();
|
||||
if($profile->status != null) {
|
||||
return ProfileController::accountCheck($profile);
|
||||
}
|
||||
abort_if($profile->status != null, 404);
|
||||
$webfinger = (new Webfinger($profile))->generate();
|
||||
Cache::put($key, $webfinger, 43200);
|
||||
Cache::put($key, $webfinger, 1209600);
|
||||
|
||||
return response()->json($webfinger, 200, [], JSON_UNESCAPED_SLASHES)
|
||||
->header('Access-Control-Allow-Origin','*');
|
||||
|
|
Loading…
Reference in a new issue