diff --git a/.gitignore b/.gitignore index 33741a8..c6ed7d3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,24 +1,63 @@ -# build output -dist/ -.output/ - -# dependencies +# Node modules and logs node_modules/ - -# logs npm-debug.log* yarn-debug.log* yarn-error.log* pnpm-debug.log* +# Local env and secrets +.env* +!.env.example -# environment variables -.env -.env.production - -# macOS-specific files +# OS/IDE/editor files .DS_Store +Thumbs.db +.vscode/ +.idea/ +*.swp -pnpm-lock.yaml +# Build output +dist/ +.cache/ +output/ +astro.config.mjs +.svelte-kit/ -.astro \ No newline at end of file +# Testing and reports +coverage/ +*.lcov + +# Lock files (optional: if not committing them) +# package-lock.json +# yarn.lock +# pnpm-lock.yaml + +# Generated build artifacts +*.tsbuildinfo + +# Docker artifacts +docker-compose.override.yml +*.log + +# Custom zip or temp assets +*.zip +*.tar.gz +backup/ +inter.zip + +# Optional: static deployment cache +.vercel/ +.netlify/ + +# Optional: ignore public/index.html if it’s generated dynamically +# public/index.html + +# Astro preview build cache (if used) +.astro/ + +# Ignore any custom scripts or test results +*.test.* +*.bench.* + +# Nginx config if used but private +nginx/*.conf \ No newline at end of file diff --git a/.netlify/v1/config.json b/.netlify/v1/config.json deleted file mode 100644 index 05f78f2..0000000 --- a/.netlify/v1/config.json +++ /dev/null @@ -1 +0,0 @@ -{"images":{"remote_images":["https?://cdn\\.pixabay\\.com/.*","https?://raw\\.githubusercontent\\.com/.*"]},"headers":[{"for":"/_astro/*","values":{"Cache-Control":"public, max-age=31536000, immutable"}}]} \ No newline at end of file diff --git a/netlify/functions/contact.js b/netlify/functions/contact.js deleted file mode 100644 index ab327e2..0000000 --- a/netlify/functions/contact.js +++ /dev/null @@ -1,30 +0,0 @@ -import { JSDOM } from 'jsdom'; -import createDOMPurify from 'dompurify'; - -export const handler = async (event) => { - try { - const data = JSON.parse(event.body); - const DOMPurify = createDOMPurify(new JSDOM('').window); - - // Sanitize user input - const sanitizedData = { - name: DOMPurify.sanitize(data.name), - email: DOMPurify.sanitize(data.email), - message: DOMPurify.sanitize(data.message), - }; - - // TODO: Process the sanitized data (e.g., send an email) - console.log('Sanitized data:', sanitizedData); - - return { - statusCode: 200, - body: JSON.stringify({ message: 'Form submitted successfully!' }), - }; - } catch (error) { - console.error('Error:', error); - return { - statusCode: 500, - body: JSON.stringify({ message: 'An error occurred.' }), - }; - } -}; \ No newline at end of file diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 4de4ee7..c66b414 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -1,31 +1,70 @@ -worker_processes 1; +worker_processes auto; events { worker_connections 1024; } http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + sendfile on; + keepalive_timeout 65; + + gzip on; + gzip_disable "msie6"; + gzip_vary on; + gzip_proxied any; + gzip_comp_level 6; + gzip_buffers 16 8k; + gzip_http_version 1.1; + gzip_min_length 1000; + gzip_types + text/plain + text/css + application/json + application/javascript + application/x-javascript + text/xml + application/xml + application/xml+rss + text/javascript + image/svg+xml + font/woff2; + server { listen 8080; server_name _; root /usr/share/nginx/html; index index.html index.htm; - include /etc/nginx/mime.types; - - gzip on; - gzip_min_length 1000; - gzip_proxied expired no-cache no-store private auth; - gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript; + # Error pages error_page 404 /404.html; location = /404.html { - root /usr/share/nginx/html; internal; } + # Main route fallback location / { try_files $uri $uri/index.html =404; } + + # 🚫 Block hidden and sensitive files (e.g., .env, .git) + location ~ /\.(?!well-known).* { + deny all; + } + + # 🚫 Block access to config and archive files + location ~* \.(cjs|ts|json|sh|zip|log|env)$ { + deny all; + } + + # 🧠 Optional: cache static assets for 6 months + location ~* \.(?:ico|css|js|gif|jpe?g|png|woff2?|eot|ttf|svg|otf|webp)$ { + expires 6M; + access_log off; + add_header Cache-Control "public"; + } } } \ No newline at end of file diff --git a/src/components/LanguageDropdown.astro b/src/components/LanguageDropdown.astro index cb150f2..38c832a 100644 --- a/src/components/LanguageDropdown.astro +++ b/src/components/LanguageDropdown.astro @@ -302,7 +302,7 @@ const currentLanguage = languages.find((lang) => lang.code === currentLang) || l // Force a complete page reload to ensure all content is updated to the new language // This bypasses any client-side caching and ensures a fresh server render - window.location.href = newFullUrl + '?t=' + Date.now(); + // window.location.href = newFullUrl + '?t=' + Date.now(); }); });