fix(templates): Add basic template

This commit is contained in:
Myzel394 2024-11-20 16:53:29 +01:00
parent 2a55890764
commit ea18750b24
No known key found for this signature in database
GPG Key ID: ED20A1D1D423AF3F
2 changed files with 127 additions and 109 deletions

49
templates/base.html.njk Normal file
View File

@ -0,0 +1,49 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="darkreader-lock">
<title>amiopen.now</title>
<style type="text/css">
* {
box-sizing: border-box;
}
body {
font-family: Arial, Helvetica, sans-serif;
background-color: #161318;
color: #eee;
margin: 0;
padding: 0;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
}
main {
background-color: #212126;
width: 100%;
max-width: 40em;
margin: 0 auto;
border-radius: 1em;
padding: 3em;
}
</style>
{% block header %}{% endblock %}
</head>
<body>
<main>
{% block main %}
<h2>Am I Open</h2>
{% endblock %}
</main>
{% block scripts %}
{% endblock %}
</body>
</html>

View File

@ -1,141 +1,110 @@
<!doctype html> {% extends "base.html.njk" %}
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="darkreader-lock">
<title>amiopen.now</title>
<style type="text/css"> {% block header %}
* { <style type="text/css">
box-sizing: border-box; h2 {
} margin-top: 0;
text-align: left;
}
body { code {
font-family: Arial, Helvetica, sans-serif; background-color: #2f2f2f;
background-color: #161318; color: #eee;
color: #eee; padding: 1em;
margin: 0; border-radius: 0.5em;
padding: 0; width: 100%;
height: 100vh; display: block;
}
display: flex; code .command {
flex-direction: column; color: #598eb2;
justify-content: center; }
}
main { code .input {
background-color: #212126; color: #b27b59;
width: 100%; }
max-width: 40em;
margin: 0 auto;
border-radius: 1em;
padding: 3em;
}
h2 { code .second-input {
margin-top: 0; color: #b2596e;
text-align: left; }
}
code { code .secondary {
background-color: #2f2f2f; color: #b2a559;
color: #eee; }
padding: 1em;
border-radius: 0.5em;
width: 100%;
display: block;
}
code .command { code .comment {
color: #598eb2; color: #5c6370;
} }
code .input { .copy {
color: #b27b59; cursor: pointer;
} border: none;
code .second-input { border-radius: 0.4em;
color: #b2596e;
}
code .secondary { aspect-ratio: 1;
color: #b2a559;
}
code .comment { background: transparent;
color: #5c6370;
}
.copy { vertical-align: middle;
cursor: pointer;
border: none;
border-radius: 0.4em; transition: background-color 0.2s;
}
aspect-ratio: 1; .copy:hover {
background: #ffffff40;
}
background: transparent; .copy img {
width: 1rem;
color: #fff;
filter: invert(1);
}
</style>
{% endblock %}
vertical-align: middle; {% block main %}
<h2>Am I Open</h2>
<p>
Your IP address: <strong>{{ip}}</strong>
<button class="copy" id="copy-ip">
<img width="1em" src="/static/copy.svg" alt="Copy" />
</button>
</p>
transition: background-color 0.2s; <strong> Check if your port is reachable: </strong>
} <pre><code><span class="command">curl</span> amiopen.now/<span class="input">&lt;port&gt;</span>
.copy:hover {
background: #ffffff40;
}
.copy img {
width: 1rem;
color: #fff;
filter: invert(1);
}
</style>
</head>
<body>
<main>
<h2>Am I Open</h2>
<p>
Your IP address: <strong>{{ip}}</strong>
<button class="copy" id="copy-ip">
<img width="1em" src="/static/copy.svg" alt="Copy" />
</button>
</p>
<strong> Check if your port is reachable: </strong>
<pre><code><span class="command">curl</span> amiopen.now/<span class="input">&lt;port&gt;</span>
<span class="comment">// Example</span> <span class="comment">// Example</span>
<span class="command">curl</span> amiopen.now/<span class="input">80</span> <span class="command">curl</span> amiopen.now/<span class="input">80</span>
> open</code></pre> > open</code></pre>
<strong> Check if an IP address is reachable: </strong> <strong> Check if an IP address is reachable: </strong>
<pre><code><span class="command">curl</span> amiopen.now/<span class="second-input">&lt;ip address&gt;</span>/<span class="input">&lt;port&gt;</span> <pre><code><span class="command">curl</span> amiopen.now/<span class="second-input">&lt;ip address&gt;</span>/<span class="input">&lt;port&gt;</span>
<span class="comment">// Example</span> <span class="comment">// Example</span>
<span class="comment">$</span> <span class="command">curl</span> amiopen.now/<span class="second-input">1.1.1.1</span>/<span class="input">53</span> <span class="comment">$</span> <span class="command">curl</span> amiopen.now/<span class="second-input">1.1.1.1</span>/<span class="input">53</span>
> open</code></pre> > open</code></pre>
<strong> Check if your ISP is blocking a port: </strong> <strong> Check if your ISP is blocking a port: </strong>
<pre><code><span class="command">telnet</span> amiopen.now <span class="input">&lt;port&gt;</span> <pre><code><span class="command">telnet</span> amiopen.now <span class="input">&lt;port&gt;</span>
<span class="comment">// Example</span> <span class="comment">// Example</span>
<span class="command">telnet</span> amiopen.now <span class="input">80</span></code></pre> <span class="command">telnet</span> amiopen.now <span class="input">80</span></code></pre>
<i> <i>
Hint: You can also check if you can access SSH by using: Hint: You can also check if you can access SSH by using:
<pre><code><span class="command">ssh</span> <span class="secondary">hello</span>@amiopen.now</code></pre> <pre><code><span class="command">ssh</span> <span class="secondary">hello</span>@amiopen.now</code></pre>
</i> </i>
</main> {% endblock %}
<script defer>
const $copyButton = document.getElementById("copy-ip");
const ip = "{{ip}}";
copyButton.addEventListener("click", () => { {% block scripts %}
navigator.clipboard.writeText(ip); <script defer>
}); const $copyButton = document.getElementById("copy-ip");
</script> const ip = "{{ip}}";
</body>
</html> copyButton.addEventListener("click", () => {
navigator.clipboard.writeText(ip);
});
</script>
{% endblock %}