aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2022-11-02 16:18:22 -0700
committerAdam Soltys <[email protected]>2022-11-02 16:18:22 -0700
commitbba0fc2708130962cd4d9373acc3ab68c9334c7e (patch)
treeb891c13fbcb444738490e98f1b36954102a87b73
parentb9f94f87ce37a5808a9274093b030e5ad8e2b7a4 (diff)
parentbf262fde314bd33f5040eccb5ac775ed92d6b766 (diff)
downloadcoinos-server-bba0fc2708130962cd4d9373acc3ab68c9334c7e.tar.gz
coinos-server-bba0fc2708130962cd4d9373acc3ab68c9334c7e.zip
Merge branch 'master' into prod
-rw-r--r--index.js1
-rw-r--r--routes/locations.js19
2 files changed, 20 insertions, 0 deletions
diff --git a/index.js b/index.js
index c0db543c..0f0ad648 100644
--- a/index.js
+++ b/index.js
@@ -17,6 +17,7 @@ import "./lib/notifications";
import "./lib/mail";
import "./routes/assets";
+import "./routes/locations";
import "./routes/info";
import "./routes/users";
import "./routes/invoices";
diff --git a/routes/locations.js b/routes/locations.js
new file mode 100644
index 00000000..3e0fee4c
--- /dev/null
+++ b/routes/locations.js
@@ -0,0 +1,19 @@
+import app from "$app";
+import redis from "$lib/redis";
+import axios from "axios";
+
+let locations;
+app.get("/locations", async (req, res) => {
+ res.send({ locations });
+});
+
+let getLocations = async () => {
+ let { data } = await axios.get('https://api.btcmap.org/v2/elements?updated_since=2022-09-19');
+ locations = data.filter(
+ (l) => l['osm_json'].tags && l['osm_json'].tags['payment:coinos'] === 'yes'
+ );
+
+ setTimeout(getLocations, 60000);
+}
+
+getLocations();