From 6da01ca75352378f26cde294eb5632fc75505a47 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Tue, 10 Dec 2024 16:48:41 +0200 Subject: Expanding API to return calls from both hyperboria and yggdrasil networks --- api/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'api/index.js') diff --git a/api/index.js b/api/index.js index 2646a9c..f61b339 100755 --- a/api/index.js +++ b/api/index.js @@ -99,7 +99,10 @@ function processMethod(req, res) function checkIfAllowedIP(address) { - return address.startsWith('fc') ? true : false; + var test_cjdns = /^fc[0-9a-z]{1,2}:([0-9a-z]{1,4}:){1,6}[0-9a-z]{1,4}/ + var test_yggdrasil = /^2[0-9a-z]{1,2}:([0-9a-z]{1,4}:){1,6}[0-9a-z]{1,4}/ + var test_yggdrasil_sub = /^3[0-9a-z]{1,2}:([0-9a-z]{1,4}:){1,6}[0-9a-z]{1,4}/ + return (test_cjdns.test(address) || test_yggdrasil.test(address) || test_yggdrasil_sub.test(address)) ? true : false; } function requestParser(req, res) -- cgit v1.2.3