| 23 | ) |
| 24 | |
| 25 | func fallback(msg string) []byte { |
| 26 | b := new(bytes.Buffer) |
| 27 | fmt.Fprintf(b, `<!DOCTYPE html>`) |
| 28 | fmt.Fprintf(b, `<html>`) |
| 29 | fmt.Fprintf(b, `<head><meta charset="utf-8"><title>Subtrace</title></head>`) |
| 30 | fmt.Fprintf(b, `<style>* { box-sizing: border-box; }</style>`) |
| 31 | fmt.Fprintf(b, `<style>body { margin: 2rem 1rem; display: flex; justify-content: center; font-family: monospace; font-size: 11px; }</style>`) |
| 32 | fmt.Fprintf(b, `<style>div { padding: 1rem; width: 100%%; max-width: 24rem; border: 1px solid #00000020; border-radius: 2px; text-align: center; }</style>`) |
| 33 | fmt.Fprintf(b, `<body><div>%s</div></body>`, msg) |
| 34 | fmt.Fprintf(b, `</html>`) |
| 35 | return b.Bytes() |
| 36 | } |
| 37 | |
| 38 | //go:embed bundle |
| 39 | var bundle embed.FS |