Skip to content

Commit bcfbd77

Browse files
authored
Merge pull request #23 from atrifat/nip32-compatibility
NIP-32 compatibility and dependencies update
2 parents 6a61b27 + 0dbbfd0 commit bcfbd77

File tree

2 files changed

+52
-3
lines changed

2 files changed

+52
-3
lines changed

.env.example

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
NODE_ENV=production
22

33
# ENV variable for nostr-monitoring-tool. Check atrifat/nostr-monitoring-tool github for more information.
4+
5+
# (Optional. Default: true) Set whether to publish NIP-32 classification event (kind: 1985)
6+
ENABLE_NIP_32_CLASSIFICATION_EVENT=true
7+
# (Optional. Default: true) (Deprecated) Set whether to publish legacy classification event (kind: 9978)
8+
ENABLE_LEGACY_CLASSIFICATION_EVENT=true
9+
410
ENABLE_NSFW_CLASSIFICATION=true
511
NSFW_DETECTOR_ENDPOINT=http://localhost:8082/predict
612
NSFW_DETECTOR_TOKEN=
@@ -53,6 +59,24 @@ LISTEN_PORT=7860
5359
# (Optional) Set true to enable forwarding of request headers to upstream server, useful if relays behind reverse proxy
5460
ENABLE_FORWARD_REQ_HEADERS=false
5561

62+
# (Default: true) Use NIP-32 Event Format (kind: 1985) or Deprecated Legacy Format (kind: 9978). Legacy format will be fully replaced by NIP-32 event format in the future.
63+
USE_NIP_32_EVENT_FORMAT=true
64+
65+
# Set maximum websocket server payload size (maximum allowed message size) in bytes
66+
MAX_WEBSOCKET_PAYLOAD_SIZE=1000000
67+
68+
# Set maximum number of parallel concurrency limit when requesting classification events to relay
69+
RELAY_REQUEST_CONCURRENCY_LIMIT=10
70+
71+
# Set true to enable rate limit for number of websocket message
72+
ENABLE_RATE_LIMIT=false
73+
# Set to "IP" to rate limit based on IP addresses otherwise using socketId
74+
RATE_LIMIT_KEY="IP"
75+
# Maximum number of websocket message (REQ, EVENT, etc) per second per IP/socketId
76+
MAX_WEBSOCKET_MESSAGE_PER_SECOND=10
77+
# Maximum number of websocket message (REQ, EVENT, etc) per minute per IP/socketId
78+
MAX_WEBSOCKET_MESSAGE_PER_MINUTE=1000
79+
5680
# (Optional. Default: sfw. Options: all, sfw, partialsfw, and nsfw) Filter hate speech (toxic comment).
5781
DEFAULT_FILTER_CONTENT_MODE=sfw
5882
# (Optional. Default: 75, Options: 0-100) Default minimum probability/confidence score to determine the classification of nsfw content

Dockerfile

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG DENO_VERSION=1.45.3
1+
ARG DENO_VERSION=1.46.1
22
FROM debian:bookworm AS builder_strfry
33

44
WORKDIR /builder
@@ -27,7 +27,7 @@ RUN apt update -y && \
2727
rm -rf /var/lib/apt/lists/*
2828

2929
# Prepare nostr-filter
30-
ENV NOSTR_FILTER_COMMIT_HASH_VERSION=4d719299b88203754b952809e4f937e6fd66fc34
30+
ENV NOSTR_FILTER_COMMIT_HASH_VERSION=2cd3647254c44aac804479605f9e6173132d2cea
3131
ENV NOSTR_FILTER_BRANCH=main
3232
RUN git clone --branch $NOSTR_FILTER_BRANCH https://github.com/atrifat/nostr-filter && \
3333
cd /builder/nostr-filter && \
@@ -36,7 +36,7 @@ RUN git clone --branch $NOSTR_FILTER_BRANCH https://github.com/atrifat/nostr-fil
3636
npm ci --omit=dev && npx tsc
3737

3838
# Prepare nostr-monitoring-tool
39-
ENV NOSTR_MONITORING_TOOL_VERSION=v0.6.0
39+
ENV NOSTR_MONITORING_TOOL_VERSION=v0.7.0
4040
RUN git clone --depth 1 --branch $NOSTR_MONITORING_TOOL_VERSION https://github.com/atrifat/nostr-monitoring-tool && \
4141
cd /builder/nostr-monitoring-tool && \
4242
npm ci --omit=dev
@@ -84,6 +84,25 @@ ENV NOSTR_MONITORING_BOT_PUBLIC_KEY=
8484
ENV WHITELISTED_PUBKEYS=
8585
ENV LISTEN_PORT=7860
8686
ENV ENABLE_FORWARD_REQ_HEADERS=false
87+
88+
# (Default: true) Use NIP-32 Event Format (kind: 1985) or Deprecated Legacy Format (kind: 9978). Legacy format will be fully replaced by NIP-32 event format in the future.
89+
ENV USE_NIP_32_EVENT_FORMAT=true
90+
91+
# Set maximum websocket server payload size (maximum allowed message size) in bytes
92+
ENV MAX_WEBSOCKET_PAYLOAD_SIZE=1000000
93+
94+
# Set maximum number of parallel concurrency limit when requesting classification events to relay
95+
ENV RELAY_REQUEST_CONCURRENCY_LIMIT=10
96+
97+
# Set true to enable rate limit for number of websocket message
98+
ENV ENABLE_RATE_LIMIT=false
99+
# Set to "IP" to rate limit based on IP addresses otherwise using socketId
100+
ENV RATE_LIMIT_KEY="IP"
101+
# Maximum number of websocket message (REQ, EVENT, etc) per second per IP/socketId
102+
ENV MAX_WEBSOCKET_MESSAGE_PER_SECOND=10
103+
# Maximum number of websocket message (REQ, EVENT, etc) per minute per IP/socketId
104+
ENV MAX_WEBSOCKET_MESSAGE_PER_MINUTE=1000
105+
87106
# (Default: sfw, Options: all, sfw, partialsfw, and nsfw) Filter hate speech (toxic comment).
88107
ENV DEFAULT_FILTER_CONTENT_MODE=sfw
89108
# (Optional. Default: 75, Options: 0-100) Default minimum probability/confidence score to determine the classification of nsfw content
@@ -110,6 +129,12 @@ ENV DEFAULT_FILTER_TOPIC_CONFIDENCE=35
110129
ENV DEFAULT_FILTER_USER_MODE=all
111130

112131
# ENV variable for nostr-monitoring-tool
132+
133+
# (Optional. Default: true) Set whether to publish NIP-32 classification event (kind: 1985)
134+
ENV ENABLE_NIP_32_CLASSIFICATION_EVENT=true
135+
# (Optional. Default: true) (Deprecated) Set whether to publish legacy classification event (kind: 9978)
136+
ENV ENABLE_LEGACY_CLASSIFICATION_EVENT=true
137+
113138
ENV ENABLE_NSFW_CLASSIFICATION=true
114139
ENV NSFW_DETECTOR_ENDPOINT=
115140
ENV NSFW_DETECTOR_TOKEN=

0 commit comments

Comments
 (0)