Skip to content

Conversation

@gmaclennan
Copy link
Member

Adds routes for reading maps, uploading new custom maps, and deleting custom maps

@gmaclennan gmaclennan self-assigned this Dec 15, 2025
@gmaclennan gmaclennan marked this pull request as ready for review December 15, 2025 21:00
@socket-security
Copy link

socket-security bot commented Dec 15, 2025

@socket-security

This comment was marked as resolved.

@gmaclennan gmaclennan changed the title feat: add /maps/ routes feat: add /maps/ routes Dec 15, 2025
@gmaclennan
Copy link
Member Author

Some windows failures around parallel uploads, which I suspect are probably a test artifact rather than a bug to be worried about.

@gmaclennan

This comment was marked as resolved.

Copy link

@RangerMauve RangerMauve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not seeing any obvious issues

Copy link
Member

@achou11 achou11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of small cleanup things to address but otherwise functionality seems thorough!

Out of curiosity, will I still need the patches I have on desktop related to CORS issues that I run into in development? (caused by usage of Vite's dev server)


Slightly tangential, but the publishing tsconfig needs to be updated since you're committing to a TS implementation:

diff --git a/tsconfig.npm.json b/tsconfig.npm.json
index f89cb7b..f35d2b4 100644
--- a/tsconfig.npm.json
+++ b/tsconfig.npm.json
@@ -4,9 +4,7 @@
 		"noEmit": false,
 		"outDir": "dist",
 		"declaration": true,
-		"emitDeclarationOnly": true,
 		"declarationMap": true
 	},
-	"files": [],
-	"include": ["src/index.js"]
+	"include": ["src/index.ts", "types/*"]
 }

achou11 added a commit to digidem/comapeo-desktop that referenced this pull request Dec 16, 2025
Updates the bounding box used for the map where there's no data to show.
Something I learned via
digidem/comapeo-map-server#2 (comment)
achou11 added a commit to digidem/comapeo-desktop that referenced this pull request Dec 16, 2025
Updates the bounding box used for the map where there's no data to show.
Something I learned via
digidem/comapeo-map-server#2 (comment)
@gmaclennan gmaclennan requested a review from achou11 January 21, 2026 13:36
Copy link
Member

@achou11 achou11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few non-blocking comments but overall looks great ✨

Comment on lines +54 to +56
if (request.params.mapId !== CUSTOM_MAP_ID) {
throw new errors.MAP_NOT_FOUND(`Map not found: ${request.params.mapId}`)
}
Copy link
Member

@achou11 achou11 Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feels misleading to use a not found error here. maybe a status error explaining this temporary (?) limitation would be more suitable?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix is lined up in #4, which adds a FORBIDDEN (403) for trying to update or delete the "special" IDs - fallback and default. I'm following a pattern here where PUT is for updates, not for creation (keeping POST for that), so I think 404 is the correct response. This is probably not perfectly semantically correct, given that this is also creating the custom map, but I think we can just resolve this later when we change this to support multiple custom maps.

Comment on lines +69 to +71
if (request.params.mapId !== CUSTOM_MAP_ID) {
throw new errors.MAP_NOT_FOUND(`Map not found: ${request.params.mapId}`)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar comment about potentially using a different error code

Comment on lines +66 to +67
// @ts-expect-error - the types for this are too hard and making them work would not add any type safety.
remoteDeviceId: z32.encode(req.socket.remotePublicKey),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More specific placement to avoid unintentional opt-out:

Suggested change
// @ts-expect-error - the types for this are too hard and making them work would not add any type safety.
remoteDeviceId: z32.encode(req.socket.remotePublicKey),
remoteDeviceId: z32.encode(
// @ts-expect-error - the types for this are too hard and making them work would not add any type safety.
req.socket.remotePublicKey,
),

@gmaclennan gmaclennan merged commit 47499d7 into main Jan 21, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants