Injecting JS into HTMLs platform wide

I would be interested to learn more about the Caddyfile option, as we already modify the caddy file with a patch:

Maybe it is possible to inject your change with the same kind of hook ?