refactor: main Branch enthält nur noch Produktions-Dateien (dist/)

- Quellcode-Ordner entfernt (assets/, config/, includes/, scripts/)
- Build-Abhängigkeiten entfernt (package.json, package-lock.json)
- Nur dist/, README.md und LICENSE bleiben
- Entwicklung erfolgt im develop Branch
This commit is contained in:
TheOnlyMace
2026-01-16 20:03:21 +01:00
parent 967ffed515
commit 78b341fa75
12 changed files with 0 additions and 5738 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,320 +0,0 @@
// Contact page specific JavaScript
(function() {
'use strict';
// FAQ Accordion functionality
function initFAQ() {
const faqItems = document.querySelectorAll('.faq-item');
faqItems.forEach(item => {
const question = item.querySelector('.faq-question');
const answer = item.querySelector('.faq-answer');
const toggle = item.querySelector('.faq-toggle');
question.addEventListener('click', function() {
const isOpen = item.classList.contains('open');
// Close all other FAQ items
faqItems.forEach(otherItem => {
if (otherItem !== item) {
otherItem.classList.remove('open');
const otherAnswer = otherItem.querySelector('.faq-answer');
const otherToggle = otherItem.querySelector('.faq-toggle');
otherAnswer.style.maxHeight = null;
otherToggle.textContent = '+';
}
});
// Toggle current item
if (isOpen) {
item.classList.remove('open');
answer.style.maxHeight = null;
toggle.textContent = '+';
} else {
item.classList.add('open');
answer.style.maxHeight = answer.scrollHeight + 'px';
toggle.textContent = '';
}
});
});
}
// Contact form handling
function initContactForm() {
const form = document.getElementById('contactForm');
if (!form) return;
form.addEventListener('submit', function(e) {
e.preventDefault();
// Get form data
const formData = new FormData(form);
// Basic validation
const data = {};
for (let [key, value] of formData.entries()) {
data[key] = value;
}
if (!validateForm(data)) {
return;
}
// Show loading state
const submitBtn = form.querySelector('button[type="submit"]');
const originalText = submitBtn.textContent;
submitBtn.textContent = 'Wird gesendet...';
submitBtn.disabled = true;
// Send form data to PHP backend
fetch('contact-handler.php', {
method: 'POST',
body: formData
})
.then(response => response.json())
.then(data => {
// Reset button state
submitBtn.textContent = originalText;
submitBtn.disabled = false;
if (data.success) {
// Reset form
form.reset();
// Show success message
showNotification(data.message, 'success');
// Scroll to top
window.scrollTo({ top: 0, behavior: 'smooth' });
} else {
// Show error message
showNotification(data.message, 'error');
// Highlight missing fields if provided
if (data.missing_fields) {
data.missing_fields.forEach(field => {
const fieldElement = document.getElementById(field);
if (fieldElement) {
fieldElement.style.borderColor = '#ff4d6d';
setTimeout(() => {
fieldElement.style.borderColor = '';
}, 3000);
}
});
}
}
})
.catch(error => {
console.error('Error:', error);
showNotification('Ein Fehler ist aufgetreten. Bitte versuchen Sie es später erneut.', 'error');
submitBtn.textContent = originalText;
submitBtn.disabled = false;
});
});
}
// Form validation
function validateForm(data) {
const requiredFields = ['firstName', 'lastName', 'email', 'subject', 'message'];
const errors = [];
// Check required fields
requiredFields.forEach(field => {
if (!data[field] || data[field].trim() === '') {
errors.push(`Das Feld "${getFieldLabel(field)}" ist erforderlich.`);
}
});
// Email validation
if (data.email && !isValidEmail(data.email)) {
errors.push('Bitte geben Sie eine gültige E-Mail-Adresse ein.');
}
// Privacy checkbox
if (!data.privacy) {
errors.push('Sie müssen der Datenschutzerklärung zustimmen.');
}
if (errors.length > 0) {
showNotification(errors.join('\n'), 'error');
return false;
}
return true;
}
// Helper function to get field labels
function getFieldLabel(fieldName) {
const labels = {
firstName: 'Vorname',
lastName: 'Nachname',
email: 'E-Mail-Adresse',
subject: 'Betreff',
message: 'Nachricht'
};
return labels[fieldName] || fieldName;
}
// Email validation
function isValidEmail(email) {
const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return re.test(email);
}
// Notification system (using the global one from main.js)
function showNotification(message, type = 'info') {
if (window.HexaHost && window.HexaHost.showNotification) {
window.HexaHost.showNotification(message, type);
} else {
// Fallback
alert(message);
}
}
// Live chat placeholder function
window.openLiveChat = function() {
showNotification('Live Chat wird geöffnet... (Demo-Funktion)', 'info');
// Here you would integrate with your actual live chat service
// For example: Tawk.to, Intercom, Zendesk Chat, etc.
};
// Auto-fill form based on URL parameters
function autofillForm() {
const urlParams = new URLSearchParams(window.location.search);
const packageParam = urlParams.get('package');
const productParam = urlParams.get('product');
if (packageParam || productParam) {
const subjectSelect = document.getElementById('subject');
const messageTextarea = document.getElementById('message');
if (packageParam) {
// Set subject based on package
const packageNames = {
'vpc-starter': 'Virtual Private Container - Starter Paket',
'vpc-business': 'Virtual Private Container - Business Paket',
'vpc-professional': 'Virtual Private Container - Professional Paket',
'vpc-enterprise': 'Virtual Private Container - Enterprise Paket',
'vps-basic': 'Virtual Private Server - Basic Paket',
'vps-standard': 'Virtual Private Server - Standard Paket',
'vps-premium': 'Virtual Private Server - Premium Paket',
'vps-enterprise': 'Virtual Private Server - Enterprise Paket',
'mail-starter': 'Mail Gateway - Starter Paket',
'mail-business': 'Mail Gateway - Business Paket',
'mail-professional': 'Mail Gateway - Professional Paket',
'mail-enterprise': 'Mail Gateway - Enterprise Paket',
'web-starter': 'Webhosting - Starter Paket',
'web-business': 'Webhosting - Business Paket',
'web-professional': 'Webhosting - Professional Paket',
'web-enterprise': 'Webhosting - Enterprise Paket'
};
if (packageNames[packageParam]) {
messageTextarea.value = `Hallo,\n\nich interessiere mich für das ${packageNames[packageParam]}.\n\nBitte senden Sie mir weitere Informationen und ein individuelles Angebot.\n\nVielen Dank!`;
// Set appropriate subject
if (packageParam.startsWith('vpc-')) {
subjectSelect.value = 'vpc-anfrage';
} else if (packageParam.startsWith('vps-')) {
subjectSelect.value = 'vps-anfrage';
} else if (packageParam.startsWith('mail-')) {
subjectSelect.value = 'mail-gateway-anfrage';
} else if (packageParam.startsWith('web-')) {
subjectSelect.value = 'webhosting-anfrage';
}
}
} else if (productParam) {
// Set subject based on product
const productSubjects = {
'vpc': 'vpc-anfrage',
'vps': 'vps-anfrage',
'mail-gateway': 'mail-gateway-anfrage',
'webhosting': 'webhosting-anfrage'
};
if (productSubjects[productParam]) {
subjectSelect.value = productSubjects[productParam];
messageTextarea.value = `Hallo,\n\nich interessiere mich für Ihre ${productParam.replace('-', ' ')} Lösungen.\n\nBitte kontaktieren Sie mich für eine persönliche Beratung.\n\nVielen Dank!`;
}
}
}
}
// Form field enhancements
function enhanceFormFields() {
const inputs = document.querySelectorAll('input, select, textarea');
inputs.forEach(input => {
// Add focus/blur effects
input.addEventListener('focus', function() {
this.parentElement.classList.add('focused');
});
input.addEventListener('blur', function() {
if (!this.value) {
this.parentElement.classList.remove('focused');
}
});
// Check if field already has value (for autofilled forms)
if (input.value) {
input.parentElement.classList.add('focused');
}
});
// Phone number formatting
const phoneInput = document.getElementById('phone');
if (phoneInput) {
phoneInput.addEventListener('input', function() {
// Simple German phone number formatting
let value = this.value.replace(/\D/g, '');
if (value.startsWith('49')) {
value = '+' + value;
} else if (value.startsWith('0')) {
value = '+49' + value.substring(1);
}
this.value = value;
});
}
}
// Accessibility improvements
function improveAccessibility() {
// Add ARIA labels to form elements
const requiredFields = document.querySelectorAll('input[required], select[required], textarea[required]');
requiredFields.forEach(field => {
field.setAttribute('aria-required', 'true');
});
// Add keyboard navigation for FAQ
const faqQuestions = document.querySelectorAll('.faq-question');
faqQuestions.forEach(question => {
question.setAttribute('tabindex', '0');
question.setAttribute('role', 'button');
question.setAttribute('aria-expanded', 'false');
question.addEventListener('keydown', function(e) {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
this.click();
}
});
});
}
// Initialize everything when DOM is loaded
document.addEventListener('DOMContentLoaded', function() {
initFAQ();
initContactForm();
autofillForm();
enhanceFormFields();
improveAccessibility();
// Show a welcome message for contact page
setTimeout(() => {
showNotification('💬 Haben Sie Fragen? Wir helfen gerne!', 'info');
}, 2000);
});
})();

