Skip to content

Commit 8019e11

Browse files
committed
fix PWA for local images and icons; fix images for local only; fix CSP to account for new local images/icons;
1 parent e642fda commit 8019e11

12 files changed

Lines changed: 520 additions & 25 deletions

File tree

internal/server/middleware_security.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func buildCSP(nonce string) string {
3737
"script-src 'self' https://cdn.jsdelivr.net 'nonce-" + nonce + "'; " +
3838
"style-src 'self' https://cdn.jsdelivr.net https://fonts.googleapis.com 'unsafe-inline'; " +
3939
"font-src 'self' https://fonts.gstatic.com; " +
40-
"img-src 'self' https://c.pdn.st data: blob:; " +
40+
"img-src 'self' data: blob:; " +
4141
"connect-src 'self' ws: wss: https://cdn.jsdelivr.net; " +
4242
"manifest-src 'self'; " +
4343
"frame-src 'none'; " +
@@ -81,6 +81,12 @@ func securityHeaders(next http.Handler) http.Handler {
8181
w.Header().Set("Content-Security-Policy", buildCSP(nonce))
8282
}
8383

84+
// set some headers for me
85+
w.Header().Set("X-Powered-By", "PodNest")
86+
w.Header().Set("X-Developed-By", "Kevin Pirnie <iam@kevinpirnie.com>")
87+
w.Header().Set("X-Shameless-Link", "https://kevinpirnie.com/")
88+
89+
// serve the request to the next handler
8490
next.ServeHTTP(w, r)
8591

8692
})

internal/server/routes.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ func (s *Server) routes() http.Handler {
5656
http.ServeFile(w, r, p)
5757
})
5858

59+
// serve /favicon.ico from the embedded brand images so the browser's
60+
// automatic root-level request resolves instead of 404ing
61+
mux.HandleFunc("/favicon.ico", func(w http.ResponseWriter, r *http.Request) {
62+
http.ServeFileFS(w, r, web.Static, "images/favicon.ico")
63+
})
64+
5965
// serve the PWA manifest dynamically so its name reflects the host — an
6066
// exact path so it wins over the /static/ subtree handler above
6167
mux.HandleFunc("/static/manifest.json", s.handleManifest)

web/apidocs/api-docs.html

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,19 @@
88
<head>
99
<meta charset="UTF-8">
1010
<meta name="viewport" content="width=device-width, initial-scale=1.0">
11-
<title>PodNest — API Reference</title>
12-
<link rel="icon" type="image/svg+xml" href="https://c.pdn.st/logos/podnest.svg">
11+
<meta name="generator" content="PodNest">
12+
<meta name="author" content="Kevin Pirnie, iam@kevinpirnie.com">
13+
<meta name='copyright' content='Kevin Pirnie'>
14+
<title>PodNest ~ API Reference</title>
15+
<link rel="icon" type="image/svg+xml" sizes="16x16" href="/static/images/logo.svg">
16+
<link rel="icon" type="image/svg+xml" sizes="32x32" href="/static/images/logo.svg">
17+
<link rel="icon" type="image/svg+xml" sizes="48x48" href="/static/images/logo.svg">
18+
<link rel="icon" type="image/svg+xml" sizes="192x192" href="/static/images/logo.svg">
19+
<link rel="alternate icon" type="image/svg+xml" href="/static/images/logo.svg">
20+
<link rel="apple-touch-icon" sizes="180x180" href="/static/images/logo-192.png">
1321

14-
<!-- panel typography — allowed by CSP (style-src fonts.googleapis.com, font-src fonts.gstatic.com) -->
15-
<link rel="stylesheet"
16-
href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap">
22+
<!-- panel typography -->
23+
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap">
1724

1825
<!--
1926
Scalar theme mapped onto the PodNest palette (web/static/src/css/variables.css).
@@ -111,7 +118,7 @@
111118

112119
<div id="api-topbar">
113120
<a href="/" class="brand">
114-
<img src="https://c.pdn.st/logos/podnest.svg" alt="PodNest">
121+
<img src="/static/images/logo.svg" alt="PodNest">
115122
<span><span class="pod">Pod</span><span class="nest">Nest</span> — API Reference</span>
116123
</a>
117124
<a href="/" class="back-btn">

web/static/images/favicon.ico

264 KB
Binary file not shown.

web/static/images/logo-192.png

49.6 KB
Loading

web/static/images/logo-512.png

244 KB
Loading

0 commit comments

Comments
 (0)