nappup 2.3.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -188,10 +188,12 @@ export async function toFileList (filesIterator, dir) {
188
188
  const fileList = []
189
189
  for await (const f of filesIterator) {
190
190
  const fileType = mime.lookup(f)
191
+ const { size } = await fs.promises.stat(f)
191
192
  const file = {
192
193
  stream: () => Readable.toWeb(fs.createReadStream(f)),
193
194
  webkitRelativePath: path.relative(dir.replace(/\/[^/]*$/, ''), f),
194
- type: fileType || (await fileTypeFromFile(f))?.mime || ''
195
+ type: fileType || (await fileTypeFromFile(f))?.mime || '',
196
+ size
195
197
  }
196
198
  fileList.push(file)
197
199
  }
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "url": "git+https://github.com/44billion/nappup.git"
7
7
  },
8
8
  "license": "MIT",
9
- "version": "2.3.0",
9
+ "version": "2.3.1",
10
10
  "description": "Nostr App Uploader",
11
11
  "type": "module",
12
12
  "scripts": {
package/src/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import NMMR from 'nmmr'
2
- import { appEncode } from 'libp2r2p/nip19'
2
+ import { appEncode, npubEncode } from 'libp2r2p/nip19'
3
3
  import nostrRelays from '#services/nostr-relays.js'
4
4
  import { getRelays } from '#helpers/signer.js'
5
5
  import { streamToChunks, streamToText } from '#helpers/stream.js'
@@ -79,7 +79,8 @@ export async function toApp (fileList, nostrSigner, {
79
79
 
80
80
  const writeRelays = [...new Set((await nostrSigner.getRelays()).write
81
81
  .map(relay => relay.trim().replace(/\/$/, '')))]
82
- log(`Found ${writeRelays.length} outbox relays for pubkey ${await nostrSigner.getPublicKey()}:\n${writeRelays.join(', ')}`)
82
+ const npub = npubEncode(await nostrSigner.getPublicKey())
83
+ log(`Found ${writeRelays.length} outbox relays for pubkey ${npub}:\n${writeRelays.join(', ')}`)
83
84
  if (!writeRelays.length) throw new Error('No outbox relays found')
84
85
 
85
86
  if (typeof dTag === 'string') {