View File

@@ -1,323 +0,0 @@
/**
* Cookie Consent Manager für HexaHost.de
* DSGVO-konformes Cookie-Banner mit granularen Einstellungen
*/
(function() {
'use strict';
// Cookie-Konfiguration
const COOKIE_NAME = 'hexahost_cookie_consent';
const COOKIE_EXPIRY_DAYS = 365;
// DOM-Elemente
const banner = document.getElementById('cookieConsent');
const settingsPanel = document.getElementById('cookieSettingsPanel');
const acceptAllBtn = document.getElementById('cookieAcceptAll');
const acceptEssentialBtn = document.getElementById('cookieAcceptEssential');
const settingsBtn = document.getElementById('cookieSettings');
const saveSettingsBtn = document.getElementById('cookieSaveSettings');
const closeSettingsBtn = document.getElementById('cookieCloseSettings');
const analyticsCheckbox = document.getElementById('cookieAnalytics');
const marketingCheckbox = document.getElementById('cookieMarketing');
/**
* Cookie-Hilfsfunktionen
*/
const CookieUtils = {
set: function(name, value, days) {
const date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
const expires = 'expires=' + date.toUTCString();
document.cookie = name + '=' + JSON.stringify(value) + ';' + expires + ';path=/;SameSite=Lax;Secure';
},
get: function(name) {
const nameEQ = name + '=';
const cookies = document.cookie.split(';');
for (let i = 0; i < cookies.length; i++) {
let cookie = cookies[i].trim();
if (cookie.indexOf(nameEQ) === 0) {
try {
return JSON.parse(cookie.substring(nameEQ.length));
} catch (e) {
return null;
}
}
}
return null;
},
delete: function(name) {
document.cookie = name + '=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/;';
}
};
/**
* Cookie Consent Manager
*/
const CookieConsent = {
// Standardeinstellungen
defaultConsent: {
essential: true, // Immer aktiviert
analytics: false,
marketing: false,
timestamp: null
},
/**
* Initialisierung
*/
init: function() {
if (!banner) return;
const consent = this.getConsent();
if (consent && consent.timestamp) {
// Consent bereits gegeben - Banner verstecken
this.hideBanner();
this.applyConsent(consent);
} else {
// Zeige Banner
this.showBanner();
}
this.bindEvents();
},
/**
* Event-Listener binden
*/
bindEvents: function() {
if (acceptAllBtn) {
acceptAllBtn.addEventListener('click', () => this.acceptAll());
}
if (acceptEssentialBtn) {
acceptEssentialBtn.addEventListener('click', () => this.acceptEssential());
}
if (settingsBtn) {
settingsBtn.addEventListener('click', () => this.showSettings());
}
if (saveSettingsBtn) {
saveSettingsBtn.addEventListener('click', () => this.saveSettings());
}
if (closeSettingsBtn) {
closeSettingsBtn.addEventListener('click', () => this.hideSettings());
}
// ESC-Taste zum Schließen der Einstellungen
document.addEventListener('keydown', (e) => {
if (e.key === 'Escape' && settingsPanel && settingsPanel.style.display !== 'none') {
this.hideSettings();
}
});
},
/**
* Alle Cookies akzeptieren
*/
acceptAll: function() {
const consent = {
essential: true,
analytics: true,
marketing: true,
timestamp: new Date().toISOString()
};
this.saveConsent(consent);
this.hideBanner();
this.applyConsent(consent);
this.showNotification('Alle Cookies wurden akzeptiert.', 'success');
},
/**
* Nur essenzielle Cookies akzeptieren
*/
acceptEssential: function() {
const consent = {
essential: true,
analytics: false,
marketing: false,
timestamp: new Date().toISOString()
};
this.saveConsent(consent);
this.hideBanner();
this.applyConsent(consent);
this.showNotification('Nur notwendige Cookies wurden akzeptiert.', 'info');
},
/**
* Einstellungen speichern
*/
saveSettings: function() {
const consent = {
essential: true,
analytics: analyticsCheckbox ? analyticsCheckbox.checked : false,
marketing: marketingCheckbox ? marketingCheckbox.checked : false,
timestamp: new Date().toISOString()
};
this.saveConsent(consent);
this.hideSettings();
this.hideBanner();
this.applyConsent(consent);
this.showNotification('Cookie-Einstellungen wurden gespeichert.', 'success');
},
/**
* Consent im Cookie speichern
*/
saveConsent: function(consent) {
CookieUtils.set(COOKIE_NAME, consent, COOKIE_EXPIRY_DAYS);
},
/**
* Consent aus Cookie lesen
*/
getConsent: function() {
return CookieUtils.get(COOKIE_NAME);
},
/**
* Consent anwenden (z.B. Analytics laden)
*/
applyConsent: function(consent) {
// Dispatch Custom Event für andere Scripts
window.dispatchEvent(new CustomEvent('cookieConsentUpdated', {
detail: consent
}));
// Analytics aktivieren/deaktivieren
if (consent.analytics) {
this.enableAnalytics();
} else {
this.disableAnalytics();
}
// Marketing aktivieren/deaktivieren
if (consent.marketing) {
this.enableMarketing();
} else {
this.disableMarketing();
}
},
/**
* Analytics aktivieren (Placeholder für z.B. Google Analytics)
*/
enableAnalytics: function() {
// Hier können Analytics-Scripts geladen werden
// Beispiel für Google Analytics:
// if (typeof gtag === 'undefined') {
// const script = document.createElement('script');
// script.src = 'https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_ID';
// script.async = true;
// document.head.appendChild(script);
// }
console.log('Analytics enabled');
},
/**
* Analytics deaktivieren
*/
disableAnalytics: function() {
// Analytics-Cookies entfernen falls vorhanden
console.log('Analytics disabled');
},
/**
* Marketing aktivieren (Placeholder für Marketing-Tools)
*/
enableMarketing: function() {
console.log('Marketing enabled');
},
/**
* Marketing deaktivieren
*/
disableMarketing: function() {
console.log('Marketing disabled');
},
/**
* Banner anzeigen
*/
showBanner: function() {
if (banner) {
banner.classList.remove('hide');
banner.classList.add('show');
banner.setAttribute('aria-hidden', 'false');
// Fokus auf ersten Button setzen für Accessibility
setTimeout(() => {
if (acceptAllBtn) acceptAllBtn.focus();
}, 100);
}
},
/**
* Banner verstecken
*/
hideBanner: function() {
if (banner) {
banner.classList.remove('show');
banner.classList.add('hide');
banner.setAttribute('aria-hidden', 'true');
}
},
/**
* Einstellungen-Panel anzeigen
*/
showSettings: function() {
if (settingsPanel) {
// Aktuelle Einstellungen in Checkboxen laden
const consent = this.getConsent() || this.defaultConsent;
if (analyticsCheckbox) analyticsCheckbox.checked = consent.analytics;
if (marketingCheckbox) marketingCheckbox.checked = consent.marketing;
settingsPanel.style.display = 'block';
settingsPanel.setAttribute('aria-hidden', 'false');
}
},
/**
* Einstellungen-Panel verstecken
*/
hideSettings: function() {
if (settingsPanel) {
settingsPanel.style.display = 'none';
settingsPanel.setAttribute('aria-hidden', 'true');
}
},
/**
* Notification anzeigen (nutzt HexaHost-Notification-System falls verfügbar)
*/
showNotification: function(message, type) {
if (window.HexaHost && typeof window.HexaHost.showNotification === 'function') {
window.HexaHost.showNotification(message, type);
}
},
/**
* Consent zurücksetzen (für Datenschutz-Link)
*/
resetConsent: function() {
CookieUtils.delete(COOKIE_NAME);
this.showBanner();
if (settingsPanel) settingsPanel.style.display = 'none';
}
};
// Initialisierung wenn DOM geladen
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', () => CookieConsent.init());
} else {
CookieConsent.init();
}
// Globaler Zugriff für manuelle Steuerung
window.CookieConsent = CookieConsent;
})();

