Removing NIP-26, as it's been deprecated

will be replacing with kind 30078
This commit is contained in:
Stephen Vanderwarker 2024-08-11 13:30:17 -04:00
parent b27fcf8308
commit ee0cea8d9f

View File

@ -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);