2024-05-06 07:20:30 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"embed"
|
|
|
|
"html/template"
|
|
|
|
)
|
|
|
|
|
2024-05-28 23:30:59 +00:00
|
|
|
// https://stackoverflow.com/questions/70193820/why-isnt-go-embedding-files
|
|
|
|
//
|
|
|
|
//go:embed templates/*
|
2024-05-06 07:20:30 +00:00
|
|
|
var tmpls embed.FS
|
|
|
|
|
2024-06-23 13:43:33 +00:00
|
|
|
func getServeHtml() (*template.Template, error) {
|
2024-05-28 23:30:59 +00:00
|
|
|
var t *template.Template
|
|
|
|
data, err := tmpls.ReadFile("templates/success.html")
|
|
|
|
if err != nil {
|
|
|
|
return t, err
|
|
|
|
}
|
|
|
|
return template.New("").Parse(string(data))
|
2024-05-06 07:20:30 +00:00
|
|
|
}
|
|
|
|
|
2024-06-23 13:43:33 +00:00
|
|
|
func getDefaultHtml() ([]byte, error) {
|
2024-05-28 23:30:59 +00:00
|
|
|
var data []byte
|
|
|
|
var err error
|
|
|
|
data, err = tmpls.ReadFile("templates/default.html")
|
|
|
|
if err != nil {
|
|
|
|
return data, err
|
|
|
|
}
|
|
|
|
return data, nil
|
2024-05-06 07:20:30 +00:00
|
|
|
}
|