Add favicons, serve static files
2
.gitignore
vendored
|
@ -204,4 +204,4 @@ Temporary Items
|
|||
|
||||
# User specific
|
||||
.idea/
|
||||
static/style.css
|
||||
static/css/style.css
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"scripts": {
|
||||
"tailwind": "npx tailwindcss -i ./static/input.css -o ./static/style.css --watch"
|
||||
"dev": "npx tailwindcss -i ./static/css/input.css -o ./static/css/style.css --watch",
|
||||
"build": "npx tailwindcss -i ./static/css/input.css -o ./static/css/style.css"
|
||||
},
|
||||
"devDependencies": {
|
||||
"prettier": "^2.7.1",
|
||||
|
|
|
@ -6,5 +6,5 @@ import (
|
|||
|
||||
func setupRouter(router *chi.Mux) {
|
||||
router.Get("/", launchpad)
|
||||
router.Get("/static/style.css", serveStyleCss)
|
||||
serveStatic(router, "static")
|
||||
}
|
||||
|
|
|
@ -14,7 +14,3 @@ type LaunchpadInformation struct {
|
|||
func launchpad(w http.ResponseWriter, r *http.Request) {
|
||||
files.ParseHtml(w, "index.gohtml", LaunchpadInformation{Title: "Launchpad", Bookmarks: bookmark.Bookmarks})
|
||||
}
|
||||
|
||||
func serveStyleCss(w http.ResponseWriter, r *http.Request) {
|
||||
http.ServeFile(w, r, "static/style.css")
|
||||
}
|
||||
|
|
33
server/static.go
Normal file
|
@ -0,0 +1,33 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"github.com/go-chi/chi/v5"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func serveStatic(r chi.Router, folder string) {
|
||||
workDir, _ := os.Getwd()
|
||||
fileServer(r, "/"+folder, http.Dir(filepath.Join(workDir, folder)))
|
||||
}
|
||||
|
||||
func fileServer(r chi.Router, path string, root http.FileSystem) {
|
||||
if strings.ContainsAny(path, "{}*") {
|
||||
panic("FileServer does not permit any URL parameters.")
|
||||
}
|
||||
|
||||
if path != "/" && path[len(path)-1] != '/' {
|
||||
r.Get(path, http.RedirectHandler(path+"/", 301).ServeHTTP)
|
||||
path += "/"
|
||||
}
|
||||
path += "*"
|
||||
|
||||
r.Get(path, func(w http.ResponseWriter, r *http.Request) {
|
||||
rctx := chi.RouteContext(r.Context())
|
||||
pathPrefix := strings.TrimSuffix(rctx.RoutePattern(), "/*")
|
||||
fs := http.StripPrefix(pathPrefix, http.FileServer(root))
|
||||
fs.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
BIN
static/favicon/android-chrome-192x192.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
static/favicon/android-chrome-512x512.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
static/favicon/apple-touch-icon.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
9
static/favicon/browserconfig.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<browserconfig>
|
||||
<msapplication>
|
||||
<tile>
|
||||
<square150x150logo src="/mstile-150x150.png"/>
|
||||
<TileColor>#da532c</TileColor>
|
||||
</tile>
|
||||
</msapplication>
|
||||
</browserconfig>
|
BIN
static/favicon/favicon-16x16.png
Normal file
After Width: | Height: | Size: 589 B |
BIN
static/favicon/favicon-32x32.png
Normal file
After Width: | Height: | Size: 786 B |
BIN
static/favicon/favicon.ico
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
static/favicon/mstile-150x150.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
27
static/favicon/safari-pinned-tab.svg
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
||||
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
|
||||
width="558.000000pt" height="558.000000pt" viewBox="0 0 558.000000 558.000000"
|
||||
preserveAspectRatio="xMidYMid meet">
|
||||
<metadata>
|
||||
Created by potrace 1.14, written by Peter Selinger 2001-2017
|
||||
</metadata>
|
||||
<g transform="translate(0.000000,558.000000) scale(0.100000,-0.100000)"
|
||||
fill="#000000" stroke="none">
|
||||
<path d="M1602 4128 c-39 -10 -73 -41 -96 -86 -14 -27 -16 -80 -16 -386 0
|
||||
-368 2 -391 43 -434 55 -59 -25 -56 1252 -55 1275 0 1198 -4 1252 55 41 43 43
|
||||
66 43 432 0 345 0 353 -22 396 -16 32 -35 51 -65 66 l-42 21 -1158 0 c-646 0
|
||||
-1173 -4 -1191 -9z m1734 -374 c79 -52 69 -171 -18 -210 -51 -23 -107 -7 -143
|
||||
40 -59 77 -5 186 93 186 23 0 54 -7 68 -16z m329 -6 c69 -54 65 -152 -8 -197
|
||||
-40 -24 -65 -26 -110 -7 -35 14 -66 53 -73 91 -6 35 23 98 54 118 39 24 103
|
||||
22 137 -5z"/>
|
||||
<path d="M1632 2839 c-46 -6 -84 -30 -116 -73 -20 -26 -21 -42 -24 -398 l-3
|
||||
-370 25 -43 c17 -28 40 -50 67 -63 42 -21 49 -21 1204 -22 l1162 0 44 23 c27
|
||||
15 52 38 66 63 22 38 23 45 23 396 0 370 -2 392 -43 436 -54 59 20 55 -1222
|
||||
56 -627 1 -1159 -2 -1183 -5z m1725 -403 c51 -55 44 -133 -17 -176 -77 -55
|
||||
-190 3 -190 97 0 40 20 74 60 101 50 34 104 26 147 -22z m280 32 c76 -22 102
|
||||
-134 45 -190 -39 -39 -91 -51 -134 -29 -89 44 -100 152 -20 206 37 25 59 28
|
||||
109 13z"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.4 KiB |
19
static/favicon/site.webmanifest
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"name": "",
|
||||
"short_name": "",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/android-chrome-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "/android-chrome-512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
}
|
||||
],
|
||||
"theme_color": "#ffffff",
|
||||
"background_color": "#ffffff",
|
||||
"display": "standalone"
|
||||
}
|
|
@ -5,7 +5,16 @@
|
|||
<meta charset="UTF-8" />
|
||||
<title>{{ template "title" . }}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="stylesheet" href="/static/style.css" />
|
||||
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/static/favicon/apple-touch-icon.png" />
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/static/favicon/favicon-32x32.png" />
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/static/favicon/favicon-16x16.png" />
|
||||
<link rel="manifest" href="/static/favicon/site.webmanifest" />
|
||||
<link rel="mask-icon" href="/static/favicon/safari-pinned-tab.svg" color="#1e293b" />
|
||||
<meta name="msapplication-TileColor" content="#da532c" />
|
||||
<meta name="theme-color" content="#da532c" />
|
||||
|
||||
<link rel="stylesheet" href="/static/css/style.css" />
|
||||
</head>
|
||||
|
||||
<body></body>
|
||||
|
|