2023-09-09 22:52:50 +02:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>delphi.market</title>
|
|
|
|
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
|
|
|
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
|
|
|
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
|
|
|
|
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
|
|
|
|
<link rel="manifest" href="/site.webmanifest" />
|
|
|
|
<link rel="stylesheet" href="/index.css" />
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
2023-09-09 22:52:50 +02:00
|
|
|
<meta name="theme-color" content="#091833" />
|
2023-09-09 22:52:50 +02:00
|
|
|
{{ if eq .ENV "development" }}
|
|
|
|
<script defer src="/hotreload.js"></script>
|
|
|
|
{{ end }}
|
2023-09-09 22:52:50 +02:00
|
|
|
</head>
|
|
|
|
<body>
|
2023-09-09 22:52:50 +02:00
|
|
|
<header class="flex flex-row text-center justify-center pt-1">
|
|
|
|
<nav>
|
|
|
|
<a href="/">home</a>
|
2023-09-09 22:52:50 +02:00
|
|
|
{{ if .session }}
|
|
|
|
<form action='/logout' method='post'>
|
|
|
|
<button type='submit'>logout</button>
|
|
|
|
</form>
|
|
|
|
{{ else }} <a href="/login">login</a> {{ end }}
|
2023-09-09 22:52:50 +02:00
|
|
|
</nav>
|
|
|
|
</header>
|
2023-09-09 22:52:50 +02:00
|
|
|
<div class="container flex flex-column text-center justify-center">
|
2023-09-09 22:52:50 +02:00
|
|
|
<code>
|
|
|
|
<strong>
|
|
|
|
<pre>
|
2023-09-09 22:52:50 +02:00
|
|
|
_ _
|
|
|
|
| | ___ __ _(_)_ __
|
|
|
|
| |/ _ \ / _` | | '_ \
|
|
|
|
| | (_) | (_| | | | | |
|
|
|
|
|_|\___/ \__, |_|_| |_|
|
|
|
|
|___/ </pre>
|
2023-09-09 22:52:50 +02:00
|
|
|
</strong>
|
|
|
|
</code>
|
2023-09-09 22:52:50 +02:00
|
|
|
<div id="lnauth-qr">
|
|
|
|
<div class="mb-1">Login with Lightning</div>
|
2023-09-09 22:52:50 +02:00
|
|
|
<a href="lightning:{{.lnurl}}"><img class="m-auto mb-1" src="data:image/png;base64,{{.qr}}" width="100%"/></a>
|
2023-09-09 22:52:50 +02:00
|
|
|
<div class="font-mono word-wrap">{{.lnurl}}</div>
|
|
|
|
</div>
|
|
|
|
<div id="lnauth-success" hidden>
|
|
|
|
<div>Login successful</div>
|
|
|
|
<div>You are <span id="lnauth-pubkey" class="font-mono"></span></div>
|
|
|
|
<div id="lnauth-countdown">Redirecting in 3 ...</div>
|
2023-09-09 22:52:50 +02:00
|
|
|
</div>
|
2023-09-09 22:52:50 +02:00
|
|
|
</div>
|
|
|
|
</body>
|
2023-09-09 22:52:50 +02:00
|
|
|
<script>
|
|
|
|
const qr = document.querySelector("#lnauth-qr")
|
|
|
|
const success = document.querySelector("#lnauth-success")
|
|
|
|
const pubkey = document.querySelector("#lnauth-pubkey")
|
|
|
|
const countdown = document.querySelector("#lnauth-countdown")
|
|
|
|
const interval = setInterval(async () => {
|
|
|
|
const body = await fetch(`/api/session`)
|
|
|
|
.then((r) => r.json())
|
|
|
|
.catch(console.error)
|
|
|
|
if (body.pubkey) {
|
|
|
|
qr.setAttribute("hidden", true)
|
|
|
|
pubkey.textContent = body.pubkey.slice(0, 10)
|
|
|
|
success.removeAttribute("hidden")
|
|
|
|
clearInterval(interval)
|
|
|
|
let timer = 2
|
|
|
|
const redirect = setInterval(() => {
|
|
|
|
countdown.textContent = `Redirecting in ${timer--} ...`
|
|
|
|
if (timer === -1) {
|
2023-09-09 22:52:50 +02:00
|
|
|
window.location.href = "https://{{.PUBLIC_URL}}/";
|
2023-09-09 22:52:50 +02:00
|
|
|
}
|
|
|
|
}, 1000)
|
|
|
|
}
|
|
|
|
}, 1000)
|
|
|
|
</script>
|
2023-09-09 22:52:50 +02:00
|
|
|
</html>
|