Files
at-container-registry/pkg/appview/templates/components/head.html
T
Evan JarrettandClaude Opus 5 ee9ccc1fb8 appview: drop crossorigin from the imgs.blue preconnect
Connections are keyed by credentials mode. The crossorigin attribute
opened the imgs.blue socket in anonymous-CORS mode, but every request
to that origin is a plain <img src> avatar fetch (BlobCDNURL /
resizeImage) in no-cors mode, so nothing could reuse it. The browser
opened a second connection anyway and Lighthouse flagged the hint as
unused while still listing imgs.blue as a preconnect candidate worth
~300ms of LCP.

The attribute is correct for the font preloads below, which is where it
was likely copied from; comment the distinction so it stays put.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LpqkSRqpcnAjsSZgFTUN5z
2026-08-31 16:57:49 -05:00

87 lines
3.8 KiB
HTML

{{ define "head" }}
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="color-scheme" content="dark light">
<meta name="referrer" content="strict-origin-when-cross-origin">
<meta name="theme-color" id="theme-color">
<!-- Favicons -->
<link rel="icon" type="image/png" href="/favicon-96x96.png" sizes="96x96" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="manifest" href="/site.webmanifest" />
<!-- Resource hints for external domains. No crossorigin on the
preconnect: avatars are plain <img src> fetches (no-cors), and
connections are keyed by credentials mode, so a CORS-mode
preconnect warms a socket nothing reuses. Fonts below are the
opposite case and do need crossorigin. -->
<link rel="preconnect" href="https://imgs.blue">
<link rel="dns-prefetch" href="https://imgs.blue">
<!-- Preload critical assets. Font list is discovered from the public FS
at startup so renaming a .woff2 doesn't silently 404.
icons.svg is intentionally NOT preloaded: it is consumed via SVG
<use href="/icons.svg#id"> references, whose fetch has request
destination "empty" and never matches an as="image" (or any) preload,
so the hint was always dropped as "preloaded but not used". -->
{{ range fontPreloads }}
<link rel="preload" href="{{ . }}" as="font" type="font/woff2" crossorigin>
{{ end }}
<!-- Theme: apply early to prevent flash -->
<script>
(function() {
function getEffectiveTheme(pref) {
if (pref === 'dark') return 'dark';
if (pref === 'light') return 'light';
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
}
function updateThemeColor() {
var meta = document.getElementById('theme-color');
if (!meta) return;
var bg = getComputedStyle(document.documentElement).getPropertyValue('--color-base-100').trim();
if (bg) {
meta.setAttribute('content', bg);
return true;
}
return false;
}
// On cold load the stylesheet may not be parsed when this script
// runs, so --color-base-100 resolves empty. Retry on rAF until we
// get a real value, and again on the load event as a final safety
// net. Also re-run on system preference changes.
function scheduleThemeColorUpdate() {
if (updateThemeColor()) return;
requestAnimationFrame(function() {
if (updateThemeColor()) return;
window.addEventListener('load', updateThemeColor, { once: true });
});
}
var pref = localStorage.getItem('theme') || 'system';
var effective = getEffectiveTheme(pref);
document.documentElement.classList.toggle('dark', effective === 'dark');
document.documentElement.setAttribute('data-theme', effective);
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', scheduleThemeColorUpdate);
} else {
scheduleThemeColorUpdate();
}
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', scheduleThemeColorUpdate);
})();
</script>
<!-- Tailwind CSS (built via npm run css:build) -->
<link rel="stylesheet" href="/css/style.css?v={{ assetHash "css/style.css" }}">
{{ extraCSS }}
<!-- Bundled JS: HTMX + Actor Typeahead + App -->
<script type="module" src="/js/bundle.min.js?v={{ assetHash "js/bundle.min.js" }}"></script>
{{ end }}