Compare commits

..

No commits in common. "9d0da00371d8e542e7ee7389019d5e0d2f113859" and "b9d7553420808011abf5b1c0398e3bf5c95a9abf" have entirely different histories.

5 changed files with 19 additions and 65 deletions

View File

@ -10,7 +10,4 @@ services:
path: src/ path: src/
- action: sync+restart - action: sync+restart
path: html/ path: html/
target: html target: /html
- action: sync
path: static/
target: static

View File

@ -4,21 +4,6 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Ange DUHAYON</title> <title>Ange DUHAYON</title>
<link rel="stylesheet" href="style.css"/> <link rel="stylesheet" href="style.css"/>
<script>
function copyElem(id, r='') {
navigator.clipboard.writeText(
document.getElementById(id).innerText.replaceAll(r, ''),
);
}
function copyFile(id) {
fetch(document.getElementById(id).childNodes[0].href).then(f => {
f.text().then(t => {
navigator.clipboard.writeText(t);
})
})
}
</script>
</head> </head>
<body> <body>
<div id="header"> <div id="header">
@ -51,41 +36,13 @@
<div id="main"> <div id="main">
<table> <table>
<tr> <tr id="matrix"><td>Matrix (Element)</td><td><a href="//app.element.io/#/user/@ange:gmoker.com">@ange:gmoker.com</a></td></tr>
<td>Matrix (Element)</td> <tr id="discord"><td>Discord</td><td>@elrilio</td></tr>
<td id="matrix"><a href="//app.element.io/#/user/@ange:gmoker.com" target="_blank" rel="noreferrer noopener">@ange:gmoker.com</a></td> <tr id="phone"><td>Phone (France)</td><td><a href="tel:+33582951623">+33 5 82 95 16 23</a></td></tr>
<td><button onclick="copyElem('matrix')">Copy</button></td> <tr id="email"><td>Email</td><td><a href="mailto:ange@yw5n.com">ange@yw5n.com</a></td></tr>
</tr> <tr id="wa"><td>WhatsApp</td><td><a href="//wa.me/6285333559453">+62 853-3355-9453</a></td></tr>
<tr> <tr id="pgp"><td>PGP</td><td><a href="/static/pgp.asc">pgp.asc</a></td></tr>
<td>Discord</td> <tr id="ssh"><td>SSH</td><td><a href="/static/ssh">ssh</a></td></tr>
<td id="discord">@elrilio</td>
<td><button onclick="copyElem('discord')">Copy</button></td>
</tr>
<tr>
<td>Phone (France)</td>
<td id="phone"><a href="tel:+33582951623" target="_blank" rel="noreferrer noopener">+33 5 82 95 16 23</a></td>
<td><button onclick="copyElem('phone', / /g)">Copy</button></td>
</tr>
<tr>
<td>Email</td>
<td id="email"><a href="mailto:ange@yw5n.com" target="_blank" rel="noreferrer noopener">ange@yw5n.com</a></td>
<td><button onclick="copyElem('email')">Copy</button></td>
</tr>
<tr>
<td>WhatsApp</td>
<td id="wa"><a href="//wa.me/6285333559453" target="_blank" rel="noreferrer noopener">+62 853-3355-9453</a></td>
<td><button onclick="copyElem('wa', /[ |-]/g)">Copy</button></td>
</tr>
<tr>
<td>PGP</td>
<td id="pgp"><a href="/static/pgp.asc" target="_blank" rel="noreferrer noopener">pgp.asc</a></td>
<td><button onclick="copyFile('pgp')">Copy</button></td>
</tr>
<tr>
<td>SSH</td>
<td id="ssh"><a href="/static/ssh" target="_blank" rel="noreferrer noopener">ssh</a></td>
<td><button onclick="copyFile('ssh')">Copy</button></td>
</tr>
</table> </table>
</div> </div>

View File

@ -6,7 +6,7 @@ import (
) )
func main() { func main() {
http.HandleFunc("/", route) http.HandleFunc("/", Route)
err := http.ListenAndServe(":3000", nil) err := http.ListenAndServe(":3000", nil)
if err != nil { if err != nil {

View File

@ -15,17 +15,17 @@ var routes = []struct {
regex *regexp.Regexp regex *regexp.Regexp
handler http.HandlerFunc handler http.HandlerFunc
}{ }{
{[]string{"GET"}, url(""), index}, {[]string{"GET"}, URL(""), Index},
{[]string{"GET"}, url("/style\\.css"), style}, {[]string{"GET"}, URL("/style\\.css"), Style},
{[]string{"GET"}, url("/static/.+"), static}, {[]string{"GET"}, URL("/static/.+"), Static},
{[]string{"GET"}, url("/[^/]+"), html}, {[]string{"GET"}, URL("/[^/]+"), HTML},
} }
func url(s string) *regexp.Regexp { func URL(s string) *regexp.Regexp {
return regexp.MustCompile("^" + s + "/?$") return regexp.MustCompile("^" + s + "/?$")
} }
func route(w http.ResponseWriter, r *http.Request) { func Route(w http.ResponseWriter, r *http.Request) {
for _, rt := range routes { for _, rt := range routes {
matches := rt.regex.FindStringSubmatch(r.URL.Path) matches := rt.regex.FindStringSubmatch(r.URL.Path)
if len(matches) > 0 { if len(matches) > 0 {

View File

@ -5,18 +5,18 @@ import (
"path/filepath" "path/filepath"
) )
func index(w http.ResponseWriter, r *http.Request) { func Index(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, filepath.Join("html", "index.html")) http.ServeFile(w, r, filepath.Join("html", "index.html"))
} }
func style(w http.ResponseWriter, r *http.Request) { func Style(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "/html/style.css") http.ServeFile(w, r, "/html/style.css")
} }
func static(w http.ResponseWriter, r *http.Request) { func Static(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, r.URL.Path) http.ServeFile(w, r, r.URL.Path)
} }
func html(w http.ResponseWriter, r *http.Request) { func HTML(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, filepath.Join("html", r.URL.Path + ".html")) http.ServeFile(w, r, filepath.Join("html", r.URL.Path + ".html"))
} }