View File

@@ -1,310 +0,0 @@
// Main JavaScript for HexaHost.de
(function() {
'use strict';
// DOM Elements
const navToggle = document.querySelector('.nav-toggle');
const navMenu = document.querySelector('.nav-menu');
const navLinks = document.querySelectorAll('.nav-link');
const glassCards = document.querySelectorAll('.glass-card');
const productCards = document.querySelectorAll('.product-card');
// Mobile Navigation Toggle
if (navToggle && navMenu) {
navToggle.addEventListener('click', function() {
navMenu.classList.toggle('active');
navToggle.classList.toggle('active');
});
// Close mobile menu when clicking on a link
navLinks.forEach(link => {
link.addEventListener('click', function() {
navMenu.classList.remove('active');
navToggle.classList.remove('active');
});
});
}
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function(e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
if (target) {
target.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
});
});
// Enhanced glass card hover effects
glassCards.forEach(card => {
card.addEventListener('mouseenter', function() {
this.style.transform = 'translateY(-8px) scale(1.02)';
});
card.addEventListener('mouseleave', function() {
this.style.transform = 'translateY(0) scale(1)';
});
});
// Product card interactive effects
productCards.forEach(card => {
card.addEventListener('mouseenter', function() {
if (!this.classList.contains('featured')) {
this.style.transform = 'translateY(-10px) scale(1.03)';
}
});
card.addEventListener('mouseleave', function() {
if (!this.classList.contains('featured')) {
this.style.transform = 'translateY(0) scale(1)';
}
});
});
// Intersection Observer for animations
const observerOptions = {
threshold: 0.1,
rootMargin: '0px 0px -50px 0px'
};
const observer = new IntersectionObserver(function(entries) {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('animate-in');
}
});
}, observerOptions);
// Observe elements for animation
const animateElements = document.querySelectorAll('.glass-card, .feature-item, .product-card');
animateElements.forEach(el => {
observer.observe(el);
});
// Header scroll effect - always visible with transparency change
const header = document.querySelector('.header');
const hero = document.querySelector('.hero');
// Kombinierter, optimierter Scroll-Handler mit requestAnimationFrame
let ticking = false;
function handleScroll() {
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
// Header-Effekt
if (header) {
if (scrollTop > 50) {
header.classList.add('scrolled');
} else {
header.classList.remove('scrolled');
}
}
// Parallax-Effekt für Hero
if (hero) {
const rate = scrollTop * -0.5;
hero.style.transform = `translateY(${rate}px)`;
}
ticking = false;
}
window.addEventListener('scroll', function() {
if (!ticking) {
requestAnimationFrame(handleScroll);
ticking = true;
}
}, { passive: true });
// Form validation (for contact forms)
const forms = document.querySelectorAll('form');
forms.forEach(form => {
form.addEventListener('submit', function(e) {
const requiredFields = form.querySelectorAll('[required]');
let isValid = true;
requiredFields.forEach(field => {
if (!field.value.trim()) {
isValid = false;
field.classList.add('error');
// Remove error class on focus
field.addEventListener('focus', function() {
this.classList.remove('error');
}, { once: true });
}
});
if (!isValid) {
e.preventDefault();
showNotification('Bitte füllen Sie alle Pflichtfelder aus.', 'error');
}
});
});
// Notification system
function showNotification(message, type = 'info') {
const notification = document.createElement('div');
notification.className = `notification notification-${type}`;
notification.textContent = message;
notification.style.position = 'fixed';
notification.style.top = '20px';
notification.style.right = '20px';
notification.style.padding = '15px 20px';
notification.style.borderRadius = '8px';
notification.style.color = 'white';
notification.style.fontWeight = '500';
notification.style.zIndex = '9999';
notification.style.transform = 'translateX(400px)';
notification.style.transition = 'transform 0.3s ease-in-out';
if (type === 'error') {
notification.style.background = 'linear-gradient(135deg, #ef4444, #dc2626)';
} else if (type === 'success') {
notification.style.background = 'linear-gradient(135deg, #10b981, #059669)';
} else {
notification.style.background = 'linear-gradient(135deg, #3b82f6, #2563eb)';
}
document.body.appendChild(notification);
// Animate in
setTimeout(() => {
notification.style.transform = 'translateX(0)';
}, 100);
// Remove after 5 seconds
setTimeout(() => {
notification.style.transform = 'translateX(400px)';
setTimeout(() => {
if (notification.parentNode) {
notification.parentNode.removeChild(notification);
}
}, 300);
}, 5000);
}
// Lazy loading for images
const images = document.querySelectorAll('img[data-src]');
const imageObserver = new IntersectionObserver((entries, observer) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
const img = entry.target;
img.src = img.dataset.src;
img.classList.remove('lazy');
imageObserver.unobserve(img);
}
});
});
images.forEach(img => imageObserver.observe(img));
// Performance optimization: Debounce scroll events
function debounce(func, wait) {
let timeout;
return function executedFunction(...args) {
const later = () => {
clearTimeout(timeout);
func(...args);
};
clearTimeout(timeout);
timeout = setTimeout(later, wait);
};
}
// Apply debounce to scroll events
const debouncedScrollHandler = debounce(function() {
// Any scroll-based animations or calculations
updateScrollProgress();
}, 16); // ~60fps
window.addEventListener('scroll', debouncedScrollHandler);
// Scroll progress indicator
function updateScrollProgress() {
const scrollTop = window.pageYOffset;
const docHeight = document.body.scrollHeight - window.innerHeight;
const scrollPercent = (scrollTop / docHeight) * 100;
// You can use this to show a progress bar
document.documentElement.style.setProperty('--scroll-progress', scrollPercent + '%');
}
// Dark mode toggle (future feature)
function initDarkMode() {
const darkModeToggle = document.querySelector('.dark-mode-toggle');
if (darkModeToggle) {
darkModeToggle.addEventListener('click', function() {
document.body.classList.toggle('dark-mode');
localStorage.setItem('darkMode', document.body.classList.contains('dark-mode'));
});
// Check for saved dark mode preference
if (localStorage.getItem('darkMode') === 'true') {
document.body.classList.add('dark-mode');
}
}
}
// FAQ Accordion functionality
function initFAQ() {
const faqItems = document.querySelectorAll('.faq-item');
faqItems.forEach(item => {
const question = item.querySelector('.faq-question');
const answer = item.querySelector('.faq-answer');
if (question && answer) {
question.addEventListener('click', function() {
// Close all other FAQ items
faqItems.forEach(otherItem => {
if (otherItem !== item && otherItem.classList.contains('open')) {
otherItem.classList.remove('open');
const otherAnswer = otherItem.querySelector('.faq-answer');
if (otherAnswer) {
otherAnswer.style.maxHeight = null;
}
}
});
// Toggle current item
item.classList.toggle('open');
if (item.classList.contains('open')) {
answer.style.maxHeight = answer.scrollHeight + 'px';
} else {
answer.style.maxHeight = null;
}
});
}
});
}
// Initialize all features when DOM is loaded
document.addEventListener('DOMContentLoaded', function() {
initDarkMode();
initFAQ();
// Add loading animation complete class
document.body.classList.add('loaded');
// Show welcome message on first visit
if (!localStorage.getItem('hasVisited')) {
setTimeout(() => {
showNotification('Willkommen bei HexaHost.de! 🚀', 'success');
localStorage.setItem('hasVisited', 'true');
}, 1000);
}
});
// Export functions for global access if needed
window.HexaHost = {
showNotification: showNotification
};
})();

