v0.7.7 - Prevent sql attacks and rate limiting on subscriptions

This commit is contained in:
Your Name
2025-10-10 15:44:10 -04:00
parent 00a8f16262
commit 6709e229b3
11 changed files with 746 additions and 152 deletions

View File

@@ -163,9 +163,15 @@ rm -f db/c_nostr_relay.db* 2>/dev/null
echo "Embedding web files..."
./embed_web_files.sh
# Build the project first
echo "Building project..."
make clean all
# Build the project first - use static build by default
echo "Building project (static binary with SQLite JSON1 extension)..."
./build_static.sh
# Fallback to regular build if static build fails
if [ $? -ne 0 ]; then
echo "Static build failed, falling back to regular build..."
make clean all
fi
# Restore database files if preserving
if [ "$PRESERVE_DATABASE" = true ] && [ -d "/tmp/relay_backup_$$" ]; then
@@ -181,22 +187,34 @@ if [ $? -ne 0 ]; then
exit 1
fi
# Check if relay binary exists after build - detect architecture
# Check if relay binary exists after build - prefer static binary, fallback to regular
ARCH=$(uname -m)
case "$ARCH" in
x86_64)
BINARY_PATH="./build/c_relay_x86"
STATIC_BINARY="./build/c_relay_static_x86_64"
REGULAR_BINARY="./build/c_relay_x86"
;;
aarch64|arm64)
BINARY_PATH="./build/c_relay_arm64"
STATIC_BINARY="./build/c_relay_static_arm64"
REGULAR_BINARY="./build/c_relay_arm64"
;;
*)
BINARY_PATH="./build/c_relay_$ARCH"
STATIC_BINARY="./build/c_relay_static_$ARCH"
REGULAR_BINARY="./build/c_relay_$ARCH"
;;
esac
if [ ! -f "$BINARY_PATH" ]; then
echo "ERROR: Relay binary not found at $BINARY_PATH after build. Build may have failed."
# Prefer static binary if available
if [ -f "$STATIC_BINARY" ]; then
BINARY_PATH="$STATIC_BINARY"
echo "Using static binary: $BINARY_PATH"
elif [ -f "$REGULAR_BINARY" ]; then
BINARY_PATH="$REGULAR_BINARY"
echo "Using regular binary: $BINARY_PATH"
else
echo "ERROR: No relay binary found. Checked:"
echo " - $STATIC_BINARY"
echo " - $REGULAR_BINARY"
exit 1
fi