diff options
Diffstat (limited to 'internal/port/main.go')
| -rw-r--r-- | internal/port/main.go | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/internal/port/main.go b/internal/port/main.go index 267df44..763057b 100644 --- a/internal/port/main.go +++ b/internal/port/main.go | |||
| @@ -18,12 +18,12 @@ import ( | |||
| 18 | ) | 18 | ) |
| 19 | 19 | ||
| 20 | type AssetList struct { | 20 | type AssetList struct { |
| 21 | Style string | 21 | Style string |
| 22 | JS string | 22 | JS string |
| 23 | FontW string | 23 | FontRegularW string |
| 24 | FontW2 string | 24 | FontRegularW2 string |
| 25 | PropFontW string | 25 | FontBoldW string |
| 26 | PropFontW2 string | 26 | FontBoldW2 string |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | type startTemplateVariables struct { | 29 | type startTemplateVariables struct { |
| @@ -136,29 +136,29 @@ func ListenAndServe(bind, startpagefile string, robotsfile string, robotsdebug b | |||
| 136 | // | 136 | // |
| 137 | // Fonts | 137 | // Fonts |
| 138 | 138 | ||
| 139 | fontdataw, err := box.Find("iosevka-term-ss03-regular.woff") | 139 | fontRegularWData, err := box.Find("iosevka-fixed-ss03-regular.woff") |
| 140 | if err != nil { | 140 | if err != nil { |
| 141 | fontdataw = []byte{} | 141 | fontRegularWData = []byte{} |
| 142 | } | 142 | } |
| 143 | fontwAsset := fmt.Sprintf("/iosevka-term-ss03-regular-%x.woff", md5.Sum(fontdataw)) | 143 | fontRegularWAsset := fmt.Sprintf("/iosevka-fixed-ss03-regular-%x.woff", md5.Sum(fontRegularWData)) |
| 144 | 144 | ||
| 145 | fontdataw2, err := box.Find("iosevka-term-ss03-regular.woff2") | 145 | fontRegularW2Data, err := box.Find("iosevka-fixed-ss03-regular.woff2") |
| 146 | if err != nil { | 146 | if err != nil { |
| 147 | fontdataw2 = []byte{} | 147 | fontRegularW2Data = []byte{} |
| 148 | } | 148 | } |
| 149 | fontw2Asset := fmt.Sprintf("/iosevka-term-ss03-regular-%x.woff2", md5.Sum(fontdataw2)) | 149 | fontRegularW2Asset := fmt.Sprintf("/iosevka-fixed-ss03-regular-%x.woff2", md5.Sum(fontRegularW2Data)) |
| 150 | 150 | ||
| 151 | propfontdataw, err := box.Find("iosevka-aile-regular.woff") | 151 | fontBoldWData, err := box.Find("iosevka-fixed-ss03-bold.woff") |
| 152 | if err != nil { | 152 | if err != nil { |
| 153 | propfontdataw = []byte{} | 153 | fontBoldWData = []byte{} |
| 154 | } | 154 | } |
| 155 | propfontwAsset := fmt.Sprintf("/iosevka-aile-regular-%x.woff", md5.Sum(propfontdataw)) | 155 | fontBoldWAsset := fmt.Sprintf("/iosevka-fixed-ss03-bold-%x.woff", md5.Sum(fontBoldWData)) |
| 156 | 156 | ||
| 157 | propfontdataw2, err := box.Find("iosevka-aile-regular.woff2") | 157 | fontBoldW2Data, err := box.Find("iosevka-fixed-ss03-bold.woff2") |
| 158 | if err != nil { | 158 | if err != nil { |
| 159 | propfontdataw2 = []byte{} | 159 | fontBoldW2Data = []byte{} |
| 160 | } | 160 | } |
| 161 | propfontw2Asset := fmt.Sprintf("/iosevka-aile-regular-%x.woff2", md5.Sum(propfontdataw2)) | 161 | fontBoldW2Asset := fmt.Sprintf("/iosevka-fixed-ss03-bold-%x.woff2", md5.Sum(fontBoldW2Data)) |
| 162 | 162 | ||
| 163 | // | 163 | // |
| 164 | // Stylesheet | 164 | // Stylesheet |
| @@ -277,12 +277,12 @@ func ListenAndServe(bind, startpagefile string, robotsfile string, robotsdebug b | |||
| 277 | }) | 277 | }) |
| 278 | 278 | ||
| 279 | assets := AssetList{ | 279 | assets := AssetList{ |
| 280 | Style: styleAsset, | 280 | Style: styleAsset, |
| 281 | JS: jsAsset, | 281 | JS: jsAsset, |
| 282 | FontW: fontwAsset, | 282 | FontRegularW: fontRegularWAsset, |
| 283 | FontW2: fontw2Asset, | 283 | FontRegularW2: fontRegularW2Asset, |
| 284 | PropFontW: propfontwAsset, | 284 | FontBoldW: fontBoldWAsset, |
| 285 | PropFontW2: propfontw2Asset, | 285 | FontBoldW2: fontBoldW2Asset, |
| 286 | } | 286 | } |
| 287 | 287 | ||
| 288 | http.Handle("/", gziphandler.GzipHandler(DefaultHandler(startpageTpl, startpagetext, assets))) | 288 | http.Handle("/", gziphandler.GzipHandler(DefaultHandler(startpageTpl, startpagetext, assets))) |
| @@ -292,10 +292,10 @@ func ListenAndServe(bind, startpagefile string, robotsfile string, robotsdebug b | |||
| 292 | http.Handle("/favicon.ico", gziphandler.GzipHandler(FaviconHandler(favicondata))) | 292 | http.Handle("/favicon.ico", gziphandler.GzipHandler(FaviconHandler(favicondata))) |
| 293 | http.Handle(styleAsset, gziphandler.GzipHandler(StyleHandler(styledata))) | 293 | http.Handle(styleAsset, gziphandler.GzipHandler(StyleHandler(styledata))) |
| 294 | http.Handle(jsAsset, gziphandler.GzipHandler(JavaScriptHandler(jsdata))) | 294 | http.Handle(jsAsset, gziphandler.GzipHandler(JavaScriptHandler(jsdata))) |
| 295 | http.HandleFunc(fontwAsset, FontHandler(false, fontdataw)) | 295 | http.HandleFunc(fontRegularWAsset, FontHandler(false, fontRegularWData)) |
| 296 | http.HandleFunc(fontw2Asset, FontHandler(true, fontdataw2)) | 296 | http.HandleFunc(fontRegularW2Asset, FontHandler(true, fontRegularW2Data)) |
| 297 | http.HandleFunc(propfontwAsset, FontHandler(false, propfontdataw)) | 297 | http.HandleFunc(fontBoldWAsset, FontHandler(false, fontBoldWData)) |
| 298 | http.HandleFunc(propfontw2Asset, FontHandler(true, propfontdataw2)) | 298 | http.HandleFunc(fontBoldW2Asset, FontHandler(true, fontBoldW2Data)) |
| 299 | //http.Handle("/assets/", http.StripPrefix("/assets/", http.FileServer(http.Dir("assets/")))) | 299 | //http.Handle("/assets/", http.StripPrefix("/assets/", http.FileServer(http.Dir("assets/")))) |
| 300 | 300 | ||
| 301 | return http.ListenAndServe(bind, nil) | 301 | return http.ListenAndServe(bind, nil) |
