diff --git a/app/gopherbook/main.go b/app/gopherbook/main.go index 1173615..d4e695e 100644 --- a/app/gopherbook/main.go +++ b/app/gopherbook/main.go @@ -6,6 +6,7 @@ import ( "crypto/cipher" "crypto/rand" "crypto/sha256" + "embed" "encoding/base64" "encoding/json" "encoding/xml" @@ -26,6 +27,9 @@ import ( yzip "github.com/yeka/zip" ) +//go:embed templates/index.html +var templateFS embed.FS + // ComicInfo represents the standard ComicInfo.xml metadata type ComicInfo struct { XMLName xml.Name `xml:"ComicInfo"` @@ -1751,1823 +1755,11 @@ func encryptAES(plaintext []byte, key []byte) ([]byte, error) { } func serveUI(w http.ResponseWriter, r *http.Request) { + data, err := templateFS.ReadFile("templates/index.html") + if err != nil { + http.Error(w, "Template not found", http.StatusInternalServerError) + return + } w.Header().Set("Content-Type", "text/html") - w.Write([]byte(getHTML())) -} - -func getHTML() string { - return ` - -
- - -