mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-25 15:55:22 +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)) {
|
if($cached = Cache::get($key)) {
|
||||||
return response()->json($cached, 200, [], JSON_UNESCAPED_SLASHES);
|
return response()->json($cached, 200, [], JSON_UNESCAPED_SLASHES);
|
||||||
}
|
}
|
||||||
|
$domain = config('pixelfed.domain.app');
|
||||||
|
abort_if(strpos($resource, $domain) == false, 404);
|
||||||
$parsed = Nickname::normalizeProfileUrl($resource);
|
$parsed = Nickname::normalizeProfileUrl($resource);
|
||||||
if(empty($parsed) || $parsed['domain'] !== config('pixelfed.domain.app')) {
|
if(empty($parsed) || $parsed['domain'] !== $domain) {
|
||||||
abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
$username = $parsed['username'];
|
$username = $parsed['username'];
|
||||||
$profile = Profile::whereNull('domain')->whereUsername($username)->firstOrFail();
|
$profile = Profile::whereNull('domain')->whereUsername($username)->firstOrFail();
|
||||||
if($profile->status != null) {
|
abort_if($profile->status != null, 404);
|
||||||
return ProfileController::accountCheck($profile);
|
|
||||||
}
|
|
||||||
$webfinger = (new Webfinger($profile))->generate();
|
$webfinger = (new Webfinger($profile))->generate();
|
||||||
Cache::put($key, $webfinger, 43200);
|
Cache::put($key, $webfinger, 1209600);
|
||||||
|
|
||||||
return response()->json($webfinger, 200, [], JSON_UNESCAPED_SLASHES)
|
return response()->json($webfinger, 200, [], JSON_UNESCAPED_SLASHES)
|
||||||
->header('Access-Control-Allow-Origin','*');
|
->header('Access-Control-Allow-Origin','*');
|
||||||
|
|
Loading…
Reference in a new issue