Removing NIP-26, as it's been deprecated
will be replacing with kind 30078
This commit is contained in:
parent
b27fcf8308
commit
ee0cea8d9f
18
index.js
18
index.js
|
@ -1,5 +1,4 @@
|
||||||
// initialize required packages
|
// initialize required packages
|
||||||
const sqlite3 = require('sqlite3');
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const ini = require('ini');
|
const ini = require('ini');
|
||||||
const nostr = require('nostr-tools');
|
const nostr = require('nostr-tools');
|
||||||
|
@ -7,8 +6,6 @@ const wspf = require('websocket-polyfill');
|
||||||
const WebSocket = require('ws');
|
const WebSocket = require('ws');
|
||||||
const xmpp = require('simple-xmpp');
|
const xmpp = require('simple-xmpp');
|
||||||
|
|
||||||
var db = new sqlite3.Database('nip26.db');
|
|
||||||
|
|
||||||
let {
|
let {
|
||||||
bech32,
|
bech32,
|
||||||
bech32m
|
bech32m
|
||||||
|
@ -48,8 +45,8 @@ if (fs.existsSync('./config.ini')) {
|
||||||
|
|
||||||
let sub = relay.sub([{
|
let sub = relay.sub([{
|
||||||
kinds: [1],
|
kinds: [1],
|
||||||
authors: [pk],
|
// authors: [pk],
|
||||||
limit: 5
|
limit: 10
|
||||||
}, ])
|
}, ])
|
||||||
sub.on('event', event => {
|
sub.on('event', event => {
|
||||||
console.log('got event:', event);
|
console.log('got event:', event);
|
||||||
|
@ -81,14 +78,7 @@ if (fs.existsSync('./config.ini')) {
|
||||||
xmpp.send(from, 'https://wiki.vanderwarker.family/doku.php?id=code:nostrsms:commands');
|
xmpp.send(from, 'https://wiki.vanderwarker.family/doku.php?id=code:nostrsms:commands');
|
||||||
debug();
|
debug();
|
||||||
} else if (message === "!auth") {
|
} else if (message === "!auth") {
|
||||||
xmpp.send(from, "reauth (nip-26)");
|
xmpp.send(from, "https://auth.nostrsms.com");
|
||||||
|
|
||||||
const now = new Date();
|
|
||||||
const validUntil = now.getTime() + (30 * 24 * 60 * 60 * 1000);
|
|
||||||
const insertStmt = db.prepare('INSERT INTO users (pnum, token) VALUES (?, ?)');
|
|
||||||
insertStmt.run(from.split("@")[0], validUntil);
|
|
||||||
insertStmt.finalize();
|
|
||||||
debug();
|
|
||||||
} else {
|
} else {
|
||||||
async function newPost() {
|
async function newPost() {
|
||||||
const relay = nostr.relayInit(config.relays.write, WebSocket);
|
const relay = nostr.relayInit(config.relays.write, WebSocket);
|
||||||
|
@ -151,4 +141,4 @@ if (fs.existsSync('./config.ini')) {
|
||||||
console.log("Please create a config.ini");
|
console.log("Please create a config.ini");
|
||||||
console.log("See https://wiki.vanderwarker.family/doku.php?id=code:nostrsms:install");
|
console.log("See https://wiki.vanderwarker.family/doku.php?id=code:nostrsms:install");
|
||||||
console.log("and choose your preferred install method.");
|
console.log("and choose your preferred install method.");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user