Commit 5c56f3e6 authored by Yassine Doghri's avatar Yassine Doghri
Browse files

feat(settings): add general config for instance (site name, description and icon)

parent 193b373b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -137,9 +137,11 @@ node_modules

# public folder
public/*
public/media/site
!public/media
!public/.htaccess
!public/favicon.ico
!public/icon*
!public/index.php
!public/robots.txt

+20 −0
Original line number Diff line number Diff line
@@ -427,4 +427,24 @@ class App extends BaseConfig
     * Defines the root folder for media files storage
     */
    public string $mediaRoot = 'media';

    /**
     * --------------------------------------------------------------------------
     * Instance / Site Config
     * --------------------------------------------------------------------------
     */
    public string $siteName = 'Castopod';

    public string $siteDescription = 'Castopod Host is an open-source hosting platform made for podcasters who want engage and interact with their audience.';

    /**
     * @var array<int|string, string>
     */
    public array $siteIcon = [
        'ico' => '/favicon.ico',
        '64' => '/icon-64.png',
        '180' => '/icon-180.png',
        '192' => '/icon-192.png',
        '512' => '/icon-512.png',
    ];
}
+5 −1
Original line number Diff line number Diff line
@@ -48,9 +48,13 @@ $routes->addPlaceholder(
 * --------------------------------------------------------------------
 */

$routes->get('manifest.webmanifest', 'WebmanifestController', [
    'as' => 'webmanifest',
]);

// We get a performance increase by specifying the default
// route since we don't have to scan directories.
$routes->get('/', 'HomeController::index', [
$routes->get('/', 'HomeController', [
    'as' => 'home',
]);

+45 −0
Original line number Diff line number Diff line
<?php

declare(strict_types=1);

/**
 * @copyright  2020 Podlibre
 * @license    https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
 * @link       https://castopod.org/
 */

namespace App\Controllers;

use CodeIgniter\Controller;
use CodeIgniter\HTTP\ResponseInterface;

class WebmanifestController extends Controller
{
    public function index(): ResponseInterface
    {
        $webmanifest = [
            'name' => service('settings')
                ->get('App.siteName'),
            'description' => service('settings')
                ->get('App.siteDescription'),
            'display' => 'minimal-ui',
            'theme_color' => '#009486',
            'icons' => [
                [
                    'src' => service('settings')
                        ->get('App.siteIcon')['192'],
                    'type' => 'image/png',
                    'sizes' => '192x192',
                ],
                [
                    'src' => service('settings')
                        ->get('App.siteIcon')['512'],
                    'type' => 'image/png',
                    'sizes' => '512x512',
                ],
            ],
        ];

        return $this->response->setJSON($webmanifest);
    }
}
+12 −0
Original line number Diff line number Diff line
@@ -40,6 +40,18 @@ class AuthSeeder extends Seeder
     * @var array<string, array<string, string|array>[]>
     */
    protected array $permissions = [
        'settings' => [
            [
                'name' => 'view',
                'description' => 'View settings options',
                'has_permission' => ['superadmin'],
            ],
            [
                'name' => 'manage',
                'description' => 'Update general settings',
                'has_permission' => ['superadmin'],
            ],
        ],
        'users' => [
            [
                'name' => 'create',
Loading