-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add map sharing and downloads #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
* feat/maps-routes: fix: fix slow test teardown on node 18 cache npm in CI test fixes add delay for concurrent uploads test
* feat/maps-routes: use @types/bogon update package.json use exported SMPStyle type update CI - node 24, updated actions update tsconfig merge in latest changes
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Tests hanging in node 18 for some reason. Will need to fix before merging. |
This was a test-specific issue related to the test usage of ky. Fixed in 2d8ea22 by pinning ky to v1.7.5. The issue was caused by a bug in ky v1.8.0+ related to ReadableStream.prototype.cancel() not completing when a Request is cloned and the cloned request body isn't consumed. This is a known Node.js 18 bug tracked in ky issue #690. The ky library introduced memory leak mitigation code in v1.8.0 that immediately cancels a cloned request's body stream, but in Node 18 this causes the request to hang indefinitely.
|
Routes for the Map-Sharer:
POST /mapShares { mapId, receiverDeviceId }: create a map share, returnsMapSharetype. Data populated internally by the server (bounds, zoom, estimated size)GET /mapShares: list all active map sharesGET /mapShares/:shareId: getMapShareinfo for a shareIdGET /mapShares/:shareId/events: state change events, includingbytesDownloadedforstate: 'downloading'eventsGET /mapShares/:shareId/download: SMP file for share (accessed via P2P by receiver)POST /mapShares/:shareId/cancel: cancel a map shareRoutes for Map Receiver:
POST /mapShares/:shareId/decline { senderDeviceId, mapShareUrls, reason }: decline a map share (called on local server, which handles P2P request to sender)POST /downloads { senderDeviceId, shareId, mapShareUrls, estimatedSizeBytes }: start downloading a map share. Returns{ downloadId, ... }GET /downloads: list all active downloadsGET /downloads/:downloadId: download state with current statusGET /downloads/:downloadId/events: state change events, includingbytesDownloadedPOST /downloads/:downloadId/abort: abort downloadOn Map-sharer side, frontend:
POST /mapSharesto create the sharemapeoProject.members.sendMapShare(mapShare)/mapShares/:shareId/eventsPOST /mapShares/:shareId/cancelOn Map-sharer side, Core backend:
project.members.sendMapShare(mapShare: MapShare)sends message as extension over project creator coreOn Map-receiver side, frontend:
mapeoProject.on('map-share')POST /downloadsto start downloadingPOST /mapShares/:shareId/decline(local server handles P2P to sender)GET /downloads/:downloadId/eventsfor progressPOST /downloads/:downloadId/abortOn Map-receiver side, backend:
map-shareThe rest of the backend code is in the map server, e.g. in the map server on the receiver,
POST /downloadswill start a download fromGET /mapShares/:shareId/downloadon the map-sharer, and stream events to any connections toGET /downloads/:downloadId/events