File size: 2,680 Bytes
c85417e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Titanic Explainer Waking Up</title>
    <style>
      :root {
        color-scheme: light;
        --bg: #f5f7fb;
        --card: #ffffff;
        --text: #12243a;
        --muted: #546b84;
        --accent: #0b5fff;
      }
      body {
        margin: 0;
        min-height: 100vh;
        display: grid;
        place-items: center;
        background: radial-gradient(circle at top right, #deebff, var(--bg) 45%);
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
        color: var(--text);
      }
      .card {
        width: min(680px, 92vw);
        background: var(--card);
        border-radius: 16px;
        padding: 28px;
        box-shadow: 0 10px 30px rgba(15, 35, 95, 0.12);
      }
      h1 {
        margin: 0 0 10px;
        font-size: 1.7rem;
      }
      p {
        margin: 0 0 10px;
        color: var(--muted);
        line-height: 1.4;
      }
      .status {
        margin-top: 16px;
        font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      }
      .dot {
        display: inline-block;
        width: 10px;
        height: 10px;
        border-radius: 999px;
        background: var(--accent);
        margin-right: 8px;
        animation: pulse 1.2s infinite;
      }
      @keyframes pulse {
        0% { opacity: 0.2; transform: scale(0.9); }
        50% { opacity: 1; transform: scale(1.05); }
        100% { opacity: 0.2; transform: scale(0.9); }
      }
    </style>
  </head>
  <body>
    <main class="card">
      <h1>Titanic Explainer is waking up</h1>
      <p>The demo sleeps when idle to save cost. This page will refresh automatically as soon as the app is ready.</p>
      <p>If it takes longer than a minute, keep this tab open and wait for the next check.</p>
      <div class="status"><span class="dot"></span><span id="message">Checking backend...</span></div>
    </main>
    <script>
      const messageEl = document.getElementById("message");

      async function checkBackend() {
        try {
          const res = await fetch("/__backend_health", { cache: "no-store" });
          if (res.ok) {
            messageEl.textContent = "Backend is ready, redirecting...";
            window.location.reload();
            return;
          }
          messageEl.textContent = `Still waking up (status ${res.status})...`;
        } catch (err) {
          messageEl.textContent = "Still waking up (network retry)...";
        }
      }

      checkBackend();
      setInterval(checkBackend, 2500);
    </script>
  </body>
</html>