forked from mirror/pixelfed
commit
aa4daa2cf5
|
@ -1177,7 +1177,7 @@ class ApiV1Controller extends Controller
|
|||
*/
|
||||
public function instance(Request $request)
|
||||
{
|
||||
$res = Cache::remember('api:v1:instance-data-response', 900, function () {
|
||||
$res = Cache::remember('api:v1:instance-data-response-v0', 1800, function () {
|
||||
$contact = Cache::remember('api:v1:instance-data:contact', 604800, function () {
|
||||
$admin = User::whereIsAdmin(true)->first();
|
||||
return $admin && isset($admin->profile_id) ?
|
||||
|
@ -1212,7 +1212,7 @@ class ApiV1Controller extends Controller
|
|||
'short_description' => 'Pixelfed is an image sharing platform, an ethical alternative to centralized platforms',
|
||||
'description' => 'Pixelfed is an image sharing platform, an ethical alternative to centralized platforms',
|
||||
'email' => config('instance.email'),
|
||||
'version' => config('pixelfed.version'),
|
||||
'version' => '2.7.2 (compatible; Pixelfed ' . config('pixelfed.version') .')',
|
||||
'urls' => [],
|
||||
'stats' => $stats,
|
||||
'thumbnail' => url('headers/default.jpg'),
|
||||
|
|
|
@ -50,7 +50,7 @@ class FederationController extends Controller
|
|||
{
|
||||
abort_if(!config('federation.webfinger.enabled'), 400);
|
||||
|
||||
abort_if(!$request->filled('resource'), 400);
|
||||
abort_if(!$request->has('resource') || !$request->filled('resource'), 400);
|
||||
|
||||
$resource = $request->input('resource');
|
||||
$hash = hash('sha256', $resource);
|
||||
|
@ -59,14 +59,14 @@ class FederationController extends Controller
|
|||
return response()->json($cached, 200, [], JSON_UNESCAPED_SLASHES);
|
||||
}
|
||||
$domain = config('pixelfed.domain.app');
|
||||
abort_if(strpos($resource, $domain) == false, 404);
|
||||
abort_if(strpos($resource, $domain) == false, 400);
|
||||
$parsed = Nickname::normalizeProfileUrl($resource);
|
||||
if(empty($parsed) || $parsed['domain'] !== $domain) {
|
||||
abort(404);
|
||||
abort(400);
|
||||
}
|
||||
$username = $parsed['username'];
|
||||
$profile = Profile::whereNull('domain')->whereUsername($username)->firstOrFail();
|
||||
abort_if($profile->status != null, 404);
|
||||
abort_if($profile->status != null, 400);
|
||||
$webfinger = (new Webfinger($profile))->generate();
|
||||
Cache::put($key, $webfinger, 1209600);
|
||||
|
||||
|
|
Loading…
Reference in New Issue