code-server: patch Claude Code extension for Firefox CORS fix

Adds a NixOS activation script that patches the crossorigin attribute
onto the Claude Code extension's stylesheet link, fixing broken CSS in
Firefox due to stricter CORS handling than Chrome.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
rope 2026-05-16 12:10:05 +01:00
parent 9d5a2b43f1
commit 099ff8a093

View file

@ -23,5 +23,16 @@
# Make the claude CLI available in code-server's integrated terminal.
environment.systemPackages = [ pkgs.claude-code ];
# Patch the Claude Code extension to add crossorigin="anonymous" to its
# stylesheet link — required for Firefox due to stricter CORS handling.
# Idempotent: sed won't match after the first apply.
system.activationScripts.claude-code-firefox-fix.text = ''
for f in /home/fred/.local/share/code-server/extensions/anthropic.claude-code-*/extension.js; do
[ -f "$f" ] && ${pkgs.gnused}/bin/sed -i \
's|<link href="${q}" rel="stylesheet">|<link href="${q}" rel="stylesheet" crossorigin="anonymous">|' \
"$f"
done
'';
};
}