View File

@@ -1,171 +0,0 @@
<?php
/**
* HexaHost.de SMTP Konfiguration
*
* WICHTIG: Ändern Sie diese Werte entsprechend Ihren SMTP-Einstellungen!
*
* Beispiele für verschiedene E-Mail-Provider:
*
* Gmail:
* - smtp_host: smtp.gmail.com
* - smtp_port: 587
* - smtp_encryption: tls
*
* Outlook/Hotmail:
* - smtp_host: smtp-mail.outlook.com
* - smtp_port: 587
* - smtp_encryption: tls
*
* GMX:
* - smtp_host: mail.gmx.net
* - smtp_port: 587
* - smtp_encryption: tls
*
* Web.de:
* - smtp_host: smtp.web.de
* - smtp_port: 587
* - smtp_encryption: tls
*
* Eigener Mail-Server:
* - smtp_host: mail.ihre-domain.de
* - smtp_port: 587 (oder 465 für SSL)
* - smtp_encryption: tls (oder ssl)
*/
// SMTP Konfiguration - HIER IHRE WERTE EINTRAGEN
$smtp_config = [
// SMTP Server-Einstellungen
'smtp_host' => 'smtp.gmail.com', // z.B. smtp.gmail.com
'smtp_port' => 587, // 587 für TLS, 465 für SSL
'smtp_username' => 'test@hexahost.de', // z.B. info@hexahost.de
'smtp_password' => 'your-app-password', // Ihr SMTP-Passwort
'smtp_encryption' => 'tls', // 'tls' oder 'ssl'
// Absender-Einstellungen
'from_email' => 'test@hexahost.de', // Absender-E-Mail
'from_name' => 'HexaHost.de Kontaktformular', // Absender-Name
// Empfänger-Einstellungen
'to_email' => 'info@hexahost.de', // Empfänger-E-Mail
'to_name' => 'HexaHost Support', // Empfänger-Name
// Sicherheitseinstellungen
'max_requests_per_hour' => 5, // Max. Anfragen pro Stunde pro IP
'honeypot_field' => 'website', // Verstecktes Feld für Bot-Schutz
// E-Mail-Template-Einstellungen
'email_template' => 'html', // 'html' oder 'text'
'include_ip_address' => true, // IP-Adresse in E-Mail anzeigen
'include_timestamp' => true, // Zeitstempel in E-Mail anzeigen
];
// DNS-Einstellungen für Spam-Schutz (werden über DNS konfiguriert)
$dns_config = [
// SPF Record (TXT Record in DNS)
'spf_record' => 'v=spf1 include:_spf.hexahost.de ~all',
// DMARC Record (TXT Record in DNS)
'dmarc_record' => 'v=DMARC1; p=quarantine; rua=mailto:dmarc@hexahost.de',
// DKIM wird über den Mail-Server konfiguriert
];
// Debug-Einstellungen (nur für Entwicklung)
$debug_config = [
'debug_mode' => false, // Debug-Modus aktivieren
'log_errors' => true, // Fehler loggen
'log_file' => 'contact_form_errors.log', // Log-Datei
];
// Exportiere Konfiguration für andere Dateien
if (!defined('HEXAHOST_CONFIG_LOADED')) {
define('HEXAHOST_CONFIG_LOADED', true);
// Globale Variablen für andere Dateien
$GLOBALS['hexahost_smtp_config'] = $smtp_config;
$GLOBALS['hexahost_dns_config'] = $dns_config;
$GLOBALS['hexahost_debug_config'] = $debug_config;
}
// Hilfsfunktion zum Abrufen der Konfiguration
function getHexaHostConfig($key = null) {
global $smtp_config, $dns_config, $debug_config;
if ($key === null) {
return array_merge($smtp_config, $dns_config, $debug_config);
}
if (isset($smtp_config[$key])) {
return $smtp_config[$key];
}
if (isset($dns_config[$key])) {
return $dns_config[$key];
}
if (isset($debug_config[$key])) {
return $debug_config[$key];
}
return null;
}
// Debug-Funktion
function hexahostDebug($message, $type = 'info') {
global $debug_config;
if (!$debug_config['debug_mode']) {
return;
}
$timestamp = date('Y-m-d H:i:s');
$log_message = "[$timestamp] [$type] $message" . PHP_EOL;
if ($debug_config['log_errors']) {
error_log($log_message, 3, $debug_config['log_file']);
}
if ($debug_config['debug_mode']) {
echo "<!-- HexaHost Debug: $message -->\n";
}
}
// Validierung der SMTP-Konfiguration
function validateSMTPConfig() {
$config = getHexaHostConfig();
$errors = [];
// Prüfe ob alle erforderlichen Felder ausgefüllt sind
$required_fields = ['smtp_host', 'smtp_username', 'smtp_password', 'from_email', 'to_email'];
foreach ($required_fields as $field) {
if (empty($config[$field]) || $config[$field] === 'YOUR_SMTP_' . strtoupper(substr($field, 5))) {
$errors[] = "Konfigurationsfehler: $field ist nicht korrekt eingestellt.";
}
}
// Prüfe SMTP-Port
if (!is_numeric($config['smtp_port']) || $config['smtp_port'] < 1 || $config['smtp_port'] > 65535) {
$errors[] = "Konfigurationsfehler: Ungültiger SMTP-Port.";
}
// Prüfe E-Mail-Format
if (!filter_var($config['from_email'], FILTER_VALIDATE_EMAIL)) {
$errors[] = "Konfigurationsfehler: Ungültige Absender-E-Mail.";
}
if (!filter_var($config['to_email'], FILTER_VALIDATE_EMAIL)) {
$errors[] = "Konfigurationsfehler: Ungültige Empfänger-E-Mail.";
}
return $errors;
}
// Zeige Konfigurationsfehler an (nur im Debug-Modus)
if (getHexaHostConfig('debug_mode')) {
$config_errors = validateSMTPConfig();
if (!empty($config_errors)) {
hexahostDebug('SMTP-Konfigurationsfehler: ' . implode(', ', $config_errors), 'error');
}
}
?>

