Inline spectrometer for shot-by-shot determination of pulse energies of a two-color X-ray free-electron laser