Format HTML

This commit is contained in:
ekzyis 2023-09-09 22:52:50 +02:00
parent 011b2eff0a
commit e14a3c824d
6 changed files with 254 additions and 236 deletions

View File

@ -1,33 +1,35 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head>
<title>delphi.market</title> <head>
<link rel="icon" type="image/x-icon" href="/favicon.ico" /> <title>delphi.market</title>
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" /> <link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" /> <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" /> <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="manifest" href="/site.webmanifest" /> <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<link rel="stylesheet" href="/index.css" /> <link rel="manifest" href="/site.webmanifest" />
<link rel="stylesheet" href="/market.css" /> <link rel="stylesheet" href="/index.css" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <link rel="stylesheet" href="/market.css" />
<meta name="theme-color" content="#091833" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
{{ if eq .ENV "development" }} <meta name="theme-color" content="#091833" />
<script defer src="/hotreload.js"></script> {{ if eq .ENV "development" }}
{{ end }} <script defer src="/hotreload.js"></script>
</head> {{ end }}
<body> </head>
<header class="flex flex-row text-center justify-center pt-1">
<nav> <body>
<a href="/">home</a> <header class="flex flex-row text-center justify-center pt-1">
{{ if .session }} <nav>
<form action='/logout' method='post'> <a href="/">home</a>
<button type='submit'>logout</button> {{ if .session }}
</form> <form action='/logout' method='post'>
{{ else }} <a href="/login">login</a> {{ end }} <button type='submit'>logout</button>
</nav> </form>
</header> {{ else }} <a href="/login">login</a> {{ end }}
<div class="container flex flex-column text-center"> </nav>
<code> </header>
<div class="container flex flex-column text-center">
<code>
<strong> <strong>
<pre> <pre>
_ _ _ _
@ -37,44 +39,45 @@
|_| |_| |_|\__,_|_| |_|\_\___|\__|</pre> |_| |_| |_|\__,_|_| |_|\_\___|\__|</pre>
</strong> </strong>
</code> </code>
<div class="font-mono mb-1">{{.Description}}</div> <div class="font-mono mb-1">{{.Description}}</div>
<div class="flex flex-row justify-center mb-1"> <div class="flex flex-row justify-center mb-1">
{{ range .Shares }} {{ if eq .Description "YES" }}
<button id="yes-order" class="order-button sx-1 yes">YES</button>
{{ else }}
<button id="no-order" class="order-button sx-1 no">NO</button>
{{ end }}
{{ end }}
</div>
{{ range .Shares }} {{ if eq .Description "YES" }} {{ range .Shares }} {{ if eq .Description "YES" }}
<form id="yes-form" class="order-form" hidden action="/api/market/{{$.Id}}/order" method="post"> <button id="yes-order" class="order-button sx-1 yes">YES</button>
<button id="yes-buy" type="button" class="order-button yes w-100p selected">BUY</button>
<button id="yes-sell" type="button" class="order-button no w-100p">SELL</button>
<input hidden name="share_id" value="{{.Id}}" />
<input id="yes-side" hidden name="side" value="BUY" />
<label>shares</label>
<input id="yes-quantity" type="number" name="quantity" placeholder="quantity" />
<label id="yes-cost-label">cost [sats]</label>
<input id="yes-cost" type="number" name="cost" disabled />
<label id="yes-submit-label">BUY YES shares</label>
<button type="submit">SUBMIT</button>
</form>
{{ else }} {{ else }}
<form id="no-form" class="order-form" hidden action="/api/market/{{$.Id}}/order" method="post"> <button id="no-order" class="order-button sx-1 no">NO</button>
<button id="no-buy" type="button" class="order-button yes w-100p selected">BUY</button>
<button id="no-sell" type="button" class="order-button no w-100p">SELL</button>
<input hidden name="share_id" value="{{.Id}}" />
<input id="no-side" hidden name="side" value="BUY" />
<label>shares</label>
<input id="no-quantity" type="number" name="quantity" placeholder="quantity" />
<label id="no-cost-label">cost [sats]</label>
<input id="no-cost" type="number" name="cost" disabled />
<label id="no-submit-label">BUY NO shares</label>
<button type="submit">SUBMIT</button>
</form>
{{ end }} {{ end }}
{{ end }} {{ end }}
</div> </div>
</body> {{ range .Shares }} {{ if eq .Description "YES" }}
<script src="/market.js"></script> <form id="yes-form" class="order-form" hidden action="/api/market/{{$.Id}}/order" method="post">
</html> <button id="yes-buy" type="button" class="order-button yes w-100p selected">BUY</button>
<button id="yes-sell" type="button" class="order-button no w-100p">SELL</button>
<input hidden name="share_id" value="{{.Id}}" />
<input id="yes-side" hidden name="side" value="BUY" />
<label>shares</label>
<input id="yes-quantity" type="number" name="quantity" placeholder="quantity" />
<label id="yes-cost-label">cost [sats]</label>
<input id="yes-cost" type="number" name="cost" disabled />
<label id="yes-submit-label">BUY YES shares</label>
<button type="submit">SUBMIT</button>
</form>
{{ else }}
<form id="no-form" class="order-form" hidden action="/api/market/{{$.Id}}/order" method="post">
<button id="no-buy" type="button" class="order-button yes w-100p selected">BUY</button>
<button id="no-sell" type="button" class="order-button no w-100p">SELL</button>
<input hidden name="share_id" value="{{.Id}}" />
<input id="no-side" hidden name="side" value="BUY" />
<label>shares</label>
<input id="no-quantity" type="number" name="quantity" placeholder="quantity" />
<label id="no-cost-label">cost [sats]</label>
<input id="no-cost" type="number" name="cost" disabled />
<label id="no-submit-label">BUY NO shares</label>
<button type="submit">SUBMIT</button>
</form>
{{ end }}
{{ end }}
</div>
</body>
<script src="/market.js"></script>
</html>