View File

@@ -1,155 +0,0 @@
<?php
/**
* HexaHost.de Mail Configuration
*
* Bitte passen Sie die folgenden SMTP-Einstellungen an Ihre E-Mail-Provider an.
*
* Beispiele für gängige Provider:
*
* Gmail:
* - SMTP_HOST = 'smtp.gmail.com'
* - SMTP_PORT = 587
* - SMTP_USERNAME = 'ihre-email@gmail.com'
* - SMTP_PASSWORD = 'ihr-app-passwort'
*
* Outlook/Hotmail:
* - SMTP_HOST = 'smtp-mail.outlook.com'
* - SMTP_PORT = 587
*
* GMX:
* - SMTP_HOST = 'mail.gmx.net'
* - SMTP_PORT = 587
*
* Web.de:
* - SMTP_HOST = 'smtp.web.de'
* - SMTP_PORT = 587
*
* 1&1:
* - SMTP_HOST = 'smtp.1und1.de'
* - SMTP_PORT = 587
*
* Strato:
* - SMTP_HOST = 'smtp.strato.de'
* - SMTP_PORT = 587
*
* Ionos:
* - SMTP_HOST = 'smtp.ionos.de'
* - SMTP_PORT = 587
*/
// SMTP Server Einstellungen
define('SMTP_HOST', 'smtp.ihre-domain.de'); // Ihr SMTP-Server
define('SMTP_PORT', 587); // SMTP-Port (meist 587 oder 465)
define('SMTP_USERNAME', 'kontakt@ihre-domain.de'); // Ihr SMTP-Benutzername
define('SMTP_PASSWORD', 'ihr-smtp-passwort'); // Ihr SMTP-Passwort
// E-Mail Adressen
define('SMTP_FROM_EMAIL', 'kontakt@hexahost.de'); // Absender-E-Mail (muss zu SMTP_USERNAME passen)
define('SMTP_TO_EMAIL', 'info@hexahost.de'); // Empfänger-E-Mail für Kontaktformular
// Sicherheitseinstellungen
define('ENABLE_CSRF_PROTECTION', true); // CSRF-Schutz aktivieren
define('ENABLE_RATE_LIMITING', true); // Rate-Limiting aktivieren
define('MAX_REQUESTS_PER_HOUR', 10); // Max. Anfragen pro Stunde
// Spam-Schutz Einstellungen
define('ENABLE_SPAM_PROTECTION', true); // Spam-Schutz aktivieren
define('MAX_MESSAGE_LENGTH', 5000); // Max. Nachrichtenlänge
define('MIN_MESSAGE_LENGTH', 10); // Min. Nachrichtenlänge
// Debug-Einstellungen (nur für Entwicklung)
define('DEBUG_MODE', false); // Debug-Modus (true/false)
define('LOG_EMAILS', true); // E-Mails loggen (true/false)
// Zusätzliche Sicherheitsheader
define('ADDITIONAL_HEADERS', [
'X-Mailer' => 'HexaHost.de Contact Form',
'X-Priority' => '3',
'X-MSMail-Priority' => 'Normal',
'Importance' => 'Normal',
'X-Report-Abuse' => 'Please report abuse here: abuse@hexahost.de',
'List-Unsubscribe' => '<mailto:unsubscribe@hexahost.de>',
'Precedence' => 'bulk'
]);
// Erlaubte Domains für E-Mail-Adressen (optional)
define('ALLOWED_EMAIL_DOMAINS', [
// Leer lassen für alle Domains zu erlauben
// 'gmail.com',
// 'outlook.com',
// 'web.de',
// 'gmx.de'
]);
// Blacklist für E-Mail-Adressen (optional)
define('BLACKLISTED_EMAILS', [
// 'spam@example.com',
// 'test@test.com'
]);
// Validierung der Konfiguration
if (!defined('SMTP_HOST') || !defined('SMTP_USERNAME') || !defined('SMTP_PASSWORD')) {
die('SMTP-Konfiguration ist unvollständig. Bitte überprüfen Sie die mail-config.php');
}
// Überprüfung der E-Mail-Adressen
if (!filter_var(SMTP_FROM_EMAIL, FILTER_VALIDATE_EMAIL)) {
die('Ungültige SMTP_FROM_EMAIL Adresse');
}
if (!filter_var(SMTP_TO_EMAIL, FILTER_VALIDATE_EMAIL)) {
die('Ungültige SMTP_TO_EMAIL Adresse');
}
// Logging-Funktion
function logEmail($type, $data) {
if (!LOG_EMAILS) return;
$logFile = __DIR__ . '/../logs/email.log';
$logDir = dirname($logFile);
if (!is_dir($logDir)) {
mkdir($logDir, 0755, true);
}
$timestamp = date('Y-m-d H:i:s');
$logEntry = "[$timestamp] $type: " . json_encode($data) . "\n";
file_put_contents($logFile, $logEntry, FILE_APPEND | LOCK_EX);
}
// Hilfsfunktion für E-Mail-Validierung
function isValidEmail($email) {
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
return false;
}
// Prüfe Blacklist
if (in_array($email, BLACKLISTED_EMAILS)) {
return false;
}
// Prüfe Domain-Whitelist (falls gesetzt)
if (!empty(ALLOWED_EMAIL_DOMAINS)) {
$domain = substr(strrchr($email, "@"), 1);
if (!in_array($domain, ALLOWED_EMAIL_DOMAINS)) {
return false;
}
}
return true;
}
// CSRF Token generieren
function generateCSRFToken() {
if (!isset($_SESSION['csrf_token'])) {
$_SESSION['csrf_token'] = bin2hex(random_bytes(32));
}
return $_SESSION['csrf_token'];
}
// CSRF Token validieren
function validateCSRFToken($token) {
return isset($_SESSION['csrf_token']) && hash_equals($_SESSION['csrf_token'], $token);
}
?>

