Skip to content

Commit cefa7d7

Browse files
authored
Merge branch 'main' into poc-zombie-leak
2 parents 248e4cc + f7869b0 commit cefa7d7

43 files changed

Lines changed: 2209 additions & 517 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,6 @@ dist
4343
.nostr
4444

4545
# Docker Compose overrides
46-
docker-compose.overrides.yml
46+
docker-compose.overrides.yml
47+
# Export output
48+
*.jsonl

.nycrc.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
{
22
"all": true,
33
"cache": true,
4-
"branches": 80,
5-
"lines": 80,
6-
"functions": 80,
7-
"statements": 80,
4+
"branches": 47,
5+
"lines": 54,
6+
"functions": 48,
7+
"statements": 55,
88
"watermarks": {
99
"lines": [
10-
80,
11-
95
10+
54,
11+
80
1212
],
1313
"functions": [
14-
80,
15-
95
14+
48,
15+
80
1616
],
1717
"branches": [
18-
80,
19-
95
18+
47,
19+
80
2020
],
2121
"statements": [
22-
80,
23-
95
22+
55,
23+
80
2424
]
2525
},
2626
"extension": [

CONFIGURATION.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,10 @@ Running `nostream` for the first time creates the settings file in `<project_roo
119119
| limits.message.ipWhitelist | List of IPs (IPv4 or IPv6) to ignore rate limits. |
120120
| limits.admissionCheck.rateLimits[].period | Rate limit period in milliseconds. |
121121
| limits.admissionCheck.rateLimits[].rate | Maximum number of admission checks during period. |
122-
| limits.admissionCheck.ipWhitelist | List of IPs (IPv4 or IPv6) to ignore rate limits. |
122+
| limits.admissionCheck.ipWhitelist | List of IPs (IPv4 or IPv6) to ignore rate limits. |
123+
| nip05.mode | NIP-05 verification mode: `enabled` requires verification, `passive` verifies without blocking, `disabled` does nothing. Defaults to `disabled`. |
124+
| nip05.verifyExpiration | Time in milliseconds before a successful NIP-05 verification expires and needs re-checking. Defaults to 604800000 (1 week). |
125+
| nip05.verifyUpdateFrequency | Minimum interval in milliseconds between re-verification attempts for a given author. Defaults to 86400000 (24 hours). |
126+
| nip05.maxConsecutiveFailures | Number of consecutive verification failures before giving up on an author. Defaults to 20. |
127+
| nip05.domainWhitelist | List of domains allowed for NIP-05 verification. If set, only authors verified at these domains can publish. |
128+
| nip05.domainBlacklist | List of domains blocked from NIP-05 verification. Authors with NIP-05 at these domains will be rejected. |

README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,54 @@ By default, the script asks for explicit confirmation (`Type 'DELETE' to confirm
654654
Use `--force` to skip the prompt.
655655

656656

657+
## Export Events
658+
659+
Export all stored events to a [JSON Lines](https://jsonlines.org/) (`.jsonl`) file. Each line is a valid NIP-01 Nostr event JSON object. The export streams rows from the database using cursors, so it works safely on relays with millions of events without loading them into memory.
660+
661+
```
662+
npm run export # writes to events.jsonl
663+
npm run export -- backup-2024-01-01.jsonl # custom filename
664+
```
665+
666+
The script reads the same `DB_*` environment variables used by the relay (see [CONFIGURATION.md](CONFIGURATION.md)).
667+
## Relay Maintenance
668+
669+
Use `clean-db` to wipe or prune `events` table data. This also removes
670+
corresponding data from the derived `event_tags` table when present.
671+
672+
Dry run (no deletion):
673+
674+
```
675+
npm run clean-db -- --all --dry-run
676+
```
677+
678+
Full wipe:
679+
680+
```
681+
npm run clean-db -- --all --force
682+
```
683+
684+
Delete events older than N days:
685+
686+
```
687+
npm run clean-db -- --older-than=30 --force
688+
```
689+
690+
Delete only selected kinds:
691+
692+
```
693+
npm run clean-db -- --kinds=1,7,4 --force
694+
```
695+
696+
Delete only selected kinds older than N days:
697+
698+
```
699+
npm run clean-db -- --older-than=30 --kinds=1,7,4 --force
700+
```
701+
702+
By default, the script asks for explicit confirmation (`Type 'DELETE' to confirm`).
703+
Use `--force` to skip the prompt.
704+
657705
## Configuration
658706

659707
You can change the default folder by setting the `NOSTR_CONFIG_DIR` environment variable to a different path.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
exports.up = function (knex) {
2+
return knex.schema.createTable('nip05_verifications', function (table) {
3+
table.binary('pubkey').notNullable().primary()
4+
table.text('nip05').notNullable()
5+
table.text('domain').notNullable()
6+
table.boolean('is_verified').notNullable().defaultTo(false)
7+
table.timestamp('last_verified_at', { useTz: true }).nullable()
8+
table.timestamp('last_checked_at', { useTz: true }).notNullable().defaultTo(knex.fn.now())
9+
table.integer('failure_count').notNullable().defaultTo(0)
10+
table.timestamp('created_at', { useTz: true }).notNullable().defaultTo(knex.fn.now())
11+
table.timestamp('updated_at', { useTz: true }).notNullable().defaultTo(knex.fn.now())
12+
13+
table.index(['domain'], 'idx_nip05_verifications_domain')
14+
table.index(['is_verified'], 'idx_nip05_verifications_is_verified')
15+
table.index(['last_checked_at'], 'idx_nip05_verifications_last_checked_at')
16+
})
17+
}
18+
19+
exports.down = function (knex) {
20+
return knex.schema.dropTable('nip05_verifications')
21+
}

0 commit comments

Comments
 (0)