diff --git a/scripts/vendor-zoo-modeling-app.mjs b/scripts/vendor-zoo-modeling-app.mjs
index ebd939eb8..56cc5a91d 100644
--- a/scripts/vendor-zoo-modeling-app.mjs
+++ b/scripts/vendor-zoo-modeling-app.mjs
@@ -30,6 +30,7 @@ const sourceRefFile = path.join(sourceDir, ".hicad-source-ref");
const outputDir = path.join(root, "public/vendor/zoo-modeling-app");
const customizationDir = path.join(root, "vendor/zoo-modeling-app");
const proxyToken = "hicad-session";
+const brandedFaviconUrl = "/api/favicon?surface=hicad";
function run(command, args, options = {}) {
const result = spawnSync(command, args, {
@@ -112,6 +113,22 @@ function replaceSource(relativePath, before, after) {
writeFileSync(filePath, source.replace(before, after));
}
+function patchOfficialManifest() {
+ const manifestPath = path.join(sourceDir, "public/manifest.json");
+ const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
+
+ manifest.short_name = "HiCAD";
+ manifest.name = "HiCAD";
+ manifest.icons = [
+ {
+ src: brandedFaviconUrl,
+ sizes: "any",
+ },
+ ];
+
+ writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`);
+}
+
function patchOfficialSource() {
copyFileSync(
path.join(customizationDir, "Logo.tsx"),
@@ -130,6 +147,17 @@ function patchOfficialSource() {
' ',
' '
);
+ replaceSource(
+ "index.html",
+ ' ',
+ ` `
+ );
+ replaceSource(
+ "index.html",
+ ' ',
+ ` `
+ );
+ patchOfficialManifest();
replaceSource(
"index.html",
' \n',
diff --git a/tests/routes/hicad-embedded-performance.test.ts b/tests/routes/hicad-embedded-performance.test.ts
index 184850ad8..3f6ac4df0 100644
--- a/tests/routes/hicad-embedded-performance.test.ts
+++ b/tests/routes/hicad-embedded-performance.test.ts
@@ -16,6 +16,26 @@ test.describe("HiCAD embedded startup", () => {
expect(vendorScript).toContain(latestReviewedOfficialCommit);
});
+ test("uses the website favicon across embedded browser surfaces", () => {
+ const vendorScript = fs.readFileSync(
+ path.join(projectRoot, "scripts/vendor-zoo-modeling-app.mjs"),
+ "utf8"
+ );
+
+ expect(vendorScript).toContain(
+ 'const brandedFaviconUrl = "/api/favicon?surface=hicad"'
+ );
+ expect(vendorScript).toContain(
+ '` `'
+ );
+ expect(vendorScript).toContain(
+ '` `'
+ );
+ expect(vendorScript).toMatch(
+ /manifest\.icons = \[\s*\{\s*src: brandedFaviconUrl,\s*sizes: "any",/
+ );
+ });
+
test("suppresses the upstream onboarding chooser in embedded mode", () => {
const vendorScript = fs.readFileSync(
path.join(projectRoot, "scripts/vendor-zoo-modeling-app.mjs"),