1
0
Fork 0

Merge pull request #3141 from pixelfed/staging

Staging
This commit is contained in:
daniel 2022-01-09 15:42:26 -07:00 committed by GitHub
commit aa4daa2cf5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -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'),

View File

@ -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);