nappup 1.3.0 → 1.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +21 -14
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "url": "git+https://github.com/44billion/nappup.git"
7
7
  },
8
8
  "license": "GPL-3.0-or-later",
9
- "version": "1.3.0",
9
+ "version": "1.3.1",
10
10
  "description": "Nostr App Uploader",
11
11
  "type": "module",
12
12
  "scripts": {
package/src/index.js CHANGED
@@ -344,16 +344,17 @@ async function maybeUploadStall ({
344
344
 
345
345
  if (!previous) {
346
346
  const tags = [
347
- ['d', dTag],
348
- ['c', '*']
347
+ ['d', dTag]
349
348
  ]
350
349
 
351
- if (self) tags.push(['self', self])
352
-
353
- if (countries) {
354
- countries.forEach(c => tags.push(['country', c]))
350
+ if (countries && countries.length > 0) {
351
+ countries.forEach(c => tags.push(['c', c]))
352
+ } else {
353
+ tags.push(['c', '*'])
355
354
  }
356
355
 
356
+ if (self) tags.push(['self', self])
357
+
357
358
  if (categories) {
358
359
  let count = 0
359
360
  for (const [cat, subcats] of categories) {
@@ -444,8 +445,12 @@ async function maybeUploadStall ({
444
445
 
445
446
  // Update countries
446
447
  if (countries) {
447
- removeTags('country')
448
- countries.forEach(c => tags.push(['country', c]))
448
+ removeTags('c')
449
+ if (countries.length === 0) {
450
+ tags.push(['c', '*'])
451
+ } else {
452
+ countries.forEach(c => tags.push(['c', c]))
453
+ }
449
454
  changed = true
450
455
  }
451
456
 
@@ -503,12 +508,14 @@ async function maybeUploadStall ({
503
508
  return ['d', dTag]
504
509
  })
505
510
 
506
- ensureTagValue('c', (existing) => {
507
- if (!existing) return ['c', '*']
508
- const currentValue = typeof existing[1] === 'string' ? existing[1].trim() : ''
509
- if (currentValue === '') return ['c', '*']
510
- return existing
511
- })
511
+ if (!countries) {
512
+ ensureTagValue('c', (existing) => {
513
+ if (!existing) return ['c', '*']
514
+ const currentValue = typeof existing[1] === 'string' ? existing[1].trim() : ''
515
+ if (currentValue === '') return ['c', '*']
516
+ return existing
517
+ })
518
+ }
512
519
 
513
520
  const hasAuto = (field) => tags.some(tag => Array.isArray(tag) && tag[0] === 'auto' && tag[1] === field)
514
521
  const removeAuto = (field) => {