From 69e86c239b8fd096a9beff13c5e73755700dd051 Mon Sep 17 00:00:00 2001 From: Bruno Charest Date: Thu, 4 Jun 2026 23:50:10 -0400 Subject: [PATCH] fix: CSP add cdn.jsdelivr.net, fix regex syntax, fix manifest PNG->SVG --- backend/main.py | 2 +- frontend/index.html | 2 +- frontend/js/utils.js | 3 +-- frontend/manifest.json | 58 ++++++++++++++++-------------------------- frontend/sw.js | 4 +-- 5 files changed, 27 insertions(+), 42 deletions(-) diff --git a/backend/main.py b/backend/main.py index 87e947c..8a3a1e5 100644 --- a/backend/main.py +++ b/backend/main.py @@ -544,7 +544,7 @@ class SecurityHeadersMiddleware(BaseHTTPMiddleware): response.headers["Referrer-Policy"] = "strict-origin-when-cross-origin" response.headers["Content-Security-Policy"] = ( "default-src 'self'; " - "script-src 'self' 'unsafe-inline' https://cdnjs.cloudflare.com https://unpkg.com https://esm.sh; " + "script-src 'self' 'unsafe-inline' https://cdnjs.cloudflare.com https://unpkg.com https://esm.sh https://cdn.jsdelivr.net; " "style-src 'self' 'unsafe-inline' https://cdnjs.cloudflare.com https://fonts.googleapis.com; " "img-src 'self' data: blob:; " "connect-src 'self' https://esm.sh https://unpkg.com https://cdnjs.cloudflare.com https://fonts.googleapis.com https://fonts.gstatic.com; " diff --git a/frontend/index.html b/frontend/index.html index d5aecaf..1e8e6f4 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -42,7 +42,7 @@ /> diff --git a/frontend/js/utils.js b/frontend/js/utils.js index ebe5aca..cdd0421 100644 --- a/frontend/js/utils.js +++ b/frontend/js/utils.js @@ -405,8 +405,7 @@ async function openEditor(vaultName, filePath) { clearTimeout(mermaidTimer); mermaidTimer = setTimeout(function() { var content = state.editorView ? state.editorView.state.doc.toString() : (state.fallbackEditorEl ? state.fallbackEditorEl.value : ''); - var match = content.match(/```mermaid -([\s\S]*?)```/); + var match = content.match(/```mermaid\n([\s\S]*?)```/); if (match) { previewPanel.style.display = 'block'; previewPanel.innerHTML = ''; diff --git a/frontend/manifest.json b/frontend/manifest.json index 4c46de4..16513be 100644 --- a/frontend/manifest.json +++ b/frontend/manifest.json @@ -1,7 +1,7 @@ { "name": "ObsiGate", "short_name": "ObsiGate", - "description": "Porte d'entrée web pour vos vaults Obsidian - Accédez, naviguez et recherchez dans toutes vos notes", + "description": "Porte d'entree web pour vos vaults Obsidian - Accedez, naviguez et recherchez dans toutes vos notes", "start_url": "/", "scope": "/", "display": "standalone", @@ -10,81 +10,67 @@ "orientation": "any", "icons": [ { - "src": "/static/icons/icon-72x72.png", + "src": "/static/icons/icon-72x72.svg", "sizes": "72x72", - "type": "image/png", + "type": "image/svg+xml", "purpose": "any" }, { - "src": "/static/icons/icon-96x96.png", + "src": "/static/icons/icon-96x96.svg", "sizes": "96x96", - "type": "image/png", + "type": "image/svg+xml", "purpose": "any" }, { - "src": "/static/icons/icon-128x128.png", + "src": "/static/icons/icon-128x128.svg", "sizes": "128x128", - "type": "image/png", + "type": "image/svg+xml", "purpose": "any" }, { - "src": "/static/icons/icon-144x144.png", + "src": "/static/icons/icon-144x144.svg", "sizes": "144x144", - "type": "image/png", + "type": "image/svg+xml", "purpose": "any" }, { - "src": "/static/icons/icon-152x152.png", + "src": "/static/icons/icon-152x152.svg", "sizes": "152x152", - "type": "image/png", + "type": "image/svg+xml", "purpose": "any" }, { - "src": "/static/icons/icon-192x192.png", + "src": "/static/icons/icon-192x192.svg", "sizes": "192x192", - "type": "image/png", + "type": "image/svg+xml", "purpose": "any" }, { - "src": "/static/icons/icon-384x384.png", + "src": "/static/icons/icon-384x384.svg", "sizes": "384x384", - "type": "image/png", + "type": "image/svg+xml", "purpose": "any" }, { - "src": "/static/icons/icon-512x512.png", + "src": "/static/icons/icon-512x512.svg", "sizes": "512x512", - "type": "image/png", + "type": "image/svg+xml", "purpose": "any" }, { - "src": "/static/icons/icon-192x192-maskable.png", + "src": "/static/icons/icon-192x192-maskable.svg", "sizes": "192x192", - "type": "image/png", + "type": "image/svg+xml", "purpose": "maskable" }, { - "src": "/static/icons/icon-512x512-maskable.png", + "src": "/static/icons/icon-512x512-maskable.svg", "sizes": "512x512", - "type": "image/png", + "type": "image/svg+xml", "purpose": "maskable" } ], "categories": ["productivity", "utilities"], - "screenshots": [ - { - "src": "/static/screenshots/desktop.png", - "sizes": "1280x720", - "type": "image/png", - "form_factor": "wide" - }, - { - "src": "/static/screenshots/mobile.png", - "sizes": "750x1334", - "type": "image/png", - "form_factor": "narrow" - } - ], "shortcuts": [ { "name": "Recherche", @@ -93,7 +79,7 @@ "url": "/?action=search", "icons": [ { - "src": "/static/icons/search-96x96.png", + "src": "/static/icons/search-96x96.svg", "sizes": "96x96" } ] diff --git a/frontend/sw.js b/frontend/sw.js index 020b202..37c6f24 100644 --- a/frontend/sw.js +++ b/frontend/sw.js @@ -201,8 +201,8 @@ async function syncData() { self.addEventListener('push', (event) => { const options = { body: event.data ? event.data.text() : 'New update available', - icon: '/static/icons/icon-192x192.png', - badge: '/static/icons/icon-72x72.png', + icon: '/static/icons/icon-192x192.svg', + badge: '/static/icons/icon-72x72.svg', vibrate: [200, 100, 200], data: { dateOfArrival: Date.now(),