Added public keys page
This commit is contained in:
16
keys/init.go
16
keys/init.go
@@ -3,15 +3,31 @@ package keys
|
||||
import (
|
||||
"io"
|
||||
"net/http"
|
||||
"prettysunflower-website/baseTemplates"
|
||||
)
|
||||
|
||||
func InitHttpHandlers() {
|
||||
http.HandleFunc("/keys/", keysPage)
|
||||
http.HandleFunc("/ssh/", sshKey)
|
||||
http.HandleFunc("/age/", ageKey)
|
||||
http.HandleFunc("/gpg/", gpgKey)
|
||||
http.HandleFunc("/gpg/koumbit/", gpgKey)
|
||||
}
|
||||
|
||||
type TemplateData struct {
|
||||
Ssh string
|
||||
Age string
|
||||
Gpg string
|
||||
}
|
||||
|
||||
func keysPage(w http.ResponseWriter, r *http.Request) {
|
||||
baseTemplates.WithBase(w, TemplateData{
|
||||
Ssh: SSH_KEY,
|
||||
Age: AGE_KEY,
|
||||
Gpg: GPG_KEY,
|
||||
}, "templates/keys/keys.tmpl")
|
||||
}
|
||||
|
||||
func sshKey(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "text/plain")
|
||||
_, _ = io.WriteString(w, SSH_KEY)
|
||||
|
Reference in New Issue
Block a user