fix: copy button (#6)

Reviewed-on: yw5n/yw5ncom#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

@ -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) {