aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2020-06-15 13:37:38 -0700
committerAdam Soltys <[email protected]>2020-06-15 13:37:38 -0700
commited0da89c7d98195294ced6d71812183a04e24c76 (patch)
tree411817cfbb8c7fa50b8c15ae546be038364b68ff
parent74b7d2a0d614f170ba5aea3a1a172a7a68356d80 (diff)
downloadcoinos-server-ed0da89c7d98195294ced6d71812183a04e24c76.tar.gz
coinos-server-ed0da89c7d98195294ced6d71812183a04e24c76.zip
move client version, update example config and schema
-rw-r--r--config/index.sample.js7
-rw-r--r--db/schema.sql11
-rw-r--r--lib/sockets.js2
-rw-r--r--routes/info.js9
4 files changed, 15 insertions, 14 deletions
diff --git a/config/index.sample.js b/config/index.sample.js
index 2aa791f2..fe87920d 100644
--- a/config/index.sample.js
+++ b/config/index.sample.js
@@ -1,6 +1,13 @@
const dbOptions = require("./config.json")[process.env.NODE_ENV || "development"];
module.exports = {
+ clientVersion: "x11111xx11xx11x11x11111111xx1111111xx111",
+ vapid: {
+ url: "https://coinos.io/",
+ publicKey:
+ "xxxxxx111xxxx1xxx111xxxxxxxxxxxxxxxxx_x-xxx1xxx1xxxxxxxx1xxxxxxxxx1x1xxxxxxxx1xxx1xxxxx",
+ privateKey: "1xxx1x1xxxxx1xxx1x-xx_xxxx1xxxxx1x1xxx1x1x1"
+ },
dbOptions,
ipstack: "2e1805258268b4992ebac06e20fc1865", // optional, set default currency based on IP
jwt: '2ad260b2202ad557b205ba17c7d8d62c69ffc95021b6147597c32eb30e3cf899',
diff --git a/db/schema.sql b/db/schema.sql
index 7ae73327..f5b6e187 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -57,7 +57,7 @@ CREATE TABLE `accounts` (
`ticker` varchar(255) DEFAULT NULL,
`precision` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=3715 DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB AUTO_INCREMENT=3720 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@@ -81,7 +81,7 @@ CREATE TABLE `invoices` (
`tip` double DEFAULT NULL,
`network` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=4433 DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB AUTO_INCREMENT=4447 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@@ -109,7 +109,7 @@ CREATE TABLE `payments` (
`account_id` int(11) DEFAULT NULL,
`preimage` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=4209 DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB AUTO_INCREMENT=4324 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@@ -137,9 +137,10 @@ CREATE TABLE `users` (
`currencies` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
`otpsecret` varchar(255) DEFAULT NULL,
`ip` int(10) unsigned DEFAULT NULL,
+ `subscriptions` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `ip` (`ip`)
-) ENGINE=InnoDB AUTO_INCREMENT=619 DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB AUTO_INCREMENT=624 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -151,4 +152,4 @@ CREATE TABLE `users` (
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- Dump completed on 2020-06-08 13:03:28
+-- Dump completed on 2020-06-15 13:37:25
diff --git a/lib/sockets.js b/lib/sockets.js
index 07af88d8..4b733882 100644
--- a/lib/sockets.js
+++ b/lib/sockets.js
@@ -77,7 +77,7 @@ wss.on("connection", function(ws, req) {
ws.user = user;
ws.send(JSON.stringify({ type: "login", data: user }));
- ws.send(JSON.stringify({ type: "version", data: clientVersion }));
+ ws.send(JSON.stringify({ type: "version", data: config.clientVersion }));
l.info("socket open", username, id);
} catch (e) {
ws.close();
diff --git a/routes/info.js b/routes/info.js
index 81cb2095..382c37c0 100644
--- a/routes/info.js
+++ b/routes/info.js
@@ -1,15 +1,8 @@
const sequelize = require("sequelize");
const { Op } = sequelize;
-const fs = require("fs");
-try {
- clientVersion = fs.readFileSync('config/clientversion').toString();
- l.info("client version", clientVersion);
-} catch(e) {
- l.warn("no client version found");
-}
-
app.get("/info", async (req, res) => {
+ const { clientVersion } = config;
const accounts = await db.Account.findAll({
attributes: [
"asset",