( session: EncodedSession, encoded: string, error: string, status = 200, )
| 373 | } |
| 374 | |
| 375 | function passwordPage( |
| 376 | session: EncodedSession, |
| 377 | encoded: string, |
| 378 | error: string, |
| 379 | status = 200, |
| 380 | ): Response { |
| 381 | const details = [ |
| 382 | session.repo ? escapeHtml(session.repo) : "", |
| 383 | session.pr ? `PR #${escapeHtml(session.pr)}` : "", |
| 384 | session.platform ? escapeHtml(session.platform) : "", |
| 385 | ] |
| 386 | .filter(Boolean) |
| 387 | .join(" · "); |
| 388 | const body = ` |
| 389 | ${details ? `<p class="details">${details}</p>` : ""} |
| 390 | ${error ? `<p class="error">${escapeHtml(error)}</p>` : ""} |
| 391 | <form method="post" action="/api/session/auth"> |
| 392 | <input type="hidden" name="${REDIRECT_PARAM}" value="${escapeHtml(encoded)}" /> |
| 393 | <label> |
| 394 | Session password |
| 395 | <input name="password" type="password" autocomplete="current-password" autofocus /> |
| 396 | </label> |
| 397 | <button type="submit">Open SimDeck</button> |
| 398 | </form> |
| 399 | `; |
| 400 | return passwordShellResponse("Protected SimDeck session", body, status); |
| 401 | } |
| 402 | |
| 403 | function landingPage(): Response { |
| 404 | return passwordShellResponse( |
no test coverage detected