Skip to content

Commit 6c6066e

Browse files
chore: resolve merge conflicts
2 parents 1c500bd + c9f33d5 commit 6c6066e

88 files changed

Lines changed: 10680 additions & 5569 deletions

File tree

Some content is hidden

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

.eslintrc.js

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,33 @@ module.exports = {
33
parserOptions: {
44
sourceType: 'module',
55
},
6-
plugins: ['@typescript-eslint/eslint-plugin'],
6+
plugins: ['@typescript-eslint'],
77
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
88
root: true,
99
env: {
1010
node: true,
1111
},
1212
ignorePatterns: ['dist', 'tslint.json', 'node_modules'],
1313
rules: {
14-
'@typescript-eslint/interface-name-prefix': 'off',
1514
'@typescript-eslint/no-explicit-any': 'off',
16-
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
15+
'@typescript-eslint/no-unused-vars': [
16+
'error',
17+
{
18+
argsIgnorePattern: '^_',
19+
caughtErrors: 'none',
20+
},
21+
],
22+
'@typescript-eslint/no-require-imports': 'off',
23+
1724
semi: ['error', 'never'],
1825
quotes: ['error', 'single', { avoidEscape: true }],
19-
'sort-imports': ['error', {
20-
ignoreCase: true,
21-
allowSeparatedGroups: true,
22-
}],
26+
'sort-imports': [
27+
'error',
28+
{
29+
ignoreCase: true,
30+
allowSeparatedGroups: true,
31+
},
32+
],
2333
curly: [2, 'multi-line'],
2434
'max-len': [
2535
'error',
@@ -32,4 +42,12 @@ module.exports = {
3242
],
3343
'comma-dangle': ['error', 'always-multiline'],
3444
},
35-
}
45+
overrides: [
46+
{
47+
files: ['test/**/*.ts', '**/*.spec.ts'],
48+
rules: {
49+
'@typescript-eslint/no-unused-expressions': 'off',
50+
},
51+
},
52+
],
53+
}

.github/workflows/checks.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ jobs:
4242
run: npm ci
4343
- name: Run ESLint
4444
run: npm run lint
45+
- name: Run Knip
46+
run: npm run knip
4547
build-check:
4648
name: Build check
4749
runs-on: ubuntu-latest

.knip.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"$schema": "https://unpkg.com/knip@2/schema.json",
3+
"entry": [
4+
"src/index.ts",
5+
"src/import-events.ts",
6+
"knexfile.js"
7+
],
8+
"project": [
9+
"src/**/*.ts"
10+
],
11+
"ignoreFiles": [],
12+
"commitlint": false,
13+
"eslint": false,
14+
"github-actions": false,
15+
"husky": false,
16+
"mocha": false,
17+
"nyc": false,
18+
"semantic-release": false
19+
}

