chore: updated styles, gitignore, and handlers for images in readmes
1a0f5b60
4 file(s) · +13 −2
| 29 | 29 | apps/posts/posts |
|
| 30 | 30 | apps/shrink/shrink |
|
| 31 | 31 | apps/sipp/sipp |
|
| 32 | + | apps/kepler/kepler |
| 1 | 1 | package main |
|
| 2 | 2 | ||
| 3 | 3 | import ( |
|
| 4 | + | "mime" |
|
| 4 | 5 | "net/http" |
|
| 6 | + | "path" |
|
| 5 | 7 | "strconv" |
|
| 6 | 8 | "strings" |
|
| 7 | 9 | ) |
|
| 139 | 141 | return |
|
| 140 | 142 | } |
|
| 141 | 143 | ct := http.DetectContentType(data) |
|
| 144 | + | // http.DetectContentType can't sniff SVG (returns text/xml or |
|
| 145 | + | // text/plain), which browsers won't render in <img>. Trust the |
|
| 146 | + | // extension for types the sniffer gets wrong. |
|
| 147 | + | if ext := strings.ToLower(path.Ext(subPath)); ext != "" { |
|
| 148 | + | if byExt := mime.TypeByExtension(ext); byExt != "" { |
|
| 149 | + | ct = byExt |
|
| 150 | + | } |
|
| 151 | + | } |
|
| 142 | 152 | w.Header().Set("Content-Type", ct) |
|
| 143 | 153 | _, _ = w.Write(data) |
|
| 144 | 154 | } |
|
Binary file — no preview.
| 23 | 23 | --border: #333; |
|
| 24 | 24 | --link: #ffffff; |
|
| 25 | 25 | --add-bg: #14241a; |
|
| 26 | - | --add-fg: #7ee787; |
|
| 26 | + | --add-fg: #FFC98F; |
|
| 27 | 27 | --del-bg: #2a1818; |
|
| 28 | - | --del-fg: #ff8585; |
|
| 28 | + | --del-fg: #538888; |
|
| 29 | 29 | --mono: "Commit Mono", ui-monospace, SFMono-Regular, Menlo, monospace; |
|
| 30 | 30 | } |
|
| 31 | 31 |