View File

@@ -1,131 +0,0 @@
<footer class="footer">
<div class="container">
<div class="footer-content">
<div class="footer-section">
<h4>HexaHost.de</h4>
<p>Zuverlässiges Hosting aus Niederbayern</p>
<div class="footer-location">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/>
<circle cx="12" cy="10" r="3"/>
</svg>
<span>Niederbayern, Deutschland</span>
</div>
</div>
<div class="footer-section">
<h4>Produkte</h4>
<ul>
<li><a href="/vpc">Virtual Private Container</a></li>
<li><a href="/vps">Virtual Private Server</a></li>
<li><a href="/mail-gateway">Mail Gateway</a></li>
<li><a href="/webhosting">Webhosting</a></li>
</ul>
</div>
<div class="footer-section">
<h4>Unternehmen</h4>
<ul>
<li><a href="/about">Über uns</a></li>
<li><a href="/contact">Kontakt</a></li>
<li><a href="/impressum">Impressum</a></li>
<li><a href="/datenschutz">Datenschutz</a></li>
<li><a href="/agb">AGB</a></li>
<li><a href="#" id="openCookieSettings" onclick="CookieConsent.resetConsent(); return false;">Cookie-Einstellungen</a></li>
</ul>
</div>
<div class="footer-section">
<h4>Support</h4>
<ul>
<li><a href="https://shop.hexahost.de/clientarea.php">Kunden-Center</a></li>
<li><a href="https://shop.hexahost.de/serverstatus.php">Status</a></li>
<li><a href="https://shop.hexahost.de/supporttickets.php">Support-Ticket</a></li>
<li><a href="#">FAQ</a></li>
</ul>
</div>
</div>
<div class="footer-bottom">
<p>&copy; <?php echo date('Y'); ?> HexaHost.de - Alle Rechte vorbehalten</p>
</div>
</div>
</footer>
<!-- Cookie Consent Banner -->
<div id="cookieConsent" class="cookie-consent" role="dialog" aria-labelledby="cookieConsentTitle" aria-describedby="cookieConsentDesc">
<div class="cookie-consent-container">
<div class="cookie-consent-content">
<div class="cookie-consent-icon">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10"/>
<circle cx="8" cy="9" r="1" fill="currentColor"/>
<circle cx="15" cy="8" r="1" fill="currentColor"/>
<circle cx="10" cy="14" r="1" fill="currentColor"/>
<circle cx="16" cy="13" r="1" fill="currentColor"/>
<circle cx="13" cy="17" r="1" fill="currentColor"/>
</svg>
</div>
<div class="cookie-consent-text">
<h3 id="cookieConsentTitle">Cookie-Einstellungen</h3>
<p id="cookieConsentDesc">
Wir verwenden Cookies, um Ihnen die bestmögliche Erfahrung auf unserer Website zu bieten.
Technisch notwendige Cookies sind für die Funktionalität erforderlich.
<a href="/datenschutz">Mehr erfahren</a>
</p>
</div>
</div>
<div class="cookie-consent-actions">
<button type="button" id="cookieAcceptAll" class="btn btn-primary">Alle akzeptieren</button>
<button type="button" id="cookieAcceptEssential" class="btn btn-secondary">Nur notwendige</button>
<button type="button" id="cookieSettings" class="btn btn-text">Einstellungen</button>
</div>
</div>
<!-- Erweiterte Cookie-Einstellungen (standardmäßig versteckt) -->
<div id="cookieSettingsPanel" class="cookie-settings-panel" style="display: none;">
<div class="cookie-settings-content">
<h4>Cookie-Einstellungen</h4>
<div class="cookie-option">
<div class="cookie-option-info">
<strong>Notwendige Cookies</strong>
<p>Diese Cookies sind für die Grundfunktionen der Website erforderlich.</p>
</div>
<label class="cookie-toggle disabled">
<input type="checkbox" checked disabled>
<span class="cookie-toggle-slider"></span>
</label>
</div>
<div class="cookie-option">
<div class="cookie-option-info">
<strong>Analyse-Cookies</strong>
<p>Helfen uns zu verstehen, wie Besucher unsere Website nutzen.</p>
</div>
<label class="cookie-toggle">
<input type="checkbox" id="cookieAnalytics">
<span class="cookie-toggle-slider"></span>
</label>
</div>
<div class="cookie-option">
<div class="cookie-option-info">
<strong>Marketing-Cookies</strong>
<p>Werden verwendet, um relevante Werbung anzuzeigen.</p>
</div>
<label class="cookie-toggle">
<input type="checkbox" id="cookieMarketing">
<span class="cookie-toggle-slider"></span>
</label>
</div>
<div class="cookie-settings-actions">
<button type="button" id="cookieSaveSettings" class="btn btn-primary">Einstellungen speichern</button>
<button type="button" id="cookieCloseSettings" class="btn btn-secondary">Abbrechen</button>
</div>
</div>
</div>
</div>
<script src="assets/js/main.js" defer></script>
<script src="assets/js/cookie-consent.js" defer></script>
<?php if (isset($additional_scripts)): ?>
<?php foreach ($additional_scripts as $script): ?>
<script src="<?php echo $script; ?>" defer></script>
<?php endforeach; ?>
<?php endif; ?>
</body>
</html>

View File

