Problem 2: Parsing a JSON is a thing JS is made for, so that's simple enough, but checking subnets is not.
Stackoverflow questions basically are all like “come on, learn that thing and implement it yourself”, but a) as a dev you should know that this is certainly a step to use a library, especially given that b) I really really do not want to care thinking about parsing IPv6 IPs now.
Fortunately I found a nice subnet checking library by @natevancouver
and after a facepalm from my side (check the issues 🤦♂️) that also worked flawless in the browser environment I was basically using.
https://www.npmjs.com/package/is-in-subnet