There never has been to my knowledge a federal law against sodomy aka homosexual acts. BUT - the fedgov didn’t prevent states from having such laws.
Second, being a homosexual used to be considered a security risk and so certain jobs were not open to homosexuals, and that is as it should be, just as certain jobs should be open to bestiality practitioners or heroin addicts or kleptomaniacs.
The straw man of “cameras in every bedroom” is ridiculous. For one thing, if homosexuals kept their private life private no one would know or thus care. But that horse left the bard about 3 decades ago.