xref: /webtrees/app/Http/RequestHandlers/WebmanifestJson.php (revision d11be7027e34e3121be11cc025421873364403f9)
1439bf5cfSGreg Roach<?php
2439bf5cfSGreg Roach
3439bf5cfSGreg Roach/**
4439bf5cfSGreg Roach * webtrees: online genealogy
5*d11be702SGreg Roach * Copyright (C) 2023 webtrees development team
6439bf5cfSGreg Roach * This program is free software: you can redistribute it and/or modify
7439bf5cfSGreg Roach * it under the terms of the GNU General Public License as published by
8439bf5cfSGreg Roach * the Free Software Foundation, either version 3 of the License, or
9439bf5cfSGreg Roach * (at your option) any later version.
10439bf5cfSGreg Roach * This program is distributed in the hope that it will be useful,
11439bf5cfSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12439bf5cfSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13439bf5cfSGreg Roach * GNU General Public License for more details.
14439bf5cfSGreg Roach * You should have received a copy of the GNU General Public License
15439bf5cfSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
16439bf5cfSGreg Roach */
17439bf5cfSGreg Roach
18439bf5cfSGreg Roachdeclare(strict_types=1);
19439bf5cfSGreg Roach
20439bf5cfSGreg Roachnamespace Fisharebest\Webtrees\Http\RequestHandlers;
21439bf5cfSGreg Roach
22439bf5cfSGreg Roachuse Fisharebest\Webtrees\View;
23439bf5cfSGreg Roachuse Psr\Http\Message\ResponseInterface;
24439bf5cfSGreg Roachuse Psr\Http\Message\ServerRequestInterface;
25439bf5cfSGreg Roachuse Psr\Http\Server\RequestHandlerInterface;
26439bf5cfSGreg Roach
27439bf5cfSGreg Roachuse function response;
28439bf5cfSGreg Roach
29439bf5cfSGreg Roach/**
30439bf5cfSGreg Roach * Respond to /apple-touch-icon.png.
31439bf5cfSGreg Roach */
32439bf5cfSGreg Roachclass WebmanifestJson implements RequestHandlerInterface
33439bf5cfSGreg Roach{
34439bf5cfSGreg Roach    /**
35439bf5cfSGreg Roach     * @param ServerRequestInterface $request
36439bf5cfSGreg Roach     *
37439bf5cfSGreg Roach     * @return ResponseInterface
38439bf5cfSGreg Roach     */
39439bf5cfSGreg Roach    public function handle(ServerRequestInterface $request): ResponseInterface
40439bf5cfSGreg Roach    {
41439bf5cfSGreg Roach        $content = View::make('webmanifest-json');
42439bf5cfSGreg Roach
43439bf5cfSGreg Roach        return response($content)
446172e7f6SGreg Roach            ->withHeader('content-type', 'application/json')
456172e7f6SGreg Roach            ->withHeader('cache-control', 'public,max-age=31536000');
46439bf5cfSGreg Roach    }
47439bf5cfSGreg Roach}
48