|
|
@ -1,5 +1,5 @@
|
|
|
|
import {relayPool, generatePrivateKey, getPublicKey, signEvent} from 'nostr-tools';
|
|
|
|
import {relayPool, generatePrivateKey, getPublicKey, signEvent} from 'nostr-tools';
|
|
|
|
import {elem} from './domutil.js';
|
|
|
|
import {elem, multilineText} from './domutil.js';
|
|
|
|
import {dateTime, formatTime} from './timeutil.js';
|
|
|
|
import {dateTime, formatTime} from './timeutil.js';
|
|
|
|
// curl -H 'accept: application/nostr+json' https://nostr.x1ddos.ch
|
|
|
|
// curl -H 'accept: application/nostr+json' https://nostr.x1ddos.ch
|
|
|
|
const pool = relayPool();
|
|
|
|
const pool = relayPool();
|
|
|
@ -152,12 +152,6 @@ setInterval(() => {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}, 10000);
|
|
|
|
}, 10000);
|
|
|
|
|
|
|
|
|
|
|
|
function renderMultilineText(string) {
|
|
|
|
|
|
|
|
return string
|
|
|
|
|
|
|
|
.split('\n')
|
|
|
|
|
|
|
|
.reduce((acc, next, i) => acc.concat(i === 0 ? next : [elem('br'), next]), []);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function createTextNote(evt, relay) {
|
|
|
|
function createTextNote(evt, relay) {
|
|
|
|
const {host, img, isReply, replies, time, userName} = getMetadata(evt, relay);
|
|
|
|
const {host, img, isReply, replies, time, userName} = getMetadata(evt, relay);
|
|
|
|
const isLongContent = evt.content.length > 280;
|
|
|
|
const isLongContent = evt.content.length > 280;
|
|
|
@ -178,7 +172,7 @@ function createTextNote(evt, relay) {
|
|
|
|
elem('time', {dateTime: time.toISOString()}, formatTime(time)),
|
|
|
|
elem('time', {dateTime: time.toISOString()}, formatTime(time)),
|
|
|
|
]),
|
|
|
|
]),
|
|
|
|
]),
|
|
|
|
]),
|
|
|
|
elem('div', {data: isLongContent ? {append: evt.content.slice(280)} : null}, renderMultilineText(content)),
|
|
|
|
elem('div', {data: isLongContent ? {append: evt.content.slice(280)} : null}, multilineText(content)),
|
|
|
|
elem('button', {
|
|
|
|
elem('button', {
|
|
|
|
className: 'btn-inline', name: 'star', type: 'button',
|
|
|
|
className: 'btn-inline', name: 'star', type: 'button',
|
|
|
|
data: {'eventId': evt.id, relay},
|
|
|
|
data: {'eventId': evt.id, relay},
|
|
|
|