commit 5457f9d65e25e460fceb2154e631efd8b631ad87
parent 388897388940e66fc8b1ffdd3ef5dc7b08f9304c
Author: anon <anon@example.com>
Date: Mon, 2 Nov 2026 08:43:27 +0000
Serve the original game icon as the browser favicon
Diffstat:
6 files changed, 39 insertions(+), 4 deletions(-)
diff --git a/TODO.md b/TODO.md
@@ -3281,9 +3281,13 @@ with payloads and known client/server provenance.
See `local/earned-eighth-boundary/favicon-verified.json` and its captured
HTTP response. The earlier trace remains at
`local/earned-eight/native-20261101-161130/earned-eight-backyard-entry/1/trace.json`.
-- [ ] [P2] Extract the original executable's icon and use it as our `favicon.ico`.
- Check: the browser serves the extracted icon at `/favicon.ico` without a 404
- and displays the original game icon.
+- [x] [P0] Extract the original executable's icon and use it as our `favicon.ico`.
+ The embedded 766-byte icon preserves Clientr.exe's original 32x32 resource
+ payload. GET/HEAD and prefixed mounts pass focused HTTP tests. Fresh Chromium
+ WASM pages at `/` and `/wasm/` automatically request the icon, decode the exact
+ original pixels and retain earned progress/items without browser errors.
+ See icon provenance and
+ `local/favicon/native-20261102-004223/verified.json`.
- [ ] [P1] Retain selected lifecycle evidence across large native world replays.
Check: death/resurrection markers, including CharacterAction152 and Resurrect,
survive ordinary trace rollover while memory remains bounded. The connected
diff --git a/client/browser/index.html b/client/browser/index.html
@@ -2,6 +2,7 @@
<html lang="en">
<meta charset="utf-8">
<base href="__AO_BASE_URL__">
+<link rel="icon" href="favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover, interactive-widget=resizes-visual">
<title>Anarchy Online 14.9.1</title>
<style>
diff --git a/server/assets/favicon.ico b/server/assets/favicon.ico
Binary files differ.
diff --git a/server/assets/resources.go b/server/assets/resources.go
@@ -4,7 +4,7 @@ import "embed"
// Files contains the read-only resources shipped with the server.
//
-//go:embed anarchy-assets-14.9.1 client maps terrain.bin zone_links.yaml
+//go:embed anarchy-assets-14.9.1 client favicon.ico maps terrain.bin zone_links.yaml
var Files embed.FS
//go:embed map.js
diff --git a/server/http.go b/server/http.go
@@ -45,6 +45,7 @@ func (server *server) httpHandler() http.Handler {
mapFiles.ServeHTTP(w, r)
})
mux.HandleFunc("GET /browser-assets/{path...}", browserAsset)
+ mux.Handle("GET /favicon.ico", http.FileServerFS(resources))
mux.HandleFunc("POST /browser-launch", server.browserLaunch)
mux.HandleFunc("GET /browser-account", server.browserAccountInfo)
mux.Handle("POST /browser-account/{action}", http.NewCrossOriginProtection().Handler(http.HandlerFunc(server.browserAccount)))
diff --git a/server/http_test.go b/server/http_test.go
@@ -3,6 +3,8 @@ package main
import (
"ao/server/assets"
"bytes"
+ "crypto/sha256"
+ "fmt"
"log"
"net/http"
"net/http/httptest"
@@ -55,6 +57,9 @@ func TestHTTPHandlerMountsGameAndControls(t *testing.T) {
if game.Code != http.StatusOK || !strings.Contains(game.Body.String(), `<base href="`+baseURL+`">`) || strings.Contains(game.Body.String(), "__AO_BASE_URL__") {
t.Fatalf("game page: HTTP %d, missing public base URL", game.Code)
}
+ if !strings.Contains(game.Body.String(), `<link rel="icon" href="favicon.ico">`) {
+ t.Fatal("game page has no icon relative to its public base URL")
+ }
if controls.Code != http.StatusOK || !strings.Contains(controls.Body.String(), "<base href='"+baseURL+"'>") || !strings.Contains(controls.Body.String(), "action='control/users'") {
t.Fatalf("control page: HTTP %d, missing scoped forms", controls.Code)
}
@@ -65,6 +70,30 @@ func TestHTTPHandlerMountsGameAndControls(t *testing.T) {
}
}
+func TestHTTPHandlerServesOriginalFavicon(t *testing.T) {
+ for _, baseURL := range []string{"/", "/share/demo/"} {
+ t.Run(baseURL, func(t *testing.T) {
+ useResources(t, assets.Files)
+ handler := (&server{baseURL: baseURL}).httpHandler()
+
+ response := httptest.NewRecorder()
+ handler.ServeHTTP(response, httptest.NewRequest("GET", baseURL+"favicon.ico", nil))
+ head := httptest.NewRecorder()
+ handler.ServeHTTP(head, httptest.NewRequest("HEAD", baseURL+"favicon.ico", nil))
+
+ if response.Code != http.StatusOK || response.Header().Get("Content-Type") != "image/vnd.microsoft.icon" {
+ t.Fatalf("favicon: HTTP %d, %v", response.Code, response.Header())
+ }
+ if fmt.Sprintf("%x", sha256.Sum256(response.Body.Bytes())) != "99e2cb7400f843e0ede7fd2156c0b5ac46afb37beaa5a3a12c30c474e82851f5" {
+ t.Fatal("favicon differs from the original Clientr.exe icon")
+ }
+ if head.Code != http.StatusOK || head.Body.Len() != 0 || head.Header().Get("Content-Length") != "766" {
+ t.Fatalf("favicon HEAD: HTTP %d, %v", head.Code, head.Header())
+ }
+ })
+ }
+}
+
func TestHTTPHandlerScopesVisitorCookieAndRedirects(t *testing.T) {
useNPCData(t, testNPCData())
world := newTestServer(t)