mirror of
https://github.com/manualdousuario/marreta.git
synced 2025-09-01 10:10:14 +00:00
ajustes e melhorias no processo de pwa
This commit is contained in:
parent
1c877f2779
commit
da3b42dbb7
11 changed files with 68 additions and 10 deletions
Binary file not shown.
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 4.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 16 KiB |
BIN
app/assets/pwa/apple-touch-icon.png
Normal file
BIN
app/assets/pwa/apple-touch-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
|
@ -68,7 +68,7 @@ $cache_folder = $cache->getCacheFileCount();
|
|||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta name="apple-mobile-web-app-title" content="<?php echo SITE_NAME; ?>">
|
||||
<link rel="apple-touch-icon" href="<?php echo SITE_URL; ?>/assets/pwa/192x192.png">
|
||||
<link rel="apple-touch-icon" href="<?php echo SITE_URL; ?>/assets/pwa/apple-touch-icon.png">
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="<?php echo SITE_URL; ?>" />
|
||||
<meta property="og:title" content="<?php echo SITE_NAME; ?>" />
|
||||
|
@ -169,7 +169,8 @@ $cache_folder = $cache->getCacheFileCount();
|
|||
<ol class="list-decimal list-inside space-y-2 text-gray-700">
|
||||
<li><?php echo Language::get('add_as_app_step1'); ?></li>
|
||||
<li><?php echo Language::get('add_as_app_step2'); ?></li>
|
||||
<li><?php echo str_replace('{site_name}', SITE_NAME, Language::get('add_as_app_step3')); ?></li>
|
||||
<li><?php echo Language::get('add_as_app_step3'); ?></li>
|
||||
<li><?php echo str_replace('{site_name}', SITE_NAME, Language::get('add_as_app_step4')); ?></li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -21,7 +21,8 @@ return [
|
|||
'add_as_app_description' => 'Installieren Sie {site_name} als App für schnelles Link-Sharing:',
|
||||
'add_as_app_step1' => 'Klicken Sie in Ihrem Browser auf das Menüsymbol (drei Punkte)',
|
||||
'add_as_app_step2' => 'Wählen Sie "App installieren" oder "Zum Startbildschirm hinzufügen"',
|
||||
'add_as_app_step3' => 'Klicken Sie auf "Installieren" für schnellen Zugriff auf {site_name}',
|
||||
'add_as_app_step3' => 'Klicken Sie für den Schnellzugriff auf „Installieren"',
|
||||
'add_as_app_step4' => 'Jetzt können Sie Links direkt zu {site_name} teilen',
|
||||
|
||||
'messages' => [
|
||||
'BLOCKED_DOMAIN' => [
|
||||
|
|
|
@ -21,7 +21,8 @@ return [
|
|||
'add_as_app_description' => 'Install {site_name} as an app for quick link sharing:',
|
||||
'add_as_app_step1' => 'In your browser, click the menu icon (three dots)',
|
||||
'add_as_app_step2' => 'Select "Install app" or "Add to home screen"',
|
||||
'add_as_app_step3' => 'Click "Install" for quick access to {site_name}',
|
||||
'add_as_app_step3' => 'Click "Install" for quick access',
|
||||
'add_as_app_step4' => 'Now you can directly share links to {site_name}',
|
||||
|
||||
'messages' => [
|
||||
'BLOCKED_DOMAIN' => [
|
||||
|
|
|
@ -21,7 +21,8 @@ return [
|
|||
'add_as_app_description' => 'Instale {site_name} como una aplicación para compartir enlaces rápidamente:',
|
||||
'add_as_app_step1' => 'En su navegador, haga clic en el icono de menú (tres puntos)',
|
||||
'add_as_app_step2' => 'Seleccione "Instalar aplicación" o "Agregar a la pantalla de inicio"',
|
||||
'add_as_app_step3' => 'Haga clic en "Instalar" para tener acceso rápido a {site_name}',
|
||||
'add_as_app_step3' => 'Haga clic en "Instalar" para tener acceso rápido',
|
||||
'add_as_app_step4' => 'Ahora puede compartir directamente enlaces a {site_name}',
|
||||
|
||||
'messages' => [
|
||||
'BLOCKED_DOMAIN' => [
|
||||
|
|
|
@ -21,7 +21,8 @@ return [
|
|||
'add_as_app_description' => 'Instale o {site_name} como um aplicativo para compartilhar links rapidamente:',
|
||||
'add_as_app_step1' => 'No seu navegador, clique no ícone de menu (três pontos)',
|
||||
'add_as_app_step2' => 'Selecione "Instalar aplicativo" ou "Adicionar à tela inicial"',
|
||||
'add_as_app_step3' => 'Clique em "Instalar" para ter acesso rápido ao {site_name}',
|
||||
'add_as_app_step3' => 'Clique em "Instalar" para ter acesso rápido',
|
||||
'add_as_app_step4' => 'Agora pode compartilhar diretamente links para o {site_name}',
|
||||
|
||||
'messages' => [
|
||||
'BLOCKED_DOMAIN' => [
|
||||
|
|
|
@ -1,4 +1,14 @@
|
|||
<?php
|
||||
/**
|
||||
* PWA Web Manifest Generator
|
||||
*
|
||||
* This file generates the Web App Manifest (manifest.json) for Progressive Web App (PWA) functionality.
|
||||
* It defines the application's behavior when installed on a device and its appearance in various contexts.
|
||||
*
|
||||
* Este arquivo gera o Manifesto Web (manifest.json) para funcionalidade de Progressive Web App (PWA).
|
||||
* Ele define o comportamento da aplicação quando instalada em um dispositivo e sua aparência em vários contextos.
|
||||
*/
|
||||
|
||||
require_once 'config.php';
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
@ -8,9 +18,11 @@ $manifest = [
|
|||
'short_name' => SITE_NAME,
|
||||
'description' => SITE_DESCRIPTION,
|
||||
'start_url' => SITE_URL,
|
||||
'display' => 'standalone',
|
||||
'display' => 'browser',
|
||||
'display_override' => ['window-controls-overlay'],
|
||||
'background_color' => '#ffffff',
|
||||
'theme_color' => '#2563eb',
|
||||
'orientation' => 'any',
|
||||
'icons' => [
|
||||
[
|
||||
'src' => 'assets/pwa/192x192.png',
|
||||
|
@ -26,10 +38,12 @@ $manifest = [
|
|||
]
|
||||
],
|
||||
'share_target' => [
|
||||
'action' => '/p/',
|
||||
'action' => 'pwa.php',
|
||||
'method' => 'GET',
|
||||
'params' => [
|
||||
'url' => 'text'
|
||||
'title' => 'title',
|
||||
'text' => 'text',
|
||||
'url' => 'url'
|
||||
]
|
||||
]
|
||||
];
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
* - Exibir o conteúdo processado ou redirecionar em caso de erro
|
||||
*
|
||||
* Usage example / Exemplo de uso:
|
||||
* /p/https://example.com
|
||||
* /p/https://exemplo.com
|
||||
*/
|
||||
|
||||
|
|
40
app/pwa.php
Normal file
40
app/pwa.php
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
/**
|
||||
* PWA Share Target Handler
|
||||
*
|
||||
* This script handles the PWA (Progressive Web App) share target functionality.
|
||||
* It receives a URL parameter via GET request and performs a 301 permanent
|
||||
* redirect to the /p/{URL} endpoint. If no URL is provided, redirects to
|
||||
* the homepage.
|
||||
*
|
||||
* Security measures:
|
||||
* - URL sanitization to prevent XSS attacks
|
||||
* - URL encoding to ensure proper parameter handling
|
||||
*
|
||||
* Este script gerencia a funcionalidade de compartilhamento do PWA (Progressive Web App).
|
||||
* Ele recebe um parâmetro URL via requisição GET e realiza um redirecionamento
|
||||
* permanente 301 para o endpoint /p/{URL}. Se nenhuma URL for fornecida,
|
||||
* redireciona para a página inicial.
|
||||
*
|
||||
* Medidas de segurança:
|
||||
* - Sanitização da URL para prevenir ataques XSS
|
||||
* - Codificação da URL para garantir o correto tratamento dos parâmetros
|
||||
*/
|
||||
|
||||
require_once 'config.php';
|
||||
|
||||
$url = $_GET['url'] ?? '';
|
||||
|
||||
if (!empty($url)) {
|
||||
// Sanitize URL to prevent XSS
|
||||
$url = filter_var($url, FILTER_SANITIZE_URL);
|
||||
$url = htmlspecialchars($url, ENT_QUOTES, 'UTF-8');
|
||||
|
||||
header('HTTP/1.1 301 Moved Permanently');
|
||||
header('Location: /p/' . urlencode($url));
|
||||
exit;
|
||||
}
|
||||
|
||||
// If no URL provided, redirect to homepage
|
||||
header('Location: /');
|
||||
exit;
|
Loading…
Add table
Reference in a new issue