diff --git a/templates/index.html b/templates/index.html index f9bad89..caa84c9 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1041,8 +1041,14 @@ const panel = document.getElementById('insights-panel'); if (!panel) return; - // Injeta a senha web nas URLs das imagens para autenticação inline - const mdWithAuth = markdown.replace(/\/api\/host_file\?path=/g, '/api/host_file?pwd=' + encodeURIComponent(webPassword) + '&path='); + // Transforma caminhos da VPS ( em links da nossa API segura + // Ex: /host_root/root/img.jpg -> /api/host_file?pwd=...&path=/host_root/root/img.jpg + let mdWithAuth = markdown.replace(/!\[(.*?)\]\((\/host_root\/.*?)\)/g, (match, alt, path) => { + return `}&path=${encodeURIComponent(path)})`; + }); + + // Fallback para qualquer outro caso que tenha sobrado do prefixo antigo + mdWithAuth = mdWithAuth.replace(/\/api\/host_file\?path=/g, '/api/host_file?pwd=' + encodeURIComponent(webPassword) + '&path='); // Renderiza o Markdown para HTML usando marked.js panel.innerHTML = `