223015b: - add WTF hex code explanation slide (89=137 decimal, PNG signature) - add ASCII lead slide with historical context - remove Hilbert-Studie reference from title 223015c termin 2: - add OSI layer 5 (session) and layer 6 (presentation) slides - add URL/domain anatomy slide - mark HTTP/S section as klausur - improve status codes formatting with client/server examples - add CRUD column to HTTP methods table infrastructure: - add dev-server.sh for multi-course development - update generate-index.sh with course-specific colors - add QR codes for slide URLs
107 lines
3.8 KiB
Bash
Executable File
107 lines
3.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Development server script for HdM slides
|
|
# Starts index server + marp servers for each course
|
|
|
|
set -e
|
|
|
|
# Configuration
|
|
INDEX_PORT=1310
|
|
COURSE_B_PORT=1311
|
|
COURSE_C_PORT=1312
|
|
COURSE_DIR="courses"
|
|
DEV_INDEX_DIR=".dev-index"
|
|
|
|
# Colors
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
BLUE='\033[0;34m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# Cleanup function
|
|
cleanup() {
|
|
echo -e "\n${RED}Shutting down servers...${NC}"
|
|
kill $PID_INDEX $PID_B $PID_C 2>/dev/null || true
|
|
exit 0
|
|
}
|
|
|
|
# Kill existing processes on our ports
|
|
kill_existing() {
|
|
echo -e "${BLUE}Cleaning up existing processes...${NC}"
|
|
# Kill marp processes first
|
|
pkill -9 -f "marp-cli" 2>/dev/null || true
|
|
pkill -f "python3 -m http.server" 2>/dev/null || true
|
|
# Kill ports including marp's WebSocket ports (37717-37720 range)
|
|
fuser -k $INDEX_PORT/tcp $COURSE_B_PORT/tcp $COURSE_C_PORT/tcp 2>/dev/null || true
|
|
fuser -k 37717/tcp 37718/tcp 37719/tcp 37720/tcp 2>/dev/null || true
|
|
sleep 2
|
|
}
|
|
|
|
# Generate dev index
|
|
generate_index() {
|
|
mkdir -p "$DEV_INDEX_DIR"
|
|
cat > "$DEV_INDEX_DIR/index.html" << 'EOF'
|
|
<!DOCTYPE html>
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
<title>HdM Slides - Dev</title>
|
|
<style>
|
|
*{box-sizing:border-box;margin:0;padding:0}
|
|
body{font-family:-apple-system,BlinkMacSystemFont,"SF Pro Display","Segoe UI",Roboto,sans-serif;max-width:720px;margin:0 auto;padding:3rem 1.5rem;background:#fafafa;color:#1d1d1f;line-height:1.5}
|
|
h1{font-size:2rem;font-weight:600;letter-spacing:-0.02em;margin-bottom:.5rem}
|
|
.subtitle{color:#86868b;font-size:1rem}
|
|
.courses{margin-top:2rem;display:flex;flex-direction:column;gap:.75rem}
|
|
a.course{display:block;background:#fff;border-radius:12px;padding:1.5rem;text-decoration:none;color:inherit;box-shadow:0 1px 3px rgba(0,0,0,0.08);transition:all .2s ease;cursor:pointer}
|
|
a.course:hover{transform:translateY(-2px);box-shadow:0 4px 12px rgba(0,0,0,0.12)}
|
|
.course-label{font-size:.7rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em}
|
|
.course-b .course-label{color:#5da9e9}
|
|
.course-c .course-label{color:#d63384}
|
|
.course-title{font-size:1.15rem;font-weight:500;color:#1d1d1f;margin:.25rem 0}
|
|
.course-info{font-size:.85rem;color:#86868b}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>HdM Slides</h1>
|
|
<p class="subtitle">Development Server</p>
|
|
<div class="courses">
|
|
EOF
|
|
echo " <a class=\"course course-b\" href=\"http://localhost:$COURSE_B_PORT\"><span class=\"course-label\">223015b</span><div class=\"course-title\">Dateiformate, Schnittstellen, Speichermedien & Distributionswege</div><span class=\"course-info\">Port $COURSE_B_PORT</span></a>" >> "$DEV_INDEX_DIR/index.html"
|
|
echo " <a class=\"course course-c\" href=\"http://localhost:$COURSE_C_PORT\"><span class=\"course-label\">223015c</span><div class=\"course-title\">Grundlagen IT- und Internettechnik</div><span class=\"course-info\">Port $COURSE_C_PORT</span></a>" >> "$DEV_INDEX_DIR/index.html"
|
|
cat >> "$DEV_INDEX_DIR/index.html" << 'EOF'
|
|
</div>
|
|
</body>
|
|
</html>
|
|
EOF
|
|
}
|
|
|
|
# Main
|
|
trap cleanup SIGINT SIGTERM
|
|
|
|
kill_existing
|
|
generate_index
|
|
|
|
echo -e "${GREEN}Starting development servers...${NC}"
|
|
echo ""
|
|
echo -e " Index: ${BLUE}http://localhost:$INDEX_PORT${NC}"
|
|
echo -e " 223015b: ${BLUE}http://localhost:$COURSE_B_PORT${NC}"
|
|
echo -e " 223015c: ${BLUE}http://localhost:$COURSE_C_PORT${NC}"
|
|
echo ""
|
|
echo -e "Press ${RED}Ctrl+C${NC} to stop all servers"
|
|
echo ""
|
|
|
|
# Start servers
|
|
python3 -m http.server $INDEX_PORT --directory "$DEV_INDEX_DIR" &
|
|
PID_INDEX=$!
|
|
|
|
PORT=$COURSE_B_PORT npx @marp-team/marp-cli --server "$COURSE_DIR/223015b/slides/" &
|
|
PID_B=$!
|
|
|
|
sleep 3 # Stagger starts to avoid WebSocket port collision
|
|
|
|
PORT=$COURSE_C_PORT npx @marp-team/marp-cli --server "$COURSE_DIR/223015c/slides/" &
|
|
PID_C=$!
|
|
|
|
# Wait for any process to exit
|
|
wait
|