Testing infinite prime numbers using ideas of algebraic geometry

There are at least two well-known proofs of the infinity of prime numbers (Euclid's original and Euler's proof using the L series) and both can be extended to show more general statements of form: "There are infinite prime numbers of the form. an + b "for specific $ a, b $.

Here is another proof that there are infinite prime numbers that use algebro-geometric ideas:

Suppose there are only many finite prime numbers. So
$ operatorname {Spec} mathbb Z $ it would be an artin ring and in
In particular, any finite regular ring on it would be locally a PID and
Artin, therefore globally a PID.

In particular, this would imply that all the rings of numbers (integrally closed) have class
number one that is clearly false, therefore, there should be
Infinity of cousins.

I do not think this is a circular argument! (This idea is definitely not original to me, but unfortunately I do not remember where I saw this argument, I remember very vaguely having read it in a David Speyer post on this same site …)

Question: Does anyone see how to extend this to show that there are infinite prime numbers of the form? $ 4n + 1 $ or $ 4n + 3 $? Or more general statements in this way.