Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import json
import time
import datetime
from flask import Flask, render_template, request, jsonify, send_from_directory
from flask import Flask, render_template, request, jsonify, send_from_directory, redirect, url_for
from urllib.parse import urlparse
import requests
from dotenv import load_dotenv
Expand Down
8 changes: 0 additions & 8 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@ server {
include /etc/nginx/security_headers.inc;
}

location = /sitemap.xml {
alias /opt/infrascan/static/sitemap.xml;
# Cache sitemap for 24 hours
add_header Cache-Control "public, max-age=86400" always;
add_header Content-Type "application/xml; charset=utf-8" always;
include /etc/nginx/security_headers.inc;
}

location = /robots.txt {
alias /opt/infrascan/static/robots.txt;
# Cache robots.txt for 24 hours
Expand Down
30 changes: 30 additions & 0 deletions static/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,36 @@ function initApp() {
if (uuidMatch) {
currentScanId = uuidMatch[1];
}

// Register hosted-report button listeners (must happen before early return)
if (newScanBtn) {
newScanBtn.addEventListener('click', () => {
window.location.href = '/';
});
}

if (shareBtn) {
shareBtn.addEventListener('click', () => {
if (!currentScanId) return;
let cleanRepo = 'report';
if (currentMetadata && currentMetadata.repository_name) {
cleanRepo = currentMetadata.repository_name.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '') || 'report';
}
const shareUrl = `${window.location.origin}/report/${cleanRepo}-${currentScanId}`;
if (shareUrlInput) shareUrlInput.value = shareUrl;
if (shareLinkContainer) shareLinkContainer.classList.remove('hidden');
shareBtn.textContent = 'Results Shared';
});
}

if (copyShareBtn) {
copyShareBtn.addEventListener('click', () => {
if (shareUrlInput) shareUrlInput.select();
document.execCommand('copy');
copyShareBtn.textContent = 'Copied!';
setTimeout(() => { copyShareBtn.textContent = 'Copy'; }, 2000);
});
}
}

// Ensure container is correctly styled for full-width report
Expand Down
Loading