feat: remove deprecated AI-optimized deployment script
- Delete deploy_to_hetzner_AI.sh which was superseded by main deployment script - Remove cache-busting implementation for index_noSIG_AIopt.html - Clean up unused SFTP deployment workflow with sshpass authentication
This commit is contained in:
@@ -1,64 +0,0 @@
|
||||
#!/bin/bash
|
||||
# SummitWave deployment with proper cache-busting for CSS/JS
|
||||
|
||||
SERVER="www269.your-server.de"
|
||||
USER="summitb"
|
||||
REMOTE_DIR="public_html"
|
||||
LOCAL_DIR="$(dirname "$0")/src"
|
||||
|
||||
# === PASSWORD FROM ENVIRONMENT VARIABLE ===
|
||||
# export SFTP_PASS='DeinSFTPPasswort'
|
||||
if [ -z "$SFTP_PASS" ]; then
|
||||
echo "Error: Please set the SFTP_PASS environment variable with your password."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# === CHECK sshpass INSTALLATION ===
|
||||
if ! command -v sshpass &> /dev/null; then
|
||||
echo "Error: sshpass is not installed. Install with: sudo apt install sshpass"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# === CREATE TEMPORARY WORKING COPY OF index_noSIG_AIopt.html WITH CACHE-BUSTING ===
|
||||
CACHE_PARAM=$(date +%s) # Timestamp als Cache-Buster
|
||||
TEMP_INDEX=$(mktemp)
|
||||
|
||||
# Nur CSS und JS Links in <link> und <script> anpassen
|
||||
sed -E 's/(href="[^"]+\.css")/\1?v='"$CACHE_PARAM"'/g;
|
||||
s/(src="[^"]+\.js")/\1?v='"$CACHE_PARAM"'/g' \
|
||||
"$LOCAL_DIR/index_noSIG_AIopt.html" > "$TEMP_INDEX"
|
||||
|
||||
# === CREATE TEMPORARY SFTP BATCH FILE ===
|
||||
BATCH_FILE=$(mktemp)
|
||||
cat > "$BATCH_FILE" <<EOF
|
||||
cd $REMOTE_DIR
|
||||
|
||||
# Upload modified index.html as index.html
|
||||
put "$TEMP_INDEX" index.html
|
||||
|
||||
# Upload other static files
|
||||
put "$LOCAL_DIR/impressum.html"
|
||||
put "$LOCAL_DIR/robots.txt"
|
||||
put "$LOCAL_DIR/sitemap.xml"
|
||||
put "$LOCAL_DIR/.htaccess"
|
||||
|
||||
# Ensure img folder exists and upload images
|
||||
mkdir img
|
||||
cd img
|
||||
put "$LOCAL_DIR/img/"*
|
||||
cd ..
|
||||
# Ensure manual folder exists and upload manual page
|
||||
mkdir manual
|
||||
put "$LOCAL_DIR/manual/index.html" manual/index.html
|
||||
|
||||
bye
|
||||
EOF
|
||||
|
||||
# === UPLOAD ALL FILES IN ONE SFTP SESSION ===
|
||||
echo "Uploading website files to $USER@$SERVER:$REMOTE_DIR ..."
|
||||
sshpass -p "$SFTP_PASS" sftp -oBatchMode=no -b "$BATCH_FILE" $USER@$SERVER
|
||||
|
||||
# === CLEANUP ===
|
||||
rm "$BATCH_FILE" "$TEMP_INDEX"
|
||||
|
||||
echo "Deployment complete! Visit your website: http://www.summitwave.eu/?v=$CACHE_PARAM"
|
||||
12
src/manual/auth.config.php
Normal file
12
src/manual/auth.config.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
// Zentrale Benutzerverwaltung
|
||||
// Benutzername => Passwort (Klartext)
|
||||
// Für mehr Sicherheit kann später auf gehashte Passwörter umgestellt werden.
|
||||
return [
|
||||
'users' => [
|
||||
'summitwave_malte' => 'M8uN3fZq!c2Lx9Pt',
|
||||
'summitwave_patrick' => 'S4rK7vBw#h1Dz6Qe',
|
||||
'ellerbrock_konferenztechnik' => 'E9pL2mTy@k5Vg8Rs',
|
||||
],
|
||||
];
|
||||
87
src/manual/auth.php
Normal file
87
src/manual/auth.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
const SW_MANUAL_LOG_FILE = __DIR__ . '/logs/access.log';
|
||||
|
||||
function sw_load_users(): array {
|
||||
$cfgPath = __DIR__ . '/auth.config.php';
|
||||
if (!file_exists($cfgPath)) {
|
||||
return [];
|
||||
}
|
||||
$cfg = require $cfgPath;
|
||||
return $cfg['users'] ?? [];
|
||||
}
|
||||
|
||||
function sw_verify_login(string $username, string $password): bool {
|
||||
$users = sw_load_users();
|
||||
if (!isset($users[$username])) {
|
||||
return false;
|
||||
}
|
||||
$expected = (string)$users[$username];
|
||||
return hash_equals($expected, $password);
|
||||
}
|
||||
|
||||
function sw_current_user(): ?string {
|
||||
return $_SESSION['sw_manual_user'] ?? null;
|
||||
}
|
||||
|
||||
function sw_require_login(): void {
|
||||
if (!sw_current_user()) {
|
||||
header('Location: login.php');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
function sw_record_login(string $username): void {
|
||||
$dir = dirname(SW_MANUAL_LOG_FILE);
|
||||
if (!is_dir($dir)) {
|
||||
@mkdir($dir, 0775, true);
|
||||
}
|
||||
$ts = (new DateTimeImmutable('now', new DateTimeZone('Europe/Berlin')))->format(DateTimeInterface::ATOM);
|
||||
$ip = $_SERVER['REMOTE_ADDR'] ?? '-';
|
||||
$ua = $_SERVER['HTTP_USER_AGENT'] ?? '-';
|
||||
$line = $ts . ';' . $username . ';' . $ip . ';' . str_replace("\n", ' ', $ua) . "\n";
|
||||
@file_put_contents(SW_MANUAL_LOG_FILE, $line, FILE_APPEND | LOCK_EX);
|
||||
}
|
||||
|
||||
function sw_last_login_for_user(string $username): ?DateTimeImmutable {
|
||||
if (!file_exists(SW_MANUAL_LOG_FILE)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$fh = @fopen(SW_MANUAL_LOG_FILE, 'r');
|
||||
if (!$fh) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$last = null;
|
||||
while (($line = fgets($fh)) !== false) {
|
||||
$parts = explode(';', trim($line));
|
||||
if (count($parts) < 2) {
|
||||
continue;
|
||||
}
|
||||
[$ts, $user] = $parts;
|
||||
if ($user !== $username) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
$dt = new DateTimeImmutable($ts);
|
||||
if ($last === null || $dt > $last) {
|
||||
$last = $dt;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
fclose($fh);
|
||||
|
||||
return $last;
|
||||
}
|
||||
|
||||
function sw_format_dt(?DateTimeImmutable $dt): string {
|
||||
if ($dt === null) {
|
||||
return '–';
|
||||
}
|
||||
return $dt->setTimezone(new DateTimeZone('Europe/Berlin'))->format('d.m.Y, H:i \U\h\r');
|
||||
}
|
||||
39
src/manual/index.php
Normal file
39
src/manual/index.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
require __DIR__ . '/auth.php';
|
||||
|
||||
sw_require_login();
|
||||
$user = sw_current_user();
|
||||
$lastLoginDt = $user ? sw_last_login_for_user($user) : null;
|
||||
$lastLoginStr = sw_format_dt($lastLoginDt);
|
||||
|
||||
$indexPath = __DIR__ . '/index.html';
|
||||
if (!is_file($indexPath)) {
|
||||
header('Content-Type: text/plain; charset=utf-8');
|
||||
echo "Manual index.html nicht gefunden.";
|
||||
exit;
|
||||
}
|
||||
|
||||
$html = file_get_contents($indexPath);
|
||||
if ($html === false) {
|
||||
header('Content-Type: text/plain; charset=utf-8');
|
||||
echo "Manual konnte nicht geladen werden.";
|
||||
exit;
|
||||
}
|
||||
|
||||
$badgeOriginal = '<div class="badge">Stand: 2025-12-13</div>';
|
||||
|
||||
$userEsc = htmlspecialchars($user ?? '', ENT_QUOTES, 'UTF-8');
|
||||
$loginEsc = htmlspecialchars($lastLoginStr, ENT_QUOTES, 'UTF-8');
|
||||
|
||||
$badgeReplacement = '<div class="badge">Stand: 2025-12-13<br />' .
|
||||
$userEsc . ' · letzter Login: ' . $loginEsc . '<br />' .
|
||||
'<a href="logout.php" style="color:#9ca3af; text-decoration:none;">Abmelden</a></div>';
|
||||
|
||||
if (strpos($html, $badgeOriginal) !== false) {
|
||||
$html = str_replace($badgeOriginal, $badgeReplacement, $html);
|
||||
}
|
||||
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
echo $html;
|
||||
exit;
|
||||
|
||||
130
src/manual/login.php
Normal file
130
src/manual/login.php
Normal file
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
require __DIR__ . '/auth.php';
|
||||
|
||||
$error = null;
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$username = trim($_POST['username'] ?? '');
|
||||
$password = (string)($_POST['password'] ?? '');
|
||||
|
||||
if ($username === '' || $password === '') {
|
||||
$error = 'Bitte Benutzername und Passwort eingeben.';
|
||||
} elseif (!sw_verify_login($username, $password)) {
|
||||
$error = 'Ungültige Zugangsdaten.';
|
||||
} else {
|
||||
$_SESSION['sw_manual_user'] = $username;
|
||||
sw_record_login($username);
|
||||
header('Location: index.php');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
?><!doctype html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Summitwave Beacon – Login</title>
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Ubuntu", "Segoe UI", sans-serif;
|
||||
background: radial-gradient(1400px 900px at 0% -10%, rgba(0,0,0,.65), transparent 60%),
|
||||
radial-gradient(1100px 800px at 100% 110%, rgba(0,0,0,.8), transparent 70%),
|
||||
#101218;
|
||||
color: #f5f5f7;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 100vh;
|
||||
}
|
||||
.card {
|
||||
width: 100%;
|
||||
max-width: 360px;
|
||||
background: #181b22;
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 18px 40px rgba(0,0,0,.65);
|
||||
padding: 20px 22px 18px;
|
||||
border: 1px solid rgba(0,0,0,.8);
|
||||
}
|
||||
h1 {
|
||||
margin: 0 0 4px;
|
||||
font-size: 20px;
|
||||
}
|
||||
.muted {
|
||||
color: #9ca3af;
|
||||
font-size: 13px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
label {
|
||||
display: block;
|
||||
font-size: 13px;
|
||||
margin: 8px 0 4px;
|
||||
}
|
||||
input[type="text"],
|
||||
input[type="password"] {
|
||||
width: 100%;
|
||||
padding: 8px 10px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid rgba(55,65,81,.9);
|
||||
background: #020617;
|
||||
color: #f5f5f7;
|
||||
font-size: 14px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
input[type="text"]:focus,
|
||||
input[type="password"]:focus {
|
||||
outline: none;
|
||||
border-color: #11b6ad;
|
||||
box-shadow: 0 0 0 1px rgba(17,182,173,.7);
|
||||
}
|
||||
.btn {
|
||||
margin-top: 14px;
|
||||
width: 100%;
|
||||
padding: 9px 14px;
|
||||
border-radius: 999px;
|
||||
border: none;
|
||||
background: #11b6ad;
|
||||
color: #021310;
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.btn:hover {
|
||||
opacity: .95;
|
||||
}
|
||||
.error {
|
||||
margin-top: 8px;
|
||||
padding: 8px 10px;
|
||||
border-radius: 10px;
|
||||
background: rgba(248,113,113,.16);
|
||||
border: 1px solid rgba(248,113,113,.7);
|
||||
font-size: 13px;
|
||||
}
|
||||
.hint {
|
||||
margin-top: 10px;
|
||||
font-size: 12px;
|
||||
color: #9ca3af;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="card">
|
||||
<h1>Login</h1>
|
||||
<div class="muted">Zugriff auf die Summitwave Beacon Online‑Anleitung.</div>
|
||||
<?php if ($error): ?>
|
||||
<div class="error"><?php echo htmlspecialchars($error, ENT_QUOTES, 'UTF-8'); ?></div>
|
||||
<?php endif; ?>
|
||||
<form method="post" action="">
|
||||
<label for="username">Benutzername</label>
|
||||
<input type="text" id="username" name="username" autocomplete="username" required />
|
||||
|
||||
<label for="password">Passwort</label>
|
||||
<input type="password" id="password" name="password" autocomplete="current-password" required />
|
||||
|
||||
<button type="submit" class="btn">Anmelden</button>
|
||||
</form>
|
||||
<div class="hint">Bei Fragen zu Zugangsdaten bitte an den Systemverantwortlichen wenden.</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
8
src/manual/logout.php
Normal file
8
src/manual/logout.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
require __DIR__ . '/auth.php';
|
||||
|
||||
$_SESSION['sw_manual_user'] = null;
|
||||
session_destroy();
|
||||
|
||||
header('Location: login.php');
|
||||
exit;
|
||||
0
src/manual/logs/access.log
Normal file
0
src/manual/logs/access.log
Normal file
Reference in New Issue
Block a user