From d234930464a7b36d479bb03ef946a90903951e9b Mon Sep 17 00:00:00 2001 From: zyphlar Date: Sat, 25 Oct 2025 15:38:41 -0700 Subject: [PATCH] Live location web app commit (REMOVE) --- webapp/.env.example | 10 + webapp/.gitignore | 36 + webapp/README.md | 263 ++++++ webapp/package-lock.json | 1655 +++++++++++++++++++++++++++++++++++++ webapp/package.json | 22 + webapp/public/app.js | 472 +++++++++++ webapp/public/crypto.js | 109 +++ webapp/public/index.html | 214 +++++ webapp/public/viewer.html | 252 ++++++ webapp/src/database.js | 240 ++++++ webapp/src/server.js | 274 ++++++ 11 files changed, 3547 insertions(+) create mode 100644 webapp/.env.example create mode 100644 webapp/.gitignore create mode 100644 webapp/README.md create mode 100644 webapp/package-lock.json create mode 100644 webapp/package.json create mode 100644 webapp/public/app.js create mode 100644 webapp/public/crypto.js create mode 100644 webapp/public/index.html create mode 100644 webapp/public/viewer.html create mode 100644 webapp/src/database.js create mode 100644 webapp/src/server.js diff --git a/webapp/.env.example b/webapp/.env.example new file mode 100644 index 000000000..f3d650cc1 --- /dev/null +++ b/webapp/.env.example @@ -0,0 +1,10 @@ +# Server Configuration +PORT=3000 +NODE_ENV=development + +# Database +DATABASE_PATH=./location_sharing.db + +# Session Configuration +SESSION_EXPIRY_HOURS=24 +CLEANUP_INTERVAL_MINUTES=60 diff --git a/webapp/.gitignore b/webapp/.gitignore new file mode 100644 index 000000000..1bce2d10e --- /dev/null +++ b/webapp/.gitignore @@ -0,0 +1,36 @@ +# Dependencies +node_modules/ + +# Database +*.db +*.db-journal + +# Environment +.env +.env.local +.env.*.local + +# Logs +logs/ +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# OS +.DS_Store +Thumbs.db + +# IDE +.vscode/ +.idea/ +*.swp +*.swo +*~ + +# Build +dist/ +build/ + +# PM2 +.pm2/ diff --git a/webapp/README.md b/webapp/README.md new file mode 100644 index 000000000..40c510173 --- /dev/null +++ b/webapp/README.md @@ -0,0 +1,263 @@ +# CoMaps Live Location Sharing Server + +A Node.js server for real-time, end-to-end encrypted location sharing with web client viewer. + +## Features + +- **End-to-end encryption**: Location data is encrypted on the device using AES-GCM-256 +- **Real-time updates**: Poll-based location updates every 5 seconds +- **Session management**: Automatic cleanup of expired sessions +- **Web viewer**: Interactive map viewer with Leaflet.js +- **Navigation support**: Display ETA, distance, and destination when navigating +- **Battery monitoring**: Shows battery level and warnings +- **Location history**: Trail visualization with polyline + +## Quick Start + +### Installation + +```bash +cd webapp +npm install +``` + +### Configuration + +Copy `.env.example` to `.env` and configure: + +```bash +cp .env.example .env +``` + +Edit `.env`: +``` +PORT=3000 +NODE_ENV=development +DATABASE_PATH=./location_sharing.db +SESSION_EXPIRY_HOURS=24 +CLEANUP_INTERVAL_MINUTES=60 +``` + +### Running the Server + +Development mode (with auto-reload): +```bash +npm run dev +``` + +Production mode: +```bash +npm start +``` + +The server will start on `http://localhost:3000` + +## API Documentation + +### Create/Reactivate Session + +``` +POST /api/sessions +Content-Type: application/json + +{ + "sessionId": "uuid-string" +} +``` + +### Store Location Update + +``` +POST /api/sessions/:sessionId/location +Content-Type: application/json + +{ + "encryptedPayload": "{\"iv\":\"...\",\"ciphertext\":\"...\",\"authTag\":\"...\"}" +} +``` + +### Get Session Info + +``` +GET /api/sessions/:sessionId +``` + +### Get Latest Location + +``` +GET /api/sessions/:sessionId/location/latest +``` + +### Get Location History + +``` +GET /api/sessions/:sessionId/location/history?limit=100 +``` + +### Stop Session + +``` +DELETE /api/sessions/:sessionId +``` + +### Server Statistics + +``` +GET /api/stats +``` + +## URL Format + +Share URLs are formatted as: +``` +https://your-server.com/live/{base64url(sessionId:encryptionKey)} +``` + +Example: +``` +https://live.organicmaps.app/live/MjAyM...c3NrZXk +``` + +## Database Schema + +### sessions +- `session_id` (TEXT, PRIMARY KEY) +- `created_at` (INTEGER) +- `last_update` (INTEGER) +- `expires_at` (INTEGER) +- `is_active` (INTEGER) + +### location_updates +- `id` (INTEGER, PRIMARY KEY AUTOINCREMENT) +- `session_id` (TEXT, FOREIGN KEY) +- `encrypted_payload` (TEXT) +- `timestamp` (INTEGER) + +## Encryption + +Location data is encrypted using AES-GCM-256 with: +- Random 96-bit IV +- 128-bit authentication tag +- Base64-encoded encryption key (256-bit) + +Encrypted payload format (JSON): +```json +{ + "iv": "base64-encoded-iv", + "ciphertext": "base64-encoded-ciphertext", + "authTag": "base64-encoded-auth-tag" +} +``` + +Decrypted payload format (JSON): +```json +{ + "timestamp": 1234567890, + "lat": 37.7749, + "lon": -122.4194, + "accuracy": 10.5, + "speed": 5.2, + "bearing": 45.0, + "mode": "navigation", + "eta": 1234567900, + "distanceRemaining": 5000, + "destinationName": "Home", + "batteryLevel": 75 +} +``` + +## Web Viewer + +The web viewer is accessible at `/live/{encodedCredentials}` and provides: + +- Interactive map with Leaflet.js and OpenStreetMap tiles +- Real-time location marker with accuracy circle +- Location trail visualization +- Info panel showing: + - Status (live/inactive) + - Coordinates + - Accuracy + - Speed (if available) + - Navigation info (ETA, distance, destination) + - Battery level +- Automatic polling every 5 seconds +- Responsive design (mobile-friendly) + +## Security Considerations + +1. **HTTPS Required**: Always use HTTPS in production to protect the share URLs +2. **Encryption Keys**: Never log or expose encryption keys server-side +3. **Session Expiry**: Sessions automatically expire after 24 hours (configurable) +4. **Rate Limiting**: Consider adding rate limiting for production deployments +5. **CORS**: Configure CORS appropriately for your deployment + +## Production Deployment + +### Using PM2 + +```bash +npm install -g pm2 +pm2 start src/server.js --name location-sharing +pm2 save +pm2 startup +``` + +### Using Docker + +```dockerfile +FROM node:18-alpine +WORKDIR /app +COPY package*.json ./ +RUN npm ci --production +COPY . . +EXPOSE 3000 +CMD ["node", "src/server.js"] +``` + +### Environment Variables + +Set these in production: +``` +NODE_ENV=production +PORT=3000 +DATABASE_PATH=/data/location_sharing.db +SESSION_EXPIRY_HOURS=24 +``` + +## Maintenance + +### Database Cleanup + +The server automatically cleans up: +- Expired sessions (older than expiry time) +- Inactive sessions (older than 1 week) +- Old location updates (older than 1 week) + +Cleanup runs every 60 minutes by default (configurable). + +### Manual Cleanup + +```bash +# Stop the server +# Delete the database file +rm location_sharing.db +# Restart the server (will recreate schema) +``` + +## Troubleshooting + +### Location not updating +- Check that the session is active +- Verify the encrypted payload format +- Check server logs for decryption errors +- Ensure the encryption key matches + +### Web viewer shows error +- Verify the share URL is correct +- Check that the session exists +- Ensure at least one location update has been sent +- Check browser console for decryption errors + +## License + +MIT diff --git a/webapp/package-lock.json b/webapp/package-lock.json new file mode 100644 index 000000000..72dba6c82 --- /dev/null +++ b/webapp/package-lock.json @@ -0,0 +1,1655 @@ +{ + "name": "location-sharing-server", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "location-sharing-server", + "version": "1.0.0", + "license": "MIT", + "dependencies": { + "better-sqlite3": "^9.2.2", + "cors": "^2.8.5", + "dotenv": "^16.3.1", + "express": "^4.18.2" + }, + "devDependencies": { + "nodemon": "^3.0.2" + } + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "license": "MIT", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", + "license": "MIT" + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/better-sqlite3": { + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-9.6.0.tgz", + "integrity": "sha512-yR5HATnqeYNVnkaUTf4bOP2dJSnyhP4puJN/QPRyx4YkBEEUxib422n2XzPqDEHjQQqazoYoADdAm5vE15+dAQ==", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "bindings": "^1.5.0", + "prebuild-install": "^7.1.1" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "license": "MIT", + "dependencies": { + "file-uri-to-path": "1.0.0" + } + }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "license": "MIT", + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/body-parser": { + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", + "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==", + "license": "MIT", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.13.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "license": "ISC" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "license": "MIT", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz", + "integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==", + "license": "MIT" + }, + "node_modules/cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "license": "MIT", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "license": "MIT", + "dependencies": { + "mimic-response": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "license": "MIT", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "license": "MIT", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/dotenv": { + "version": "16.6.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz", + "integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/end-of-stream": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", + "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", + "license": "MIT", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/expand-template": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", + "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", + "license": "(MIT OR WTFPL)", + "engines": { + "node": ">=6" + } + }, + "node_modules/express": { + "version": "4.21.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz", + "integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==", + "license": "MIT", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.3", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.7.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.3.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.3", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.12", + "proxy-addr": "~2.0.7", + "qs": "6.13.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.19.0", + "serve-static": "1.16.2", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "license": "MIT" + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/finalhandler": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz", + "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==", + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "license": "MIT" + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/github-from-package": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", + "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==", + "license": "MIT" + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "license": "MIT", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true, + "license": "ISC" + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "license": "ISC" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", + "license": "MIT" + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "license": "MIT" + }, + "node_modules/napi-build-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-2.0.0.tgz", + "integrity": "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==", + "license": "MIT" + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/node-abi": { + "version": "3.78.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.78.0.tgz", + "integrity": "sha512-E2wEyrgX/CqvicaQYU3Ze1PFGjc4QYPGsjUrlYkqAE0WjHEZwgOsGMPMzkMse4LjJbDmaEuDX3CM036j5K2DSQ==", + "license": "MIT", + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/nodemon": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.10.tgz", + "integrity": "sha512-WDjw3pJ0/0jMFmyNDp3gvY2YizjLmmOUQo6DEBY+JgdvW/yQ9mEeSw6H5ythl5Ny2ytb7f9C2nIbjSxMNzbJXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.1.2", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/nodemon/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/nodemon/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz", + "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==", + "license": "MIT" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/prebuild-install": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.3.tgz", + "integrity": "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==", + "license": "MIT", + "dependencies": { + "detect-libc": "^2.0.0", + "expand-template": "^2.0.3", + "github-from-package": "0.0.0", + "minimist": "^1.2.3", + "mkdirp-classic": "^0.5.3", + "napi-build-utils": "^2.0.0", + "node-abi": "^3.3.0", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^4.0.0", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0" + }, + "bin": { + "prebuild-install": "bin.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true, + "license": "MIT" + }, + "node_modules/pump": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.3.tgz", + "integrity": "sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==", + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/qs": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.0.6" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", + "license": "MIT", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "license": "(BSD-2-Clause OR MIT OR Apache-2.0)", + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/semver": { + "version": "7.7.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", + "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/send": { + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", + "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/serve-static": { + "version": "1.16.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", + "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==", + "license": "MIT", + "dependencies": { + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.19.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/simple-get": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", + "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "decompress-response": "^6.0.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/tar-fs": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.4.tgz", + "integrity": "sha512-mDAjwmZdh7LTT6pNleZ05Yt65HC3E+NiQzl672vQG38jIrehtJk/J3mNwIg+vShQPcLF/LV7CMnDW6vjj6sfYQ==", + "license": "MIT", + "dependencies": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, + "node_modules/tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "license": "MIT", + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "dev": true, + "license": "ISC", + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "license": "Apache-2.0", + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "license": "MIT", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true, + "license": "MIT" + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "license": "MIT" + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "license": "MIT", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + } + } +} diff --git a/webapp/package.json b/webapp/package.json new file mode 100644 index 000000000..6d90a7cc9 --- /dev/null +++ b/webapp/package.json @@ -0,0 +1,22 @@ +{ + "name": "location-sharing-server", + "version": "1.0.0", + "description": "Live location sharing server for CoMaps", + "main": "src/server.js", + "scripts": { + "start": "node src/server.js", + "dev": "nodemon src/server.js" + }, + "keywords": ["location", "sharing", "maps"], + "author": "", + "license": "MIT", + "dependencies": { + "express": "^4.18.2", + "better-sqlite3": "^9.2.2", + "cors": "^2.8.5", + "dotenv": "^16.3.1" + }, + "devDependencies": { + "nodemon": "^3.0.2" + } +} diff --git a/webapp/public/app.js b/webapp/public/app.js new file mode 100644 index 000000000..098eddcbb --- /dev/null +++ b/webapp/public/app.js @@ -0,0 +1,472 @@ +/** + * Live Location Viewer Application + */ + +class LocationViewer { + constructor() { + this.map = null; + this.marker = null; + this.polyline = null; + this.sessionId = null; + this.encryptionKey = null; + this.updateInterval = null; + this.locationHistory = []; + this.currentLocation = null; + this.lastUpdateTimestamp = null; + this.lastServerTimestamp = null; + this.isActive = false; + this.isFollowing = true; + this.userMovedMap = false; + this.lastNavigationMode = null; + this.isInitialLoad = true; + } + + /** + * Initialize the application + */ + async init() { + try { + // Parse credentials from URL + const pathParts = window.location.pathname.split('/'); + const encodedCredentials = pathParts[pathParts.length - 1]; + + const credentials = LocationCrypto.parseCredentials(encodedCredentials); + if (!credentials) { + this.showError('Invalid share link'); + return; + } + + this.sessionId = credentials.sessionId; + this.encryptionKey = credentials.encryptionKey; + + // Initialize map + this.initMap(); + + // Load location history first + await this.loadLocationHistory(); + + // Load latest location + await this.loadLocation(); + + // Check session status + await this.checkSessionStatus(); + + // Initial load is complete - now track user interactions + setTimeout(() => { + this.isInitialLoad = false; + }, 1000); + + // Start polling for updates + this.startPolling(); + + // Show info panel + document.getElementById('infoPanel').style.display = 'block'; + document.getElementById('loadingSpinner').style.display = 'none'; + } catch (err) { + console.error('Initialization error:', err); + this.showError(err.message || 'Failed to initialize viewer'); + } + } + + /** + * Initialize the Leaflet map + */ + initMap() { + this.map = L.map('map').setView([0, 0], 2); + + // Use CartoDB Positron - free minimalist black and white tileset + L.tileLayer('https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png', { + attribution: '© OpenStreetMap contributors © CARTO', + subdomains: 'abcd', + maxZoom: 20 + }).addTo(this.map); + + // Initialize polyline for location history + this.polyline = L.polyline([], { + color: '#2196f3', + weight: 3, + opacity: 0.7 + }).addTo(this.map); + + // Detect user map interaction (manual drag/zoom) + this.map.on('dragstart', () => { + if (!this.isInitialLoad) { + this.userMovedMap = true; + this.isFollowing = false; + this.showFollowButton(); + } + }); + + this.map.on('zoomstart', () => { + if (!this.isInitialLoad) { + this.userMovedMap = true; + this.isFollowing = false; + this.showFollowButton(); + } + }); + + // Set up follow button + const followButton = document.getElementById('followButton'); + followButton.addEventListener('click', () => { + this.isFollowing = true; + this.userMovedMap = false; + this.hideFollowButton(); + if (this.currentLocation) { + this.map.setView([this.currentLocation.lat, this.currentLocation.lon], 15); + } + }); + } + + /** + * Show follow button + */ + showFollowButton() { + document.getElementById('followButton').classList.add('visible'); + } + + /** + * Hide follow button + */ + hideFollowButton() { + document.getElementById('followButton').classList.remove('visible'); + } + + /** + * Load location history from server + */ + async loadLocationHistory(sinceTimestamp = null) { + try { + let url = `/api/sessions/${this.sessionId}/location/history?limit=100`; + if (sinceTimestamp) { + url += `&since=${sinceTimestamp}`; + } + + const response = await fetch(url); + + if (!response.ok) { + return; // History might not be available yet + } + + const data = await response.json(); + const newLocations = []; + + for (const update of data.updates) { + try { + const decrypted = await LocationCrypto.decryptPayload( + update.encryptedPayload, + this.encryptionKey + ); + + // Check if this location is not already in history + const isDuplicate = this.locationHistory.some(loc => + loc.lat === decrypted.lat && + loc.lon === decrypted.lon && + loc.timestamp === decrypted.timestamp + ); + + if (!isDuplicate) { + newLocations.push({ + lat: decrypted.lat, + lon: decrypted.lon, + timestamp: decrypted.timestamp + }); + } + } catch (err) { + console.error('Failed to decrypt historical location:', err); + } + } + + // Add new locations to history sorted by timestamp + this.locationHistory.push(...newLocations); + this.locationHistory.sort((a, b) => a.timestamp - b.timestamp); + + // Update polyline with historical data + if (this.locationHistory.length > 0) { + this.updatePolyline(); + + // Center map on latest location only on first load and if following + if (!sinceTimestamp && this.isFollowing) { + const latestLoc = this.locationHistory[this.locationHistory.length - 1]; + this.map.setView([latestLoc.lat, latestLoc.lon], 15); + } + } + } catch (err) { + console.error('Load history error:', err); + } + } + + /** + * Check session status + */ + async checkSessionStatus() { + try { + const response = await fetch(`/api/v1/session/${this.sessionId}`); + + if (!response.ok) { + this.isActive = false; + return; + } + + const data = await response.json(); + this.isActive = data.isActive; + } catch (err) { + console.error('Check session status error:', err); + this.isActive = false; + } + } + + /** + * Load location from server + */ + async loadLocation() { + try { + const response = await fetch(`/api/v1/location/${this.sessionId}/latest`); + + if (!response.ok) { + if (response.status === 404) { + throw new Error('No location data available yet. Waiting for updates...'); + } + throw new Error('Failed to load location'); + } + + const data = await response.json(); + const newTimestamp = data.timestamp; + + // Check for gap in updates (more than 30 seconds) + if (this.lastServerTimestamp && (newTimestamp - this.lastServerTimestamp) > 30000) { + console.log('Detected gap in updates, loading missing history...'); + await this.loadLocationHistory(this.lastServerTimestamp); + } + + this.lastUpdateTimestamp = data.timestamp; + this.lastServerTimestamp = newTimestamp; + await this.processLocationUpdate(data); + + // Update session status on each location update + await this.checkSessionStatus(); + } catch (err) { + console.error('Load location error:', err); + throw err; + } + } + + /** + * Process an encrypted location update + */ + async processLocationUpdate(data) { + try { + // Decrypt the payload + const decrypted = await LocationCrypto.decryptPayload( + data.encryptedPayload, + this.encryptionKey + ); + + this.currentLocation = decrypted; + + // Update map + this.updateMap(decrypted); + + // Update info panel + this.updateInfoPanel(decrypted, data.timestamp); + + // Add to history only if it's not already there (avoid duplicates) + const isDuplicate = this.locationHistory.some(loc => + loc.lat === decrypted.lat && + loc.lon === decrypted.lon && + loc.timestamp === decrypted.timestamp + ); + + if (!isDuplicate) { + this.locationHistory.push({ + lat: decrypted.lat, + lon: decrypted.lon, + timestamp: decrypted.timestamp + }); + + // Update polyline only when we add a new point + this.updatePolyline(); + } + } catch (err) { + console.error('Failed to process location update:', err); + // Don't throw - just skip this update + } + } + + /** + * Update map with new location + */ + updateMap(location) { + const latLng = [location.lat, location.lon]; + + if (!this.marker) { + // Create marker + const icon = L.divIcon({ + className: 'location-marker', + html: '
', + iconSize: [26, 26], + iconAnchor: [13, 13] + }); + + this.marker = L.marker(latLng, { icon }).addTo(this.map); + if (this.isFollowing) { + this.map.setView(latLng, 15); + } + } else { + // Update marker position + this.marker.setLatLng(latLng); + } + + // Add accuracy circle if available + if (location.accuracy) { + if (this.accuracyCircle) { + this.accuracyCircle.setLatLng(latLng); + this.accuracyCircle.setRadius(location.accuracy); + } else { + this.accuracyCircle = L.circle(latLng, { + radius: location.accuracy, + color: '#2196f3', + fillColor: '#2196f3', + fillOpacity: 0.1, + weight: 1 + }).addTo(this.map); + } + } + + // Pan to new location only if following + if (this.isFollowing) { + this.map.panTo(latLng); + } + } + + /** + * Update polyline with location history + */ + updatePolyline() { + const points = this.locationHistory.map(loc => [loc.lat, loc.lon]); + this.polyline.setLatLngs(points); + } + + /** + * Update info panel + */ + updateInfoPanel(location, serverTimestamp) { + // Determine if session is truly live (updated within last 30 seconds) + const now = Date.now(); + const timeSinceUpdate = now - serverTimestamp; + const isLive = timeSinceUpdate < 30000; + + // Only show status if it's inactive AND there's old data OR session is explicitly closed + let statusHtml = ''; + if (!isLive && timeSinceUpdate > 60000) { + statusHtml = ` +
+ Status + Inactive +
+ `; + } else if (isLive) { + statusHtml = ` +
+ Status + Live +
+ `; + } + + // Show speed if available + if (location.speed !== undefined && location.speed >= 0) { + statusHtml += ` +
+ Speed + ${(location.speed * 3.6).toFixed(1)} km/h +
+ `; + } + + document.getElementById('statusInfo').innerHTML = statusHtml; + + // Navigation info - only show if currently in navigation mode + if (location.mode === 'navigation' && location.eta) { + this.lastNavigationMode = true; + const etaDate = new Date(location.eta * 1000); + const navHtml = ` + + `; + document.getElementById('navInfo').innerHTML = navHtml; + } else if (this.lastNavigationMode && location.mode !== 'navigation') { + // Navigation just ended - clear the display + this.lastNavigationMode = false; + document.getElementById('navInfo').innerHTML = ''; + } else if (!this.lastNavigationMode) { + // Never was in navigation or already cleared + document.getElementById('navInfo').innerHTML = ''; + } + + // Battery warning + if (location.batteryLevel !== undefined && location.batteryLevel < 20) { + document.getElementById('batteryWarning').innerHTML = ` +
+ ⚠️ Low battery: ${location.batteryLevel}% +
+ `; + } else { + document.getElementById('batteryWarning').innerHTML = ''; + } + + // Update time + const updateDate = new Date(serverTimestamp); + document.getElementById('updateTime').innerHTML = ` + Last update: ${updateDate.toLocaleTimeString()} + `; + } + + /** + * Start polling for location updates + */ + startPolling() { + // Poll every 5 seconds + this.updateInterval = setInterval(async () => { + try { + await this.loadLocation(); + } catch (err) { + console.error('Polling error:', err); + // Continue polling even if there's an error + } + }, 5000); + } + + /** + * Stop polling + */ + stopPolling() { + if (this.updateInterval) { + clearInterval(this.updateInterval); + this.updateInterval = null; + } + } + + /** + * Show error message + */ + showError(message) { + document.getElementById('loadingSpinner').style.display = 'none'; + document.getElementById('errorMessage').style.display = 'block'; + document.getElementById('errorText').textContent = message; + } +} + +// Initialize when DOM is ready +document.addEventListener('DOMContentLoaded', () => { + const viewer = new LocationViewer(); + viewer.init(); + + // Cleanup on page unload + window.addEventListener('beforeunload', () => { + viewer.stopPolling(); + }); +}); diff --git a/webapp/public/crypto.js b/webapp/public/crypto.js new file mode 100644 index 000000000..ad9355352 --- /dev/null +++ b/webapp/public/crypto.js @@ -0,0 +1,109 @@ +/** + * Crypto utilities for decrypting location data + * Uses Web Crypto API (AES-GCM-256) + */ + +class LocationCrypto { + /** + * Decode base64url to base64 + */ + static base64UrlToBase64(base64url) { + let base64 = base64url.replace(/-/g, '+').replace(/_/g, '/'); + while (base64.length % 4) { + base64 += '='; + } + return base64; + } + + /** + * Parse the encoded credentials from URL + * Format: sessionId:encryptionKey (base64url encoded) + */ + static parseCredentials(encodedCredentials) { + try { + const base64 = this.base64UrlToBase64(encodedCredentials); + const decoded = atob(base64); + const [sessionId, encryptionKey] = decoded.split(':'); + + if (!sessionId || !encryptionKey) { + throw new Error('Invalid credentials format'); + } + + return { sessionId, encryptionKey }; + } catch (err) { + console.error('Failed to parse credentials:', err); + return null; + } + } + + /** + * Convert base64 encryption key to CryptoKey + */ + static async importKey(base64Key) { + try { + const keyData = Uint8Array.from(atob(base64Key), c => c.charCodeAt(0)); + + return await window.crypto.subtle.importKey( + 'raw', + keyData, + { name: 'AES-GCM', length: 256 }, + false, + ['decrypt'] + ); + } catch (err) { + console.error('Failed to import key:', err); + throw new Error('Invalid encryption key'); + } + } + + /** + * Decrypt the encrypted payload + * Payload format (JSON): { iv: base64, ciphertext: base64, authTag: base64 } + */ + static async decryptPayload(encryptedPayloadJson, encryptionKey) { + try { + // Parse the encrypted payload + const payload = JSON.parse(encryptedPayloadJson); + const { iv, ciphertext, authTag } = payload; + + if (!iv || !ciphertext || !authTag) { + throw new Error('Invalid payload format'); + } + + // Import the key + const cryptoKey = await this.importKey(encryptionKey); + + // Decode base64 components + const ivBytes = Uint8Array.from(atob(iv), c => c.charCodeAt(0)); + const ciphertextBytes = Uint8Array.from(atob(ciphertext), c => c.charCodeAt(0)); + const authTagBytes = Uint8Array.from(atob(authTag), c => c.charCodeAt(0)); + + // Combine ciphertext and auth tag (GCM mode requires them together) + const combined = new Uint8Array(ciphertextBytes.length + authTagBytes.length); + combined.set(ciphertextBytes, 0); + combined.set(authTagBytes, ciphertextBytes.length); + + // Decrypt + const decryptedBuffer = await window.crypto.subtle.decrypt( + { + name: 'AES-GCM', + iv: ivBytes, + tagLength: 128 // 16 bytes = 128 bits + }, + cryptoKey, + combined + ); + + // Convert to string and parse JSON + const decoder = new TextDecoder(); + const decryptedText = decoder.decode(decryptedBuffer); + return JSON.parse(decryptedText); + } catch (err) { + console.error('Decryption failed:', err); + throw new Error('Failed to decrypt location data'); + } + } +} + +// Export for use in app.js +window.LocationCrypto = LocationCrypto; diff --git a/webapp/public/index.html b/webapp/public/index.html new file mode 100644 index 000000000..17f150e1b --- /dev/null +++ b/webapp/public/index.html @@ -0,0 +1,214 @@ + + + + + + CoMaps Live Location Sharing + + + +
+

CoMaps Live Location Sharing

+

+ End-to-end encrypted real-time location sharing server. Share your location securely + with friends and family while navigating. +

+ +
+
+
πŸ”’
+
+ End-to-end encrypted
+ Location data is encrypted on device, only you and recipients can decrypt it +
+
+
+
πŸ—ΊοΈ
+
+ Real-time updates
+ See live location updates with navigation info and ETA +
+
+
+
πŸ“±
+
+ Works everywhere
+ Compatible with CoMaps mobile apps and any web browser +
+
+
+ +
+

API Endpoints

+ +
+ POST + /api/sessions +
+ +
+ POST + /api/sessions/:sessionId/location +
+ +
+ GET + /api/sessions/:sessionId/location/latest +
+ +
+ GET + /api/sessions/:sessionId/location/history +
+ +
+ DELETE + /api/sessions/:sessionId +
+
+ +
+ Loading server statistics... +
+
+ + + + diff --git a/webapp/public/viewer.html b/webapp/public/viewer.html new file mode 100644 index 000000000..c4c5bc4c9 --- /dev/null +++ b/webapp/public/viewer.html @@ -0,0 +1,252 @@ + + + + + + Live Location Sharing - CoMaps + + + + +
+ + + + + +
+
+
+ + + + + + + + diff --git a/webapp/src/database.js b/webapp/src/database.js new file mode 100644 index 000000000..f8eabf260 --- /dev/null +++ b/webapp/src/database.js @@ -0,0 +1,240 @@ +const Database = require('better-sqlite3'); +const path = require('path'); + +class LocationDatabase { + constructor(dbPath) { + this.db = new Database(dbPath || path.join(__dirname, '..', 'location_sharing.db')); + this.initSchema(); + this.setupCleanup(); + } + + initSchema() { + // Create sessions table + this.db.exec(` + CREATE TABLE IF NOT EXISTS sessions ( + session_id TEXT PRIMARY KEY, + created_at INTEGER NOT NULL, + last_update INTEGER NOT NULL, + expires_at INTEGER NOT NULL, + is_active INTEGER DEFAULT 1 + ); + + CREATE INDEX IF NOT EXISTS idx_sessions_active + ON sessions(is_active, expires_at); + `); + + // Create location_updates table + this.db.exec(` + CREATE TABLE IF NOT EXISTS location_updates ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + session_id TEXT NOT NULL, + encrypted_payload TEXT NOT NULL, + timestamp INTEGER NOT NULL, + FOREIGN KEY (session_id) REFERENCES sessions(session_id) ON DELETE CASCADE + ); + + CREATE INDEX IF NOT EXISTS idx_location_session + ON location_updates(session_id, timestamp DESC); + `); + } + + /** + * Create a new session + */ + createSession(sessionId, expiryHours = 24) { + const now = Date.now(); + const expiresAt = now + (expiryHours * 60 * 60 * 1000); + + const stmt = this.db.prepare(` + INSERT INTO sessions (session_id, created_at, last_update, expires_at, is_active) + VALUES (?, ?, ?, ?, 1) + `); + + try { + stmt.run(sessionId, now, now, expiresAt); + return { success: true, sessionId }; + } catch (err) { + if (err.code === 'SQLITE_CONSTRAINT') { + // Session already exists, update it + return this.reactivateSession(sessionId, expiryHours); + } + throw err; + } + } + + /** + * Reactivate an existing session + */ + reactivateSession(sessionId, expiryHours = 24) { + const now = Date.now(); + const expiresAt = now + (expiryHours * 60 * 60 * 1000); + + const stmt = this.db.prepare(` + UPDATE sessions + SET is_active = 1, last_update = ?, expires_at = ? + WHERE session_id = ? + `); + + const result = stmt.run(now, expiresAt, sessionId); + return { + success: result.changes > 0, + sessionId, + reactivated: true + }; + } + + /** + * Store a location update + */ + storeLocationUpdate(sessionId, encryptedPayload) { + const now = Date.now(); + + // First, check if session exists and is active + const session = this.getSession(sessionId); + if (!session || !session.is_active || session.expires_at < now) { + return { success: false, error: 'Session not found or expired' }; + } + + // Update session last_update timestamp + const updateSession = this.db.prepare(` + UPDATE sessions SET last_update = ? WHERE session_id = ? + `); + updateSession.run(now, sessionId); + + // Insert location update + const stmt = this.db.prepare(` + INSERT INTO location_updates (session_id, encrypted_payload, timestamp) + VALUES (?, ?, ?) + `); + + try { + const result = stmt.run(sessionId, encryptedPayload, now); + return { + success: true, + updateId: result.lastInsertRowid + }; + } catch (err) { + return { success: false, error: err.message }; + } + } + + /** + * Get session info + */ + getSession(sessionId) { + const stmt = this.db.prepare(` + SELECT * FROM sessions WHERE session_id = ? + `); + return stmt.get(sessionId); + } + + /** + * Get latest location update for a session + */ + getLatestLocation(sessionId) { + const stmt = this.db.prepare(` + SELECT encrypted_payload, timestamp + FROM location_updates + WHERE session_id = ? + ORDER BY timestamp DESC + LIMIT 1 + `); + return stmt.get(sessionId); + } + + /** + * Get location history for a session + */ + getLocationHistory(sessionId, limit = 100) { + const stmt = this.db.prepare(` + SELECT encrypted_payload, timestamp + FROM location_updates + WHERE session_id = ? + ORDER BY timestamp DESC + LIMIT ? + `); + return stmt.all(sessionId, limit); + } + + /** + * Stop a session + */ + stopSession(sessionId) { + const stmt = this.db.prepare(` + UPDATE sessions SET is_active = 0 WHERE session_id = ? + `); + const result = stmt.run(sessionId); + return { success: result.changes > 0 }; + } + + /** + * Clean up expired sessions and old location updates + */ + cleanup() { + const now = Date.now(); + const oneWeekAgo = now - (7 * 24 * 60 * 60 * 1000); + + // Mark expired sessions as inactive + const expireStmt = this.db.prepare(` + UPDATE sessions + SET is_active = 0 + WHERE expires_at < ? AND is_active = 1 + `); + const expired = expireStmt.run(now); + + // Delete old inactive sessions (older than 1 week) + const deleteSessionsStmt = this.db.prepare(` + DELETE FROM sessions + WHERE is_active = 0 AND expires_at < ? + `); + const deletedSessions = deleteSessionsStmt.run(oneWeekAgo); + + // Delete orphaned location updates (sessions deleted by CASCADE) + // This is automatic due to CASCADE, but we can also delete old updates + const deleteUpdatesStmt = this.db.prepare(` + DELETE FROM location_updates + WHERE timestamp < ? + `); + const deletedUpdates = deleteUpdatesStmt.run(oneWeekAgo); + + return { + expiredSessions: expired.changes, + deletedSessions: deletedSessions.changes, + deletedUpdates: deletedUpdates.changes + }; + } + + /** + * Setup automatic cleanup + */ + setupCleanup(intervalMinutes = 60) { + setInterval(() => { + const result = this.cleanup(); + console.log('[DB Cleanup]', new Date().toISOString(), result); + }, intervalMinutes * 60 * 1000); + } + + /** + * Get database statistics + */ + getStats() { + const sessionCount = this.db.prepare(` + SELECT COUNT(*) as count FROM sessions WHERE is_active = 1 + `).get(); + + const totalUpdates = this.db.prepare(` + SELECT COUNT(*) as count FROM location_updates + `).get(); + + return { + activeSessions: sessionCount.count, + totalLocationUpdates: totalUpdates.count + }; + } + + close() { + this.db.close(); + } +} + +module.exports = LocationDatabase; diff --git a/webapp/src/server.js b/webapp/src/server.js new file mode 100644 index 000000000..87791cc74 --- /dev/null +++ b/webapp/src/server.js @@ -0,0 +1,274 @@ +require('dotenv').config(); +const express = require('express'); +const cors = require('cors'); +const path = require('path'); +const LocationDatabase = require('./database'); + +const app = express(); +const PORT = process.env.PORT || 3000; + +// Initialize database +const db = new LocationDatabase(process.env.DATABASE_PATH); + +// Middleware +app.use(cors()); +app.use(express.json()); +app.use(express.static(path.join(__dirname, '..', 'public'))); + +// Request logging middleware +app.use((req, res, next) => { + console.log(`[${new Date().toISOString()}] ${req.method} ${req.path}`); + next(); +}); + +/** + * API: Create or reactivate a session + * POST /api/v1/session (Android app format) + * POST /api/sessions (legacy format) + * Body: { sessionId: string } + */ +const createSessionHandler = (req, res) => { + const { sessionId } = req.body; + + if (!sessionId) { + return res.status(400).json({ error: 'sessionId is required' }); + } + + try { + const expiryHours = parseInt(process.env.SESSION_EXPIRY_HOURS) || 24; + const result = db.createSession(sessionId, expiryHours); + res.json(result); + } catch (err) { + console.error('Error creating session:', err); + res.status(500).json({ error: 'Internal server error' }); + } +}; + +app.post('/api/v1/session', createSessionHandler); +app.post('/api/sessions', createSessionHandler); + +/** + * API: Store a location update + * POST /api/v1/location/:sessionId (Android app format - encrypted payload is the entire body) + * Body: encrypted payload JSON directly + */ +app.post('/api/v1/location/:sessionId', (req, res) => { + const { sessionId } = req.params; + + // Android sends the encrypted payload JSON directly as the request body + const encryptedPayload = JSON.stringify(req.body); + + if (!encryptedPayload || encryptedPayload === '{}') { + return res.status(400).json({ error: 'Encrypted payload is required' }); + } + + try { + const result = db.storeLocationUpdate(sessionId, encryptedPayload); + + if (!result.success) { + return res.status(404).json({ error: result.error }); + } + + res.json(result); + } catch (err) { + console.error('Error storing location:', err); + res.status(500).json({ error: 'Internal server error' }); + } +}); + +/** + * API: Store a location update (legacy format) + * POST /api/sessions/:sessionId/location + * Body: { encryptedPayload: string } + */ +app.post('/api/sessions/:sessionId/location', (req, res) => { + const { sessionId } = req.params; + const { encryptedPayload } = req.body; + + if (!encryptedPayload) { + return res.status(400).json({ error: 'encryptedPayload is required' }); + } + + try { + const result = db.storeLocationUpdate(sessionId, encryptedPayload); + + if (!result.success) { + return res.status(404).json({ error: result.error }); + } + + res.json(result); + } catch (err) { + console.error('Error storing location:', err); + res.status(500).json({ error: 'Internal server error' }); + } +}); + +/** + * API: Get session info + * GET /api/v1/session/:sessionId (Android app format) + * GET /api/sessions/:sessionId (legacy format) + */ +const getSessionHandler = (req, res) => { + const { sessionId } = req.params; + + try { + const session = db.getSession(sessionId); + + if (!session) { + return res.status(404).json({ error: 'Session not found' }); + } + + // Don't expose internal fields, just status + res.json({ + sessionId: session.session_id, + isActive: session.is_active === 1, + createdAt: session.created_at, + lastUpdate: session.last_update, + expiresAt: session.expires_at + }); + } catch (err) { + console.error('Error getting session:', err); + res.status(500).json({ error: 'Internal server error' }); + } +}; + +app.get('/api/v1/session/:sessionId', getSessionHandler); +app.get('/api/sessions/:sessionId', getSessionHandler); + +/** + * API: Get latest location for a session + * GET /api/v1/location/:sessionId/latest (Android app format) + * GET /api/sessions/:sessionId/location/latest (legacy format) + */ +const getLatestLocationHandler = (req, res) => { + const { sessionId } = req.params; + + try { + const location = db.getLatestLocation(sessionId); + + if (!location) { + return res.status(404).json({ error: 'No location data found' }); + } + + res.json({ + encryptedPayload: location.encrypted_payload, + timestamp: location.timestamp + }); + } catch (err) { + console.error('Error getting location:', err); + res.status(500).json({ error: 'Internal server error' }); + } +}; + +app.get('/api/v1/location/:sessionId/latest', getLatestLocationHandler); +app.get('/api/sessions/:sessionId/location/latest', getLatestLocationHandler); + +/** + * API: Get location history for a session + * GET /api/sessions/:sessionId/location/history?limit=100 + */ +app.get('/api/sessions/:sessionId/location/history', (req, res) => { + const { sessionId } = req.params; + const limit = parseInt(req.query.limit) || 100; + + try { + const history = db.getLocationHistory(sessionId, limit); + + res.json({ + count: history.length, + updates: history.map(loc => ({ + encryptedPayload: loc.encrypted_payload, + timestamp: loc.timestamp + })) + }); + } catch (err) { + console.error('Error getting history:', err); + res.status(500).json({ error: 'Internal server error' }); + } +}); + +/** + * API: Stop a session + * DELETE /api/v1/session/:sessionId (Android app format) + * DELETE /api/sessions/:sessionId (legacy format) + */ +const deleteSessionHandler = (req, res) => { + const { sessionId } = req.params; + + try { + const result = db.stopSession(sessionId); + + if (!result.success) { + return res.status(404).json({ error: 'Session not found' }); + } + + res.json({ success: true, message: 'Session stopped' }); + } catch (err) { + console.error('Error stopping session:', err); + res.status(500).json({ error: 'Internal server error' }); + } +}; + +app.delete('/api/v1/session/:sessionId', deleteSessionHandler); +app.delete('/api/sessions/:sessionId', deleteSessionHandler); + +/** + * API: Get server statistics + * GET /api/stats + */ +app.get('/api/stats', (req, res) => { + try { + const stats = db.getStats(); + res.json(stats); + } catch (err) { + console.error('Error getting stats:', err); + res.status(500).json({ error: 'Internal server error' }); + } +}); + +/** + * Serve the viewer page for a specific session + * GET /live/:encodedCredentials + */ +app.get('/live/:encodedCredentials', (req, res) => { + res.sendFile(path.join(__dirname, '..', 'public', 'viewer.html')); +}); + +/** + * Health check endpoint + */ +app.get('/health', (req, res) => { + res.json({ status: 'ok', timestamp: Date.now() }); +}); + +// 404 handler +app.use((req, res) => { + res.status(404).json({ error: 'Not found' }); +}); + +// Error handler +app.use((err, req, res, next) => { + console.error('Unhandled error:', err); + res.status(500).json({ error: 'Internal server error' }); +}); + +// Start server +app.listen(PORT, () => { + console.log(`Location sharing server running on port ${PORT}`); + console.log(`Environment: ${process.env.NODE_ENV}`); + console.log(`Database: ${process.env.DATABASE_PATH || 'location_sharing.db'}`); + console.log(`\nServer stats:`, db.getStats()); +}); + +// Graceful shutdown +process.on('SIGINT', () => { + console.log('\nShutting down gracefully...'); + db.close(); + process.exit(0); +}); + +process.on('SIGTERM', () => { + console.log('\nShutting down gracefully...'); + db.close(); + process.exit(0); +});