Skip to content

Commit fc802d2

Browse files
ekzyisclaude
andcommitted
Add PWA standalone mode
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 79e1dc5 commit fc802d2

3 files changed

Lines changed: 19 additions & 0 deletions

File tree

public/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
<html>
33
<head>
44
<meta name="viewport" content="width=device-width, initial-scale=1">
5+
<meta name="theme-color" content="#111">
56
<title>npipe</title>
67
<link rel="stylesheet" href="/style.css">
8+
<link rel="manifest" href="/manifest.json">
79
</head>
810
<body>
911
<main>

public/manifest.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "npipe",
3+
"short_name": "npipe",
4+
"description": "Share files on your network",
5+
"start_url": "/",
6+
"display": "standalone",
7+
"background_color": "#111",
8+
"theme_color": "#111"
9+
}

server.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ var styleCSS string
2020
//go:embed public/app.js
2121
var appJS string
2222

23+
//go:embed public/manifest.json
24+
var manifestJSON string
25+
2326
var commit = getCommit()
2427

2528
func getCommit() string {
@@ -66,6 +69,11 @@ func setupRoutes() {
6669
w.Write([]byte(appJS))
6770
})
6871

72+
http.HandleFunc("/manifest.json", func(w http.ResponseWriter, r *http.Request) {
73+
w.Header().Set("Content-Type", "application/manifest+json")
74+
w.Write([]byte(manifestJSON))
75+
})
76+
6977
http.HandleFunc("/files", func(w http.ResponseWriter, r *http.Request) {
7078
ip := getClientIP(r)
7179
files := store.List(ip)

0 commit comments

Comments
 (0)