View File

@ -1,32 +1,34 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head>
<title>delphi.market</title> <head>
<link rel="icon" type="image/x-icon" href="/favicon.ico" /> <title>delphi.market</title>
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" /> <link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" /> <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" /> <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="manifest" href="/site.webmanifest" /> <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<link rel="stylesheet" href="/index.css" /> <link rel="manifest" href="/site.webmanifest" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <link rel="stylesheet" href="/index.css" />
<meta name="theme-color" content="#091833" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
{{ if eq .ENV "development" }} <meta name="theme-color" content="#091833" />
<script defer src="/hotreload.js"></script> {{ if eq .ENV "development" }}
{{ end }} <script defer src="/hotreload.js"></script>
</head> {{ end }}
<body> </head>
<header class="flex flex-row text-center justify-center pt-1">
<nav> <body>
<a href="/">home</a> <header class="flex flex-row text-center justify-center pt-1">
{{ if .session }} <nav>
<form action='/logout' method='post'> <a href="/">home</a>
<button type='submit'>logout</button> {{ if .session }}
</form> <form action='/logout' method='post'>
{{ else }} <a href="/login">login</a> {{ end }} <button type='submit'>logout</button>
</nav> </form>
</header> {{ else }} <a href="/login">login</a> {{ end }}
<div class="container flex flex-column text-center"> </nav>
<code> </header>
<div class="container flex flex-column text-center">
<code>
<strong> <strong>
<pre> <pre>
_ _ _ _ _ _ _ _
@ -37,17 +39,18 @@
|_| </pre> |_| </pre>
</strong> </strong>
</code> </code>
<div class="font-mono mb-1">A prediction market using the lightning network [WIP]</div> <div class="font-mono mb-1">A prediction market using the lightning network [WIP]</div>
<div class="font-mono mb-1">ACTIVE MARKETS</div> <div class="font-mono mb-1">ACTIVE MARKETS</div>
{{ range .markets }} {{ range .markets }}
<a href="/market/{{.Id}}">{{.Description}}</a> <a href="/market/{{.Id}}">{{.Description}}</a>
{{ end }} {{ end }}
</div>
<footer class="flex justify-center">
<div>
<hr />
<code><a href="https://github.com/ekzyis/delphi.market/commit/{{.COMMIT_LONG_SHA}}">{{.VERSION}}</a></code>
</div> </div>
<footer class="flex justify-center"> </footer>
<div> </body>
<hr />
<code><a href="https://github.com/ekzyis/delphi.market/commit/{{.COMMIT_LONG_SHA}}">{{.VERSION}}</a></code> </html>
</div>
</footer>
</body>
</html>

