ly0303521

添加维护公告功能

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>系统维护公告</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
background-color: #f3f4f6;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
color: #1f2937;
}
.container {
background-color: white;
padding: 3rem;
border-radius: 1rem;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
text-align: center;
max-width: 500px;
width: 90%;
}
.icon {
width: 64px;
height: 64px;
background-color: #f59e0b;
color: white;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto 1.5rem;
}
h1 {
font-size: 1.5rem;
font-weight: 700;
margin-bottom: 1rem;
color: #111827;
}
p {
font-size: 1.125rem;
line-height: 1.75rem;
color: #4b5563;
}
</style>
</head>
<body>
<div class="container">
<div class="icon">
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect>
<path d="M7 11V7a5 5 0 0 1 10 0v4"></path>
</svg>
</div>
<h1>系统维护通知</h1>
<p>系统安全升级中,预计2026年2月6日14:00恢复</p>
<p style="margin-top: 1rem; font-size: 0.875rem; color: #6b7280;">感谢您的使用</p>
</div>
</body>
</html>
\ No newline at end of file
... ...
#!/bin/bash
SCRIPT_DIR=$(cd "$(dirname "$0")"; pwd)
ENV_FILE="$SCRIPT_DIR/../.env.sh"
if [ -f "$ENV_FILE" ]; then
echo "Loading configuration from $ENV_FILE"
source "$ENV_FILE"
else
echo "Error: Configuration file not found at $ENV_FILE"
exit 1
fi
if [ -z "$LOCAL_FRONTEND_PORT" ]; then
echo "Error: LOCAL_FRONTEND_PORT is not set in .env.sh"
exit 1
fi
echo "=================================================="
echo "Starting Maintenance Announcement"
echo "Target Port: $LOCAL_FRONTEND_PORT"
echo "Public Port: ${PUBLIC_FRONTEND_PORT:-Unknown}"
echo "=================================================="
APP_NAME="${FRONTEND_NAME:-z-image-frontend}"
if command -v pm2 &> /dev/null; then
echo "Stopping main frontend application ($APP_NAME)..."
pm2 stop "$APP_NAME" 2>/dev/null || echo "Main frontend was not running or could not be stopped."
MAINTENANCE_APP_NAME="maintenance-announcement-beta"
echo "Starting announcement page on port $LOCAL_FRONTEND_PORT..."
if command -v python3 &> /dev/null; then
pm2 delete "$MAINTENANCE_APP_NAME" 2>/dev/null || true
pm2 start "python3 -m http.server $LOCAL_FRONTEND_PORT" \
--name "$MAINTENANCE_APP_NAME" \
--cwd "$SCRIPT_DIR" \
--watch
echo "Maintenance announcement started."
pm2 list
else
echo "Error: python3 is not available. Please install python3 to run the simple http server."
exit 1
fi
else
echo "Error: pm2 is not installed or not in PATH."
exit 1
fi
echo "=================================================="
echo "Maintenance page should be visible at:"
echo "http://localhost:$LOCAL_FRONTEND_PORT"
if [ ! -z "$PUBLIC_IP" ] && [ ! -z "$PUBLIC_FRONTEND_PORT" ]; then
echo "http://$PUBLIC_IP:$PUBLIC_FRONTEND_PORT"
fi
echo "=================================================="
... ...
#!/bin/bash
MAINTENANCE_APP_NAME="maintenance-announcement"
echo "=================================================="
echo "Stopping Maintenance Announcement"
echo "=================================================="
if command -v pm2 &> /dev/null; then
if pm2 list | grep -q "$MAINTENANCE_APP_NAME"; then
echo "Stopping and deleting $MAINTENANCE_APP_NAME..."
pm2 stop "$MAINTENANCE_APP_NAME" 2>/dev/null
pm2 delete "$MAINTENANCE_APP_NAME" 2>/dev/null
echo "Maintenance announcement stopped."
else
echo "Process '$MAINTENANCE_APP_NAME' is not running."
fi
pm2 list
else
echo "Error: pm2 is not installed or not in PATH."
exit 1
fi
echo "=================================================="
... ...