Export the reviewed allowlisted snapshot from private source commit 05928cebd01b586cf9e9d4b8c8537a7605a6068c. This records the exact candidate, bounded capacity result, stateful migration scratch requirement, authenticated batch identity proof, and immediate live acceptance evidence. AI-Assisted: OpenAI Codex Signed-off-by: Cole Speelman <crspeelman@gmail.com>
33 lines
1.0 KiB
Go
33 lines
1.0 KiB
Go
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
package httpserver
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
|
|
"gamertan.com/observatory/internal/site"
|
|
)
|
|
|
|
func (s *Server) webManifest(w http.ResponseWriter, r *http.Request) {
|
|
serveFixedBody(w, r, site.WebManifest(), "application/manifest+json")
|
|
}
|
|
|
|
func (s *Server) serviceWorker(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("Cache-Control", "no-cache")
|
|
w.Header().Set("Service-Worker-Allowed", "/")
|
|
serveFixedBody(w, r, site.ServiceWorker(), "text/javascript; charset=utf-8")
|
|
}
|
|
|
|
func (s *Server) offlineShell(w http.ResponseWriter, r *http.Request) {
|
|
s.renderHTML(w, r, http.StatusOK, site.Offline(site.OfflineView{Head: s.head("Offline — Gamertan Observatory", "Observatory is temporarily unreachable.", "/offline/")}))
|
|
}
|
|
|
|
func serveFixedBody(w http.ResponseWriter, r *http.Request, body []byte, contentType string) {
|
|
w.Header().Set("Content-Type", contentType)
|
|
w.Header().Set("Content-Length", fmt.Sprintf("%d", len(body)))
|
|
if r.Method != http.MethodHead {
|
|
_, _ = w.Write(body)
|
|
}
|
|
}
|