Files
next.orly.dev/scripts/build-wasm.sh
woikos d41c332d06
Some checks failed
Go / build-and-release (push) Has been cancelled
Add NRC (Nostr Relay Connect) protocol and web UI (v0.48.9)
- Implement NIP-NRC protocol for remote relay access through public relay tunnel
- Add NRC bridge service with NIP-44 encrypted message tunneling
- Add NRC client library for applications
- Add session management with subscription tracking and expiry
- Add URI parsing for nostr+relayconnect:// scheme with secret and CAT auth
- Add NRC API endpoints for connection management (create/list/delete/get-uri)
- Add RelayConnectView.svelte component for managing NRC connections in web UI
- Add NRC database storage for connection secrets and labels
- Add NRC CLI commands (generate, list, revoke)
- Add support for Cashu Access Tokens (CAT) in NRC URIs
- Add ScopeNRC constant for Cashu token scope
- Add wasm build infrastructure and stub files

Files modified:
- app/config/config.go: NRC configuration options
- app/handle-nrc.go: New API handlers for NRC connections
- app/main.go: NRC bridge startup integration
- app/server.go: Register NRC API routes
- app/web/src/App.svelte: Add Relay Connect tab
- app/web/src/RelayConnectView.svelte: New NRC management component
- app/web/src/api.js: NRC API client functions
- main.go: NRC CLI command handlers
- pkg/bunker/acl_adapter.go: Add NRC scope mapping
- pkg/cashu/token/token.go: Add ScopeNRC constant
- pkg/database/nrc.go: NRC connection storage
- pkg/protocol/nrc/: New NRC protocol implementation
- docs/NIP-NRC.md: NIP specification document

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 03:40:12 +01:00

66 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
# Build the WasmDB WASM module for browser use
#
# Output: wasmdb.wasm in the repository root
#
# Usage:
# ./scripts/build-wasm.sh
# ./scripts/build-wasm.sh --output /path/to/output/wasmdb.wasm
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
OUTPUT_PATH="${REPO_ROOT}/wasmdb.wasm"
# Parse arguments
while [[ $# -gt 0 ]]; do
case $1 in
--output|-o)
OUTPUT_PATH="$2"
shift 2
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done
echo "Building WasmDB WASM module..."
echo "Output: ${OUTPUT_PATH}"
cd "${REPO_ROOT}"
# Build with optimizations
GOOS=js GOARCH=wasm go build \
-ldflags="-s -w" \
-o "${OUTPUT_PATH}" \
./cmd/wasmdb
# Get the size
SIZE=$(du -h "${OUTPUT_PATH}" | cut -f1)
echo "Build complete: ${OUTPUT_PATH} (${SIZE})"
# Copy wasm_exec.js from Go installation if not present
WASM_EXEC="${REPO_ROOT}/wasm_exec.js"
if [ ! -f "${WASM_EXEC}" ]; then
GO_ROOT=$(go env GOROOT)
# Try lib/wasm first (newer Go versions), then misc/wasm
if [ -f "${GO_ROOT}/lib/wasm/wasm_exec.js" ]; then
cp "${GO_ROOT}/lib/wasm/wasm_exec.js" "${WASM_EXEC}"
echo "Copied wasm_exec.js to ${WASM_EXEC}"
elif [ -f "${GO_ROOT}/misc/wasm/wasm_exec.js" ]; then
cp "${GO_ROOT}/misc/wasm/wasm_exec.js" "${WASM_EXEC}"
echo "Copied wasm_exec.js to ${WASM_EXEC}"
else
echo "Warning: wasm_exec.js not found in Go installation"
echo "Checked: ${GO_ROOT}/lib/wasm/wasm_exec.js"
echo "Checked: ${GO_ROOT}/misc/wasm/wasm_exec.js"
echo "You'll need to copy it manually from your Go installation"
fi
fi
echo "Done!"