From ea780d39928091224d92692b9f62c8cb4e4e5263 Mon Sep 17 00:00:00 2001 From: ange Date: Sat, 19 Apr 2025 08:50:37 +0000 Subject: [PATCH 1/3] fix: copy button --- html/contact.html | 2 +- src/route.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/html/contact.html b/html/contact.html index 29254f2..3de4dd7 100644 --- a/html/contact.html +++ b/html/contact.html @@ -10,7 +10,7 @@ } function copyFile(id) { - fetch(document.getElementById(id).childNodes[1].href).then(f => { + fetch(document.getElementById(id).childNodes[0].href).then(f => { f.text().then(t => { navigator.clipboard.writeText(t); }) diff --git a/src/route.go b/src/route.go index 19ce2c3..664e7af 100644 --- a/src/route.go +++ b/src/route.go @@ -18,7 +18,7 @@ var routes = []struct { {[]string{"GET"}, url(""), index}, {[]string{"GET"}, url("/(pgp.asc|ssh)"), static}, {[]string{"GET"}, url("/static/.+"), static}, - {[]string{"GET"}, url("/(.+\\.css)"), css}, + {[]string{"GET"}, url("/(.+\\.(css))"), file}, {[]string{"GET"}, url("/([^/]+)"), html}, } -- 2.45.2 From bc4722dbfd05390880842cb46105188b7d80ff31 Mon Sep 17 00:00:00 2001 From: ange Date: Tue, 22 Apr 2025 02:15:02 +0000 Subject: [PATCH 2/3] fix: copy button broken --- html/contact.html | 2 +- src/route.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/html/contact.html b/html/contact.html index 3de4dd7..29254f2 100644 --- a/html/contact.html +++ b/html/contact.html @@ -10,7 +10,7 @@ } function copyFile(id) { - fetch(document.getElementById(id).childNodes[0].href).then(f => { + fetch(document.getElementById(id).childNodes[1].href).then(f => { f.text().then(t => { navigator.clipboard.writeText(t); }) diff --git a/src/route.go b/src/route.go index 664e7af..19ce2c3 100644 --- a/src/route.go +++ b/src/route.go @@ -18,7 +18,7 @@ var routes = []struct { {[]string{"GET"}, url(""), index}, {[]string{"GET"}, url("/(pgp.asc|ssh)"), static}, {[]string{"GET"}, url("/static/.+"), static}, - {[]string{"GET"}, url("/(.+\\.(css))"), file}, + {[]string{"GET"}, url("/(.+\\.css)"), css}, {[]string{"GET"}, url("/([^/]+)"), html}, } -- 2.45.2 From f031c3d703bcd78adb790865c1df8c1074e65c5b Mon Sep 17 00:00:00 2001 From: ange Date: Tue, 22 Jul 2025 17:33:51 +0000 Subject: [PATCH 3/3] feat: remove matrix --- README.md | 1 + aliases.txt | 6 +++--- go.mod | 2 +- html/contact.html | 5 ----- manifests/bin/deploy.sh | 27 +++++++++++++-------------- src/aliases.go | 25 ------------------------- src/{tmpl.go => util.go} | 21 ++++++++++++++++++++- ssh | 2 +- tmpl/vars.tmpl | 4 ---- 9 files changed, 39 insertions(+), 54 deletions(-) create mode 100644 README.md delete mode 100644 src/aliases.go rename src/{tmpl.go => util.go} (64%) diff --git a/README.md b/README.md new file mode 100644 index 0000000..a46e4b2 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# yw5n.com diff --git a/aliases.txt b/aliases.txt index a9a409e..4afd155 100644 --- a/aliases.txt +++ b/aliases.txt @@ -1,3 +1,3 @@ -termux.sh https://git.gmoker.com/ange/termux/raw/branch/main/install.sh -dotfiles.sh https://git.gmoker.com/ange/dotfiles -arch.sh https://git.gmoker.com/ange/arch +termux.sh https://git.gmoker.com/ange/termux/raw/branch/main/install.sh +dotfiles https://git.gmoker.com/ange/dotfiles +arch https://git.gmoker.com/ange/arch diff --git a/go.mod b/go.mod index e7f9816..8daf23b 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module main -go 1.24.1 +go 1.24 diff --git a/html/contact.html b/html/contact.html index 29254f2..337f759 100644 --- a/html/contact.html +++ b/html/contact.html @@ -24,11 +24,6 @@
- - - - - diff --git a/manifests/bin/deploy.sh b/manifests/bin/deploy.sh index 2cc0c9e..d82a9d7 100755 --- a/manifests/bin/deploy.sh +++ b/manifests/bin/deploy.sh @@ -1,36 +1,35 @@ #!/bin/bash -e set -o pipefail -function kapply() { +kapply() { for f in "$@"; do - kubectl apply -f <(envsubst < "manifests/$f") + kubectl apply --server-side \ + -f<(envsubst "$(env | sed 's/^/$/')" < "manifests/$f") done }; export -f kapply -function kcreatesec() { - kubectl create secret generic --dry-run=client -oyaml "$@" | kubectl replace -f- +kcreatesec() { + kubectl apply --server-side \ + -f<(kubectl create secret generic --dry-run=client -oyaml "$@") }; export -f kcreatesec -function kcreatecm() { - kubectl create configmap --dry-run=client -oyaml "$@" | kubectl replace -f- +kcreatecm() { + kubectl apply --server-side \ + -f<(kubectl create configmap --dry-run=client -oyaml "$@") }; export -f kcreatecm -function kgseckey() { +kgseckey() { local sec="$1"; shift local key="$1"; shift - if ! kubectl get secret "$sec" -ojson | jq -re ".data.\"$key\" // empty" | base64 -d; then - return 1 - fi + kubectl get secret "$sec" -ojson | jq -re ".data.\"$key\"" | base64 -d }; export -f kgseckey -function kgcmkey() { +kgcmkey() { local cm="$1"; shift local key="$1"; shift - if ! kubectl get configmap "$cm" -ojson | jq -re ".data.\"$key\" // empty"; then - return 1 - fi + kubectl get configmap "$cm" -ojson | jq -re ".data.\"$key\"" }; export -f kgcmkey diff --git a/src/aliases.go b/src/aliases.go deleted file mode 100644 index 93a9761..0000000 --- a/src/aliases.go +++ /dev/null @@ -1,25 +0,0 @@ -package main - -import ( - "log" - "os" - "strings" -) - -var ALIASES map[string]string - -func generateAliases() { - f, err := os.ReadFile("aliases.txt") - if err != nil { - log.Fatal(err) - } - - ALIASES = make(map[string]string) - for l := range strings.SplitSeq(string(f), "\n") { - sp := strings.Fields(l) - - if len(sp) == 2 { - ALIASES[sp[0]] = sp[1] - } - } -} diff --git a/src/tmpl.go b/src/util.go similarity index 64% rename from src/tmpl.go rename to src/util.go index 56de3e7..9ba07b9 100644 --- a/src/tmpl.go +++ b/src/util.go @@ -3,12 +3,31 @@ package main import ( "bytes" "html/template" + "log" + "os" "path/filepath" "regexp" + "strings" ) -var TMPL map[string][]byte +var ALIASES map[string]string +func generateAliases() { + f, err := os.ReadFile("aliases.txt") + if err != nil { + log.Fatal(err) + } + ALIASES = make(map[string]string) + for l := range strings.SplitSeq(string(f), "\n") { + sp := strings.Fields(l) + + if len(sp) == 2 { + ALIASES[sp[0]] = sp[1] + } + } +} + +var TMPL map[string][]byte func generateTmpl() { files, _ := filepath.Glob("html/*.html") re := regexp.MustCompile("html/(.+).html") diff --git a/ssh b/ssh index c78f7dd..70e736f 100644 --- a/ssh +++ b/ssh @@ -1 +1 @@ -ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDUccdlgUHzV+AhWDyjwcG4QwSNbybIV8MF7c6XpKQl4 +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDUccdlgUHzV+AhWDyjwcG4QwSNbybIV8MF7c6XpKQl4 ange@yw5n.com diff --git a/tmpl/vars.tmpl b/tmpl/vars.tmpl index 346008e..97ca02e 100644 --- a/tmpl/vars.tmpl +++ b/tmpl/vars.tmpl @@ -1,7 +1,3 @@ -{{define "matrix"}} -@ange:gmoker.com -{{end}} - {{define "discord"}} @elrilio {{end}} -- 2.45.2
Matrix (Element){{template "matrix"}}
Discord {{template "discord"}}