diff options
| -rw-r--r-- | db/models/users.js | 9 | ||||
| -rw-r--r-- | lib/nostr.js | 2 | ||||
| -rw-r--r-- | lib/whitelist.js | 3 | ||||
| -rw-r--r-- | routes/events.js | 7 | ||||
| -rw-r--r-- | routes/users.js | 7 |
5 files changed, 27 insertions, 1 deletions
diff --git a/db/models/users.js b/db/models/users.js index faf41576..fd38facf 100644 --- a/db/models/users.js +++ b/db/models/users.js @@ -224,6 +224,15 @@ const attributes = { comment: null, field: "twofa" }, + cipher: { + type: DataTypes.STRING(255), + }, + pubkey: { + type: DataTypes.STRING(255), + }, + salt: { + type: DataTypes.STRING(255), + }, pin: { type: DataTypes.STRING(255), allowNull: true, diff --git a/lib/nostr.js b/lib/nostr.js index 677f14e5..c75955bd 100644 --- a/lib/nostr.js +++ b/lib/nostr.js @@ -7,12 +7,12 @@ import redis from "$lib/redis"; const { relays } = await got("https://nostr.watch/relays.json").json(); export const pool = RelayPool(relays); -let coinos; pool.on("open", relay => { if (relay.url.includes("coinos")) coinos = relay; relay.subscribe("live", { limit: 1 }); }); +let coinos; let seen = []; let timeout; pool.on("event", async (relay, sub, ev) => { diff --git a/lib/whitelist.js b/lib/whitelist.js index 93e601c7..5a9c0ba3 100644 --- a/lib/whitelist.js +++ b/lib/whitelist.js @@ -5,6 +5,7 @@ export default [ "address", "admin", "banner", + "cipher", "currencies", "currency", "email", @@ -14,7 +15,9 @@ export default [ "index", "keys", "payments", + "pubkey", "profile", + "salt", "seed", "symbol", "theme", diff --git a/routes/events.js b/routes/events.js index 460d09a5..ab682b46 100644 --- a/routes/events.js +++ b/routes/events.js @@ -28,3 +28,10 @@ app.get("/:pubkey/events", async (req, res) => { res.code(500).send("problem fetching user events"); } }); + +app.post('/nostr/send', async (req, res) => { + let { event } = req.body; + pool.send(["EVENT", event]); + res.send(event); +}); + diff --git a/routes/users.js b/routes/users.js index 8d45e8c3..82a71549 100644 --- a/routes/users.js +++ b/routes/users.js @@ -132,6 +132,8 @@ app.post("/user", auth, async (req, res) => { let { user } = req; let { address, + cipher, + pubkey, confirm, currencies, currency, @@ -140,6 +142,7 @@ app.post("/user", auth, async (req, res) => { password, newpin, pin, + salt, seed, tokens, twofa, @@ -170,6 +173,10 @@ app.post("/user", auth, async (req, res) => { } if (unit) user.unit = unit; + if (cipher) user.cipher = cipher; + if (pubkey) user.pubkey = pubkey; + if (salt) user.salt = salt; + user.currency = currency; user.currencies = currencies; user.pin = newpin; |
