From e5b8372c2b15edb624247e3807ac0471c7bbc1bf Mon Sep 17 00:00:00 2001
From: Sajo <75281007+sajotrei@users.noreply.github.com>
Date: Mon, 10 Aug 2026 03:41:04 +0200
Subject: [PATCH] fix: rende il manifest indipendente dal percorso di
installazione
---
include/init/manifest.php | 65 ++++++++++++++++++++-------------------
update/2_12.php | 5 ++-
2 files changed, 38 insertions(+), 32 deletions(-)
diff --git a/include/init/manifest.php b/include/init/manifest.php
index 12cdb07222..e030088fa7 100644
--- a/include/init/manifest.php
+++ b/include/init/manifest.php
@@ -18,43 +18,46 @@
* along with this program. If not, see .
*/
-$creation = file_put_contents('manifest.json', '');
+$manifest_lang = (!empty($lang) && $lang != '|lang|') ? $lang : ($GLOBALS['lang'] ?? 'it_IT');
+$manifest_lang = empty($manifest_lang) || $manifest_lang == '|lang|' ? 'it_IT' : $manifest_lang;
-if (!$creation) {
- $manifest = '{
+$manifest = [
+ 'dir' => 'ltr',
+ 'lang' => str_replace('_', '-', $manifest_lang),
+ 'name' => tr('OpenSTAManager'),
+ 'scope' => './',
+ 'display' => 'fullscreen',
+ 'start_url' => './',
+ 'short_name' => 'OSM',
+ 'theme_color' => 'transparent',
+ 'description' => tr('OpenSTAManager'),
+ 'orientation' => 'any',
+ 'background_color' => 'transparent',
+ 'generated' => 'true',
+ 'icons' => [
+ [
+ 'src' => 'assets/dist/img/logo_completo.png',
+ 'type' => 'image/png',
+ 'sizes' => '489x91',
+ ],
+ ],
+];
- "dir" : "ltr",
- "lang" : "'.((empty($lang) || $lang == '|lang|') ? 'it-IT' : str_replace('_', '-', $lang)).'",
- "name" : "'.tr('OpenSTAManager').'",
- "scope" : "'.((empty(base_path_osm()) || base_path_osm() == '/') ? '' : '.').'",
- "display" : "fullscreen",
- "start_url" : "'.((empty(base_path_osm()) || base_path_osm() == '/') ? '/' : './').'",
- "short_name" : "OSM",
- "theme_color" : "transparent",
- "description" : "'.tr('OpenSTAManager').'",
- "orientation" : "any",
- "background_color" : "transparent",
- "generated" : "true",
- "icons" : [
- {
- "src": "'.App::getPaths()['img'].'/logo_completo.png",
- "type": "image/png",
- "sizes": "489x91"
- }
- ]
-}';
+$manifest_content = json_encode($manifest, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
+$creation = $manifest_content !== false
+ ? file_put_contents(base_dir().'/manifest.json', $manifest_content.PHP_EOL)
+ : false;
- file_put_contents('manifest.json', $manifest);
-} else {
+if ($creation === false) {
echo '
-
-
-
'.tr('Sembra che non ci siano i permessi di scrittura sul file _FILE_', [
+
+
+
'.tr('Sembra che non ci siano i permessi di scrittura sul file _FILE_', [
'_FILE_' => 'manifest.json',
]).'
-
+
';
}
diff --git a/update/2_12.php b/update/2_12.php
index c107a7ae10..ee9f3328f2 100644
--- a/update/2_12.php
+++ b/update/2_12.php
@@ -79,4 +79,7 @@
// File non più presente, reset del valore
$dbo->update('zz_settings', ['valore' => ''], ['nome' => 'Filigrana stampe']);
}
-}
\ No newline at end of file
+}
+
+// Rigenerazione del manifest per rendere scope e start_url indipendenti dal percorso di installazione
+include base_dir().'/include/init/manifest.php';