removed the T=timestamp in the url
Some checks failed
GitHub Actions / build (18) (push) Has been cancelled
GitHub Actions / build (20) (push) Has been cancelled
GitHub Actions / build (22) (push) Has been cancelled
GitHub Actions / check (push) Has been cancelled

This commit is contained in:
becarta
2025-04-14 00:29:37 +02:00
parent b1351ca79a
commit fae573069f
5 changed files with 101 additions and 54 deletions

67
.gitignore vendored
View File

@@ -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
# 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 its 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

View File

@@ -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"}}]}

View File

@@ -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.' }),
};
}
};

View File

@@ -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";
}
}
}

View File

@@ -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();
});
});