CONFIGURATION.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ Running `nostream` for the first time creates the settings file in `<project_roo
109109
| limits.event.rateLimits[].rate | Maximum number of events during period. |
110110
| limits.event.whitelists.pubkeys | List of public keys to ignore rate limits. |
111111
| limits.event.whitelists.ipAddresses | List of IPs (IPv4 or IPv6) to ignore rate limits. |
112+
| limits.event.retention.maxDays | Maximum number of days to retain events. Purge deletes events that are expired (`expires_at`), soft-deleted (`deleted_at`), or older than this window (`created_at`). Any non-positive value disables retention purge. |
113+
| limits.event.retention.kind.whitelist | Event kinds excluded from retention purge. NIP-62 `REQUEST_TO_VANISH` is always excluded from retention purge, even if not listed here. |
114+
| limits.event.retention.pubkey.whitelist | Public keys excluded from retention purge. |
112115
| limits.client.subscription.maxSubscriptions | Maximum number of subscriptions per connected client. Defaults to 10. Disabled when set to zero. |
113116
| limits.client.subscription.maxFilters | Maximum number of filters per subscription. Defaults to 10. Disabled when set to zero. |
114117
| limits.message.rateLimits[].period | Rate limit period in milliseconds. |

CONTRIBUTING.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ before making a change.
66

77
Please keep the conversations civil, respectful and focus on the topic being discussed.
88

9+
## Local Quality Checks
10+
11+
Run dead code and dependency analysis before opening a pull request:
12+
13+
```
14+
npm run knip
15+
```
16+
17+
`npm run lint` now runs Knip first, then ESLint.
18+
919
## Pull Request Process
1020

1121
1. Update the relevant documentation with details of changes to the interface, this includes new environment

Dockerfile.railwayapp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ ADD migrations /build/migrations
2323

2424
RUN npm install -g knex@2.4.0 && npm install --quiet
2525

26-
RUN npm run db:migrate
27-
2826
COPY . .
2927

3028
RUN npm run build
3129

3230
FROM node:24-alpine
3331

32+
# Install dumb-init for proper signal handling
33+
RUN apk add --no-cache dumb-init
34+
3435
ARG PORT
3536
ARG PGHOST
3637
ARG PGPORT
@@ -71,12 +72,19 @@ LABEL org.opencontainers.image.licenses=MIT
7172

7273
WORKDIR /app
7374

75+
# Copy runtime artifacts and configuration
7476
COPY --from=build /build/dist .
77+
COPY --from=build /build/package.json /build/package-lock.json ./
78+
COPY --from=build /build/knexfile.js ./
79+
COPY --from=build /build/migrations ./migrations
80+
COPY --from=build /build/seeds ./seeds
7581

76-
RUN npm install --omit=dev --quiet
82+
RUN npm install --omit=dev --quiet && npm install -g knex@2.4.0
7783

7884
USER 1000:1000
7985

8086
RUN mkdir -p $NOSTR_CONFIG_DIR
8187

82-
CMD ["node", "src/index.js"]
88+
ENTRYPOINT ["dumb-init", "--"]
89+
90+
CMD ["sh", "-c", "npm run db:migrate && node src/index.js"]

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,10 @@ Start:
209209
```
210210
./scripts/start_with_tor
211211
```
212+
or, with Nginx reverse proxy and Let's Encrypt SSL:
213+
```
214+
RELAY_DOMAIN=relay.example.com CERTBOT_EMAIL=you@example.com ./scripts/start_with_nginx
215+
```
212216
213217
**Windows / WSL2 users:** Docker bind-mounts can cause PostgreSQL permission errors on Windows. Use the dedicated override file instead:
214218
```

commitlint.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ module.exports = {
22
extends: ['@commitlint/config-conventional'],
33
parserPreset: 'conventional-changelog-conventionalcommits',
44
rules: {
5-
'body-max-line-length': [2, 'always', 250],
5+
'body-max-line-length': [0, 'always'],
6+
'header-max-length': [0, 'always'],
67
'subject-case': [0, 'always'],
78
'header-case': [0, 'always'],
89
'body-case': [0, 'always'],

cucumber.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const config = [
1111
'--format @cucumber/pretty-formatter',
1212
'--format html:.test-reports/integration/report.html',
1313
'--format json:.test-reports/integration/report.json',
14-
'--publish',
1514
].join(' ')
1615

1716
module.exports = {

docker-compose.nginx.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
services:
2+
nginx:
3+
image: nginx:1.25-alpine
4+
container_name: nostream-nginx
5+
ports:
6+
- 80:80
7+
- 443:443
8+
volumes:
9+
- ${PWD}/nginx/conf.d:/etc/nginx/conf.d
10+
- ${PWD}/nginx/ssl:/etc/nginx/ssl
11+
- certbot-webroot:/var/www/certbot
12+
depends_on:
13+
- nostream
14+
restart: on-failure
15+
# Run nginx in foreground (so container exits if nginx dies).
16+
# A background loop watches for a signal file created by certbot
17+
# after cert issuance/renewal, and reloads nginx within seconds.
18+
command: >
19+
/bin/sh -c "while :; do
20+
if [ -f /etc/nginx/ssl/reload-nginx ]; then
21+
if nginx -t && nginx -s reload; then
22+
rm -f /etc/nginx/ssl/reload-nginx;
23+
fi;
24+
fi;
25+
sleep 5;
26+
done & nginx -g 'daemon off;'"
27+
networks:
28+
default:
29+
30+
certbot:
31+
image: certbot/certbot:v2.11.0
32+
container_name: nostream-certbot
33+
environment:
34+
RELAY_DOMAIN: ${RELAY_DOMAIN:?RELAY_DOMAIN required}
35+
CERTBOT_EMAIL: ${CERTBOT_EMAIL:?CERTBOT_EMAIL required}
36+
volumes:
37+
- ${PWD}/nginx/ssl:/etc/letsencrypt
38+
- ${PWD}/scripts/certbot_entrypoint.sh:/entrypoint.sh:ro
39+
- certbot-webroot:/var/www/certbot
40+
entrypoint: /entrypoint.sh
41+
depends_on:
42+
- nginx
43+
restart: on-failure
44+
networks:
45+
default:
46+
47+
volumes:
48+
certbot-webroot:

0 commit comments

Comments
 (0)