View File

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

View File

@ -1,24 +1,26 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head>
<title>delphi.market</title> <head>
<link rel="icon" type="image/x-icon" href="/favicon.ico" /> <title>delphi.market</title>
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" /> <link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" /> <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" /> <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="manifest" href="/site.webmanifest" /> <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<link rel="stylesheet" href="/index.css" /> <link rel="manifest" href="/site.webmanifest" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <link rel="stylesheet" href="/index.css" />
<meta name="theme-color" content="#091833" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
</head> <meta name="theme-color" content="#091833" />
<body> </head>
<header class="flex flex-row text-center justify-center pt-1">
<nav> <body>
<a href="/">home</a> <header class="flex flex-row text-center justify-center pt-1">
</nav> <nav>
</header> <a href="/">home</a>
<div class="container flex flex-column text-center"> </nav>
<code> </header>
<div class="container flex flex-column text-center">
<code>
<strong> <strong>
<pre> <pre>
_ _ ___ _ _ _ _ ___ _ _
@ -28,7 +30,8 @@
|_| \___/ |_| </pre> |_| \___/ |_| </pre>
</strong> </strong>
</code> </code>
<div class="font-mono mb-1">Not Found</div> <div class="font-mono mb-1">Not Found</div>
</div> </div>
</body> </body>
</html>
</html>

View File

@ -1,24 +1,26 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head>
<title>delphi.market</title> <head>
<link rel="icon" type="image/x-icon" href="/favicon.ico" /> <title>delphi.market</title>
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" /> <link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" /> <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" /> <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="manifest" href="/site.webmanifest" /> <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<link rel="stylesheet" href="/index.css" /> <link rel="manifest" href="/site.webmanifest" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <link rel="stylesheet" href="/index.css" />
<meta name="theme-color" content="#091833" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
</head> <meta name="theme-color" content="#091833" />
<body> </head>
<header class="flex flex-row text-center justify-center pt-1">
<nav> <body>
<a href="/">home</a> <header class="flex flex-row text-center justify-center pt-1">
</nav> <nav>
</header> <a href="/">home</a>
<div class="container flex flex-column text-center"> </nav>
<code> </header>
<div class="container flex flex-column text-center">
<code>
<strong> <strong>
<pre> <pre>
_ _ ___ ____ _ _ ___ ____
@ -28,7 +30,8 @@
|_| \___/|____/ </pre> |_| \___/|____/ </pre>
</strong> </strong>
</code> </code>
<div class="font-mono mb-1">Method Not Allowed</div> <div class="font-mono mb-1">Method Not Allowed</div>
</div> </div>
</body> </body>
</html>
</html>

View File

@ -1,24 +1,26 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head>
<title>delphi.market</title> <head>
<link rel="icon" type="image/x-icon" href="/favicon.ico" /> <title>delphi.market</title>
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" /> <link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" /> <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" /> <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="manifest" href="/site.webmanifest" /> <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<link rel="stylesheet" href="/index.css" /> <link rel="manifest" href="/site.webmanifest" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <link rel="stylesheet" href="/index.css" />
<meta name="theme-color" content="#091833" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
</head> <meta name="theme-color" content="#091833" />
<body> </head>
<header class="flex flex-row text-center justify-center pt-1">
<nav> <body>
<a href="/">home</a> <header class="flex flex-row text-center justify-center pt-1">
</nav> <nav>
</header> <a href="/">home</a>
<div class="container flex flex-column text-center"> </nav>
<code> </header>
<div class="container flex flex-column text-center">
<code>
<strong> <strong>
<pre> <pre>
____ ___ ___ ____ ___ ___
@ -28,7 +30,8 @@
|____/ \___/ \___/ </pre> |____/ \___/ \___/ </pre>
</strong> </strong>
</code> </code>
<div class="font-mono mb-1">Internal Server Error</div> <div class="font-mono mb-1">Internal Server Error</div>
</div> </div>
</body> </body>
</html>
</html>