/** Datei: plugins/pwas/hooks/pwa.php **/ * @copyright 2025 ARUNOX * @version 1.0.0 * @since 1.0.0 File is created */ use ARUNOX\Plugins; use ARUNOX\Launcher; use ARUNOX\Core\Hooks; use ARUNOX\Themes\LCARS\Theme; use ARUNOX\HTTP; // Hooks::add('template::pagetitle', [ Launcher\PWA::class, "templatePageTitle" ] ); // Hooks::add( 'rest::response->add->template', [ Launcher\PWA::class, "restResponseAddTemplate" ] ); // Hooks::add('router::resolve->after', [ Launcher\PWA::class, "modifyRouteRestLogin" ] ); Hooks::add('router::resolve->before', function( $route ){ if( $route[0] == "/rest" ) { $route[0] = "/rest/pwas"; } // show( $route ); return $route; } , 5 ); Hooks::add('config::constants', function() { if( preg_match( '/^\/startAsPWA/', REQUEST_URI ) ) { setcookie( "pwa", TRUE, time() + ( 86400 * 30 ), '/' ); $_COOKIE["pwa"] = TRUE; redirect( "/" ); } if( preg_match( '/^\/stopAsPWA/', REQUEST_URI ) ) { setcookie( "pwa", FALSE, time() + ( 86400 * 30 ), '/' ); redirect( "/" ); } if( $_COOKIE["pwa"] ?? FALSE ) { // Hooks::remove('LOGIN_REDIRECT'); Launcher\PWA::set(); Theme::set(); } }); /** Datei: plugins/pwas/hooks/init.php **/ * @copyright 2025 ARUNOX * @version 1.0.0 * @since 1.0.0 File is created */ use ARUNOX\Core\Hooks; use ARUNOX\Plugins\PWAs; Hooks::add('public::api->init', [ PWAs\API\v1\Routes::class, "register" ] ); Hooks::add('public::api->init', [ PWAs\Images\API\v1\Routes::class, "register" ] ); Hooks::add('router::dispatch->after->get.rest.login', [ PWAs\API\v1\Routes::class, "installer" ] );