@@ -1,98 +0,0 @@
<?php
/**
* Helper functions for HexaHost.de
*/
// Sichere Session-Konfiguration
if (session_status() === PHP_SESSION_NONE) {
// Session-Cookie-Sicherheit
ini_set('session.cookie_httponly', 1);
ini_set('session.cookie_secure', isset($_SERVER['HTTPS']) ? 1 : 0);
ini_set('session.cookie_samesite', 'Strict');
ini_set('session.use_strict_mode', 1);
ini_set('session.use_only_cookies', 1);
session_start();
// Session-ID regenerieren bei Login/wichtigen Aktionen (Schutz vor Session Fixation)
if (!isset($_SESSION['initiated'])) {
session_regenerate_id(true);
$_SESSION['initiated'] = true;
}
}
// PHP Error Display in Produktion deaktivieren
if (!defined('DEBUG_MODE') || !DEBUG_MODE) {
ini_set('display_errors', 0);
ini_set('display_startup_errors', 0);
error_reporting(E_ALL);
ini_set('log_errors', 1);
}
/**
* Set page configuration and include header
*
* @param string $title The page title
* @param string $description The page description
* @param string $page The current page identifier
* @param array $scripts Additional scripts to include
*/
function includeHeader($title = '', $description = '', $page = '', $scripts = []) {
global $page_title, $page_description, $current_page, $additional_scripts;
// Set page configuration from parameters
$page_title = !empty($title)
? $title
: 'HexaHost.de - Zuverlässiges Hosting aus Niederbayern';
$page_description = !empty($description)
? $description
: 'HexaHost.de - Zuverlässiges und preiswertes Hosting aus Niederbayern. VPS, VPC, Mail Gateway und Webhosting Lösungen.';
$current_page = $page;
$additional_scripts = $scripts;
include 'includes/header.php';
}
/**
* Include footer
*/
function includeFooter() {
include 'includes/footer.php';
}
/**
* Generate breadcrumb navigation
*
* @param array $breadcrumbs Array of breadcrumb items [['title' => 'Home', 'url' => 'index.html'], ...]
*/
function generateBreadcrumbs($breadcrumbs) {
echo '<div class="breadcrumb">';
$last_index = count($breadcrumbs) - 1;
foreach ($breadcrumbs as $index => $item) {
if ($index === $last_index) {
// Last item (current page)
echo '<span>' . htmlspecialchars($item['title']) . '</span>';
} else {
// Link to other pages
echo '<a href="' . htmlspecialchars($item['url']) . '">' . htmlspecialchars($item['title']) . '</a>';
echo '<span>/</span>';
}
}
echo '</div>';
}
/**
* Generate CSRF token for form security
*
* @return string CSRF token
*/
function generateCSRFToken() {
if (!isset($_SESSION['csrf_token'])) {
$_SESSION['csrf_token'] = bin2hex(random_bytes(32));
}
return $_SESSION['csrf_token'];
}
?>

View File

@@ -1,79 +0,0 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Performance: DNS Prefetch & Preconnect -->
<link rel="dns-prefetch" href="//fonts.googleapis.com">
<link rel="dns-prefetch" href="//fonts.gstatic.com">
<link rel="dns-prefetch" href="//cdn.hexahost.de">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="preconnect" href="https://cdn.hexahost.de" crossorigin>
<!-- Performance: Preload kritischer Ressourcen -->
<link rel="preload" href="assets/css/style.css" as="style">
<link rel="preload" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" as="style">
<title><?php echo isset($page_title) ? htmlspecialchars($page_title) : 'HexaHost.de - Zuverlässiges Hosting aus Niederbayern'; ?></title>
<!-- SEO Meta Tags -->
<meta name="description" content="<?php echo isset($page_description) ? htmlspecialchars($page_description) : 'HexaHost.de - Zuverlässiges und preiswertes Hosting aus Niederbayern. VPS, VPC, Mail Gateway und Webhosting Lösungen.'; ?>">
<meta name="robots" content="index, follow">
<meta name="author" content="HexaHost.de">
<meta name="theme-color" content="#0d0821">
<!-- Open Graph / Social Media -->
<meta property="og:type" content="website">
<meta property="og:site_name" content="HexaHost.de">
<meta property="og:title" content="<?php echo isset($page_title) ? htmlspecialchars($page_title) : 'HexaHost.de'; ?>">
<meta property="og:description" content="<?php echo isset($page_description) ? htmlspecialchars($page_description) : 'Zuverlässiges Hosting aus Niederbayern'; ?>">
<meta property="og:locale" content="de_DE">
<!-- Main Stylesheet -->
<link rel="stylesheet" href="assets/css/style.css">
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Russo+One&family=Source+Sans+Pro:wght@300;400;600;700&display=swap" rel="stylesheet">
<!-- Favicon -->
<link rel="icon" type="image/svg+xml" href="favicon.svg">
<link rel="apple-touch-icon" href="favicon.svg">
<!-- Canonical URL (falls gesetzt) -->
<?php if (isset($canonical_url)): ?>
<link rel="canonical" href="<?php echo htmlspecialchars($canonical_url); ?>">
<?php endif; ?>
</head>
<body>
<header class="header">
<nav class="nav">
<div class="nav-container">
<div class="nav-logo">
<a href="/">
<img src="https://cdn.hexahost.de/assets/img/logo/8iFs123BynHQWHI5.png" alt="HexaHost.de Logo" class="logo-image">
</a>
</div>
<ul class="nav-menu">
<li><a href="/" class="nav-link <?php echo ($current_page === 'home') ? 'active' : ''; ?>">Home</a></li>
<li class="nav-dropdown">
<a href="#" class="nav-link <?php echo (in_array($current_page, ['vpc', 'vps', 'mail-gateway', 'webhosting'])) ? 'active' : ''; ?>">Produkte</a>
<ul class="dropdown-menu">
<li><a href="/vpc" class="<?php echo ($current_page === 'vpc') ? 'active' : ''; ?>">Virtual Private Container</a></li>
<li><a href="/vps" class="<?php echo ($current_page === 'vps') ? 'active' : ''; ?>">Virtual Private Server</a></li>
<li><a href="/mail-gateway" class="<?php echo ($current_page === 'mail-gateway') ? 'active' : ''; ?>">Mail Gateway</a></li>
<li><a href="/webhosting" class="<?php echo ($current_page === 'webhosting') ? 'active' : ''; ?>">Webhosting</a></li>
</ul>
</li>
<li><a href="/about" class="nav-link <?php echo ($current_page === 'about') ? 'active' : ''; ?>">Über uns</a></li>
<li><a href="/contact" class="nav-link <?php echo ($current_page === 'contact') ? 'active' : ''; ?>">Kontakt</a></li>
</ul>
<div class="nav-toggle">
<span></span>
<span></span>
<span></span>
</div>
</div>
</nav>
</header>

1686
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,26 +0,0 @@
{
"name": "hexahost-backend",
"version": "1.0.0",
"description": "HexaHost.de Backend - Build-System für Obfuscation und Minification",
"scripts": {
"build": "node scripts/build.js",
"build:js": "node scripts/build.js --js-only",
"build:css": "node scripts/build.js --css-only",
"clean": "rm -rf dist",
"watch": "node scripts/watch.js"
},
"devDependencies": {
"javascript-obfuscator": "^4.1.1",
"clean-css": "^5.3.3",
"chokidar": "^3.6.0",
"chalk": "^4.1.2"
},
"keywords": [
"hexahost",
"obfuscation",
"minification",
"build"
],
"author": "HexaHost.de",
"license": "LGPL-2.1"
}

View File

