|
17 | 17 | font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; |
18 | 18 | min-height: 100vh; |
19 | 19 | display: flex; |
| 20 | + flex-direction: column; |
20 | 21 | align-items: center; |
21 | 22 | justify-content: center; |
| 23 | + gap: 2rem; |
22 | 24 | background: radial-gradient(circle at top, #1e293b, #0f172a); |
23 | 25 | color: #e2e8f0; |
24 | | - padding: 2rem; |
| 26 | + padding: 2rem 1.5rem 3rem; |
25 | 27 | } |
26 | 28 | main { |
27 | | - max-width: 540px; |
28 | | - background: rgba(15, 23, 42, 0.8); |
29 | | - border-radius: 20px; |
30 | | - padding: 3rem 3.5rem; |
| 29 | + width: min(620px, 100%); |
| 30 | + background: rgba(15, 23, 42, 0.82); |
| 31 | + border-radius: 22px; |
| 32 | + padding: clamp(2.5rem, 5vw, 3.5rem); |
31 | 33 | text-align: center; |
32 | 34 | border: 1px solid rgba(148, 163, 184, 0.25); |
33 | | - box-shadow: 0 24px 60px rgba(15, 23, 42, 0.45); |
| 35 | + box-shadow: 0 26px 70px rgba(15, 23, 42, 0.5); |
34 | 36 | } |
35 | 37 | h1 { |
36 | 38 | font-size: clamp(2rem, 5vw, 3rem); |
|
43 | 45 | opacity: 0.85; |
44 | 46 | margin-bottom: 2rem; |
45 | 47 | } |
46 | | - .metrics { |
| 48 | + .metrics-grid { |
47 | 49 | display: grid; |
48 | | - gap: 1rem; |
49 | | - margin-bottom: 2rem; |
| 50 | + grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); |
| 51 | + gap: 1.2rem; |
| 52 | + margin-bottom: 2.25rem; |
| 53 | + } |
| 54 | + .metric { |
50 | 55 | text-align: left; |
51 | | - background: rgba(15, 23, 42, 0.6); |
52 | | - border-radius: 14px; |
53 | | - padding: 1.5rem; |
54 | | - border: 1px solid rgba(148, 163, 184, 0.2); |
| 56 | + background: rgba(15, 23, 42, 0.65); |
| 57 | + border-radius: 16px; |
| 58 | + padding: 1.35rem; |
| 59 | + border: 1px solid rgba(148, 163, 184, 0.18); |
| 60 | + backdrop-filter: blur(12px); |
55 | 61 | } |
56 | | - .metrics .label { |
| 62 | + .metric .label { |
57 | 63 | display: block; |
58 | 64 | font-size: 0.85rem; |
59 | 65 | text-transform: uppercase; |
60 | 66 | letter-spacing: 0.14em; |
61 | 67 | opacity: 0.65; |
62 | 68 | margin-bottom: 0.3rem; |
63 | 69 | } |
64 | | - .metrics .value { |
65 | | - font-size: 1.6rem; |
| 70 | + .metric .value { |
| 71 | + font-size: 2rem; |
66 | 72 | font-weight: 600; |
67 | 73 | color: #f8fafc; |
68 | 74 | } |
| 75 | + .metric .unit { |
| 76 | + font-size: 0.8rem; |
| 77 | + opacity: 0.6; |
| 78 | + margin-left: 0.25rem; |
| 79 | + } |
69 | 80 | a { |
70 | 81 | display: inline-block; |
71 | 82 | text-decoration: none; |
|
81 | 92 | transform: translateY(-2px); |
82 | 93 | box-shadow: 0 24px 45px rgba(129, 140, 248, 0.45); |
83 | 94 | } |
| 95 | + footer { |
| 96 | + font-size: 0.95rem; |
| 97 | + opacity: 0.75; |
| 98 | + display: flex; |
| 99 | + gap: 1rem; |
| 100 | + flex-wrap: wrap; |
| 101 | + justify-content: center; |
| 102 | + text-align: center; |
| 103 | + } |
| 104 | + footer .heart { |
| 105 | + color: #f87171; |
| 106 | + margin: 0 0.25rem; |
| 107 | + } |
| 108 | + @media (max-width: 540px) { |
| 109 | + body { |
| 110 | + padding: 1.75rem 1rem 2.5rem; |
| 111 | + } |
| 112 | + .metric .value { |
| 113 | + font-size: 1.7rem; |
| 114 | + } |
| 115 | + } |
84 | 116 | </style> |
85 | 117 | </head> |
86 | 118 | <body> |
87 | 119 | <main> |
88 | 120 | <h1>AlterBase CDN</h1> |
89 | 121 | <p> |
90 | | - Fast minimal API for hosting images and assets. Upload files (up to $max_file_mb MB), retrieve shareable |
| 122 | + Fast minimal API for hosting images and assets. Upload files (up to ${max_file_mb} MB), retrieve shareable |
91 | 123 | URLs, and keep storage tidy with automatic cleanup. |
92 | 124 | </p> |
93 | | - <div class="metrics"> |
94 | | - <div> |
| 125 | + <div class="metrics-grid"> |
| 126 | + <div class="metric" data-key="uploads" data-value="${uploads}"> |
95 | 127 | <span class="label">Uploads</span> |
96 | | - <span class="value">$uploads</span> |
| 128 | + <span class="value">0</span> |
97 | 129 | </div> |
98 | | - <div> |
| 130 | + <div class="metric" data-key="downloads" data-value="${downloads}"> |
99 | 131 | <span class="label">Downloads</span> |
100 | | - <span class="value">$downloads</span> |
| 132 | + <span class="value">0</span> |
101 | 133 | </div> |
102 | | - <div> |
| 134 | + <div class="metric" data-key="deleted" data-value="${deleted}"> |
103 | 135 | <span class="label">Cleanups</span> |
104 | | - <span class="value">$deleted</span> |
| 136 | + <span class="value">0</span> |
105 | 137 | </div> |
106 | 138 | </div> |
107 | 139 | <a href="/api-info">View API Guide</a> |
108 | 140 | </main> |
| 141 | + <footer> |
| 142 | + <span>Made by<span class="heart">❤️</span>lunaticsm</span> |
| 143 | + <span>© ${year} AlterBase CDN</span> |
| 144 | + </footer> |
| 145 | + <script> |
| 146 | + const metricCards = document.querySelectorAll(".metric"); |
| 147 | + |
| 148 | + function formatNumber(value) { |
| 149 | + if (Number.isNaN(value)) { |
| 150 | + return "0"; |
| 151 | + } |
| 152 | + return value.toLocaleString("en-US"); |
| 153 | + } |
| 154 | + |
| 155 | + function scramble(el, finalValue) { |
| 156 | + const duration = 900; |
| 157 | + const start = performance.now(); |
| 158 | + const maxRandom = Math.max(finalValue, 20); |
| 159 | + |
| 160 | + function update(now) { |
| 161 | + const progress = (now - start) / duration; |
| 162 | + if (progress < 1) { |
| 163 | + const randomValue = Math.floor(Math.random() * maxRandom); |
| 164 | + el.textContent = formatNumber(randomValue); |
| 165 | + requestAnimationFrame(update); |
| 166 | + } else { |
| 167 | + el.textContent = formatNumber(finalValue); |
| 168 | + } |
| 169 | + } |
| 170 | + |
| 171 | + requestAnimationFrame(update); |
| 172 | + } |
| 173 | + |
| 174 | + function applyMetrics(data) { |
| 175 | + metricCards.forEach(function (card) { |
| 176 | + const key = card.getAttribute("data-key"); |
| 177 | + const nextValue = Number(data[key] || 0); |
| 178 | + const current = Number(card.getAttribute("data-current") || "-1"); |
| 179 | + if (current === nextValue) { |
| 180 | + return; |
| 181 | + } |
| 182 | + card.setAttribute("data-current", String(nextValue)); |
| 183 | + const valueEl = card.querySelector(".value"); |
| 184 | + scramble(valueEl, nextValue); |
| 185 | + }); |
| 186 | + } |
| 187 | + |
| 188 | + const initialMetrics = {}; |
| 189 | + metricCards.forEach(function (card) { |
| 190 | + const key = card.getAttribute("data-key"); |
| 191 | + initialMetrics[key] = Number(card.getAttribute("data-value") || "0"); |
| 192 | + }); |
| 193 | + applyMetrics(initialMetrics); |
| 194 | + |
| 195 | + async function refreshMetrics() { |
| 196 | + try { |
| 197 | + const response = await fetch("/metrics", { cache: "no-store" }); |
| 198 | + if (!response.ok) { |
| 199 | + return; |
| 200 | + } |
| 201 | + const payload = await response.json(); |
| 202 | + applyMetrics(payload); |
| 203 | + } catch (err) { |
| 204 | + console.error("metrics refresh failed", err); |
| 205 | + } |
| 206 | + } |
| 207 | + |
| 208 | + setTimeout(refreshMetrics, 250); |
| 209 | + setInterval(refreshMetrics, 15000); |
| 210 | + </script> |
109 | 211 | </body> |
110 | 212 | </html> |
0 commit comments