fix: copy button (#6)
All checks were successful
/ deploy (push) Successful in 39s

Reviewed-on: #6
This commit is contained in:
ange 2025-04-22 02:18:56 +00:00
parent abd9218561
commit 9420df0a4c
11 changed files with 29 additions and 28 deletions

View File

@ -11,6 +11,7 @@ COPY html/ html/
COPY css/ css/
COPY static/ static/
COPY tmpl/ tmpl/
COPY ssh pgp.asc .
COPY aliases.txt aliases.txt
EXPOSE 3000
CMD ["./app"]

View File

@ -1,5 +1,3 @@
ssh /static/ssh
pgp /static/pgp.asc
termux.sh https://git.gmoker.com/ange/termux/raw/branch/main/install.sh
dotfiles.sh https://git.gmoker.com/ange/.dotfiles
dotfiles.sh https://git.gmoker.com/ange/dotfiles
arch.sh https://git.gmoker.com/ange/arch

View File

@ -2,7 +2,21 @@
<html>
<head>
{{template "head.tmpl" .}}
<script src="copy.js"></script>
<script>
function copyElem(id, r='') {
navigator.clipboard.writeText(
document.getElementById(id).innerText.replaceAll(r, ''),
);
}
function copyFile(id) {
fetch(document.getElementById(id).childNodes[1].href).then(f => {
f.text().then(t => {
navigator.clipboard.writeText(t);
})
})
}
</script>
</head>
<body>
{{template "header.tmpl" .}}

View File

@ -10,7 +10,7 @@
<div id="nav">
<img src="static/2404.webp" alt="Ange DUHAYON" width="128"><br>
{{template "phone"}}<br>
<a href="//yw5n.com">yw5n.com<br>
<a href="https://yw5n.com">yw5n.com<br>
{{template "email"}}<br>
{{template "in"}}<br>
</div>

View File

@ -1,13 +0,0 @@
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);
})
})
}

View File

@ -16,8 +16,9 @@ var routes = []struct {
handler http.HandlerFunc
}{
{[]string{"GET"}, url(""), index},
{[]string{"GET"}, url("/(pgp.asc|ssh)"), static},
{[]string{"GET"}, url("/static/.+"), static},
{[]string{"GET"}, url("/(.+\\.(css|js))"), file},
{[]string{"GET"}, url("/(.+\\.css)"), css},
{[]string{"GET"}, url("/([^/]+)"), html},
}

View File

@ -13,8 +13,8 @@ func static(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, r.URL.Path)
}
func file(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, filepath.Join(getParam(r, 1), getParam(r, 0)))
func css(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, filepath.Join("css", getParam(r, 0)))
}
func html(w http.ResponseWriter, r *http.Request) {

View File

View File

@ -1,7 +1,7 @@
<div id="header">
<a id="headerLink" href="/">Ange DUHAYON</a>
<span id="headerSubtitle">DevOps Engineer</span>
<span id="credits" class="right" style="font-size: .4em;">Website heavily inspired from <a href="//suckless.org/" target="_blank" rel="noreferrer noopener">suckless.org</a></span>
<span id="credits" class="right" style="font-size: .4em;">Website heavily inspired from <a href="https://suckless.org/" target="_blank" rel="noreferrer noopener">suckless.org</a></span>
</div>
<div id="menu">
{{$page := .page}}
@ -9,6 +9,6 @@
<a href="/{{.}}">{{if eq $page .}}<b>{{.}}</b>{{else}}{{.}}{{end}}</a>
{{end}}
<span class="right">
<a href="//git.gmoker.com/yw5n" target="_blank" rel="noreferrer noopener">source</a>
<a href="https://git.gmoker.com/yw5n" target="_blank" rel="noreferrer noopener">source</a>
</span>
</div>

View File

@ -1,5 +1,5 @@
{{define "matrix"}}
<a href="//app.element.io/#/user/@ange:gmoker.com" target="_blank" rel="noreferrer noopener">@ange:gmoker.com</a>
<a href="https://app.element.io/#/user/@ange:gmoker.com" target="_blank" rel="noreferrer noopener">@ange:gmoker.com</a>
{{end}}
{{define "discord"}}
@ -15,17 +15,17 @@
{{end}}
{{define "wa"}}
<a href="//wa.me/6285333559453" target="_blank" rel="noreferrer noopener">+62 853-3355-9453</a>
<a href="https://wa.me/6285333559453" target="_blank" rel="noreferrer noopener">+62 853-3355-9453</a>
{{end}}
{{define "in"}}
<a href="//www.linkedin.com/in/angedhn" target="_blank" rel="noreferrer noopener">angedhn</a>
<a href="https://www.linkedin.com/in/angedhn" target="_blank" rel="noreferrer noopener">angedhn</a>
{{end}}
{{define "pgp"}}
<a href="/static/pgp.asc" target="_blank" rel="noreferrer noopener">pgp.asc</a>
<a href="pgp.asc" target="_blank" rel="noreferrer noopener">pgp.asc</a>
{{end}}
{{define "ssh"}}
<a href="/static/ssh" target="_blank" rel="noreferrer noopener">ssh</a>
<a href="ssh" target="_blank" rel="noreferrer noopener">ssh</a>
{{end}}