@@ -1,293 +0,0 @@
#!/usr/bin/env node
/**
* HexaHost.de Build Script
*
* Obfusciert JavaScript und minifiziert CSS für die Produktion
*
* Verwendung:
* npm run build - Alles bauen
* npm run build:js - Nur JavaScript
* npm run build:css - Nur CSS
*/
const fs = require('fs');
const path = require('path');
const JavaScriptObfuscator = require('javascript-obfuscator');
const CleanCSS = require('clean-css');
// Konfiguration
const config = {
srcDir: path.join(__dirname, '..'),
distDir: path.join(__dirname, '..', 'dist'),
// JavaScript-Dateien zum Obfuscieren
jsFiles: [
'assets/js/main.js',
'assets/js/contact.js',
'assets/js/cookie-consent.js'
],
// CSS-Dateien zum Minifizieren
cssFiles: [
'assets/css/style.css'
],
// PHP-Dateien (nur kopieren)
phpFiles: [
'config/config.php',
'config/mail-config.php',
'includes/header.php',
'includes/footer.php',
'includes/functions.php'
],
// JavaScript Obfuscator Optionen
jsObfuscatorOptions: {
compact: true,
controlFlowFlattening: true,
controlFlowFlatteningThreshold: 0.7,
deadCodeInjection: true,
deadCodeInjectionThreshold: 0.4,
debugProtection: false,
disableConsoleOutput: true,
identifierNamesGenerator: 'hexadecimal',
log: false,
numbersToExpressions: true,
renameGlobals: false,
selfDefending: true,
simplify: true,
splitStrings: true,
splitStringsChunkLength: 10,
stringArray: true,
stringArrayCallsTransform: true,
stringArrayEncoding: ['base64'],
stringArrayIndexShift: true,
stringArrayRotate: true,
stringArrayShuffle: true,
stringArrayWrappersCount: 2,
stringArrayWrappersChainedCalls: true,
stringArrayWrappersParametersMaxCount: 4,
stringArrayWrappersType: 'function',
stringArrayThreshold: 0.75,
transformObjectKeys: true,
unicodeEscapeSequence: false
},
// Clean-CSS Optionen
cssMinifyOptions: {
level: {
1: {
specialComments: 0
},
2: {
mergeMedia: true,
removeEmpty: true,
removeDuplicateFontRules: true,
removeDuplicateMediaBlocks: true,
removeDuplicateRules: true
}
}
}
};
// Hilfsfunktionen
function ensureDir(dir) {
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, { recursive: true });
}
}
function copyFile(src, dest) {
ensureDir(path.dirname(dest));
fs.copyFileSync(src, dest);
}
function formatBytes(bytes) {
if (bytes === 0) return '0 Bytes';
const k = 1024;
const sizes = ['Bytes', 'KB', 'MB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
}
function getCompressionRatio(original, compressed) {
return ((1 - compressed / original) * 100).toFixed(1);
}
// JavaScript obfuscieren
function obfuscateJS(filePath) {
const srcPath = path.join(config.srcDir, filePath);
const destPath = path.join(config.distDir, filePath);
if (!fs.existsSync(srcPath)) {
console.log(` ⚠️ Datei nicht gefunden: ${filePath}`);
return null;
}
const originalCode = fs.readFileSync(srcPath, 'utf8');
const originalSize = Buffer.byteLength(originalCode, 'utf8');
try {
const obfuscatedCode = JavaScriptObfuscator.obfuscate(
originalCode,
config.jsObfuscatorOptions
).getObfuscatedCode();
const obfuscatedSize = Buffer.byteLength(obfuscatedCode, 'utf8');
ensureDir(path.dirname(destPath));
fs.writeFileSync(destPath, obfuscatedCode);
return {
file: filePath,
originalSize,
newSize: obfuscatedSize,
ratio: getCompressionRatio(originalSize, obfuscatedSize)
};
} catch (error) {
console.log(` ❌ Fehler bei ${filePath}: ${error.message}`);
return null;
}
}
// CSS minifizieren
function minifyCSS(filePath) {
const srcPath = path.join(config.srcDir, filePath);
const destPath = path.join(config.distDir, filePath);
if (!fs.existsSync(srcPath)) {
console.log(` ⚠️ Datei nicht gefunden: ${filePath}`);
return null;
}
const originalCode = fs.readFileSync(srcPath, 'utf8');
const originalSize = Buffer.byteLength(originalCode, 'utf8');
try {
const minified = new CleanCSS(config.cssMinifyOptions).minify(originalCode);
if (minified.errors.length > 0) {
console.log(` ❌ Fehler bei ${filePath}: ${minified.errors.join(', ')}`);
return null;
}
const minifiedSize = Buffer.byteLength(minified.styles, 'utf8');
ensureDir(path.dirname(destPath));
fs.writeFileSync(destPath, minified.styles);
return {
file: filePath,
originalSize,
newSize: minifiedSize,
ratio: getCompressionRatio(originalSize, minifiedSize)
};
} catch (error) {
console.log(` ❌ Fehler bei ${filePath}: ${error.message}`);
return null;
}
}
// PHP-Dateien kopieren (keine Obfuscation)
function copyPHP(filePath) {
const srcPath = path.join(config.srcDir, filePath);
const destPath = path.join(config.distDir, filePath);
if (!fs.existsSync(srcPath)) {
console.log(` ⚠️ Datei nicht gefunden: ${filePath}`);
return null;
}
try {
copyFile(srcPath, destPath);
const size = fs.statSync(srcPath).size;
return {
file: filePath,
originalSize: size,
newSize: size,
ratio: '0'
};
} catch (error) {
console.log(` ❌ Fehler bei ${filePath}: ${error.message}`);
return null;
}
}
// Hauptfunktion
function build() {
const args = process.argv.slice(2);
const jsOnly = args.includes('--js-only');
const cssOnly = args.includes('--css-only');
console.log('\n╔════════════════════════════════════════════════════════════╗');
console.log('║ HexaHost.de - Build System ║');
console.log('║ Obfuscation & Minification ║');
console.log('╚════════════════════════════════════════════════════════════╝\n');
// dist-Verzeichnis erstellen/leeren
if (fs.existsSync(config.distDir)) {
fs.rmSync(config.distDir, { recursive: true });
}
ensureDir(config.distDir);
const results = [];
// JavaScript obfuscieren
if (!cssOnly) {
console.log('📦 JavaScript obfuscieren...\n');
config.jsFiles.forEach(file => {
process.stdout.write(`${file}... `);
const result = obfuscateJS(file);
if (result) {
console.log(`✓ (${formatBytes(result.originalSize)}${formatBytes(result.newSize)}, -${result.ratio}%)`);
results.push(result);
}
});
console.log();
}
// CSS minifizieren
if (!jsOnly) {
console.log('🎨 CSS minifizieren...\n');
config.cssFiles.forEach(file => {
process.stdout.write(`${file}... `);
const result = minifyCSS(file);
if (result) {
console.log(`✓ (${formatBytes(result.originalSize)}${formatBytes(result.newSize)}, -${result.ratio}%)`);
results.push(result);
}
});
console.log();
}
// PHP-Dateien kopieren
if (!jsOnly && !cssOnly) {
console.log('📄 PHP-Dateien kopieren...\n');
config.phpFiles.forEach(file => {
process.stdout.write(`${file}... `);
const result = copyPHP(file);
if (result) {
console.log(`✓ (${formatBytes(result.originalSize)})`);
results.push(result);
}
});
console.log();
}
// Zusammenfassung
const totalOriginal = results.reduce((sum, r) => sum + r.originalSize, 0);
const totalNew = results.reduce((sum, r) => sum + r.newSize, 0);
console.log('═══════════════════════════════════════════════════════════════');
console.log(`✅ Build abgeschlossen!`);
console.log(` Dateien: ${results.length}`);
console.log(` Original: ${formatBytes(totalOriginal)}`);
console.log(` Optimiert: ${formatBytes(totalNew)}`);
console.log(` Ersparnis: ${formatBytes(totalOriginal - totalNew)} (${getCompressionRatio(totalOriginal, totalNew)}%)`);
console.log(` Ausgabe: ${config.distDir}`);
console.log('═══════════════════════════════════════════════════════════════\n');
}
// Build starten
build();