Upload progress spinner + duplicate game detection
Build & Deploy / build-and-deploy (push) Successful in 1m20s
Build & Deploy / build-and-deploy (push) Successful in 1m20s
Two features:
1. Progress indicator: when upload starts, the dialog switches from
IGDB results to a centered spinner with 'Uploading and processing'
text + filename. The Cancel button stays visible but disabled.
2. Duplicate game blocking: before upload, checks if a game with the
same title (case-insensitive) already exists in the library.
Frontend checks against the loaded games list; backend also
checks as a second line of defense. Shows ⚠️ message in dialog.
Existing unique-ID suffix logic (foo-2, foo-3) is still in place
but now only reached when titles actually differ.
This commit is contained in:
@@ -48,6 +48,15 @@ public class UploadResource {
|
||||
|
||||
String gameId = GameService.sanitizeId(title);
|
||||
|
||||
// Check for duplicate by title (case-insensitive)
|
||||
for (var g : svc.list()) {
|
||||
if (g.getTitle() != null && g.getTitle().equalsIgnoreCase(title)) {
|
||||
return Response.status(409)
|
||||
.entity(Map.of("error", "\"" + title + "\" is already in your library"))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure unique ID
|
||||
String baseId = gameId;
|
||||
int counter = 2;
|
||||
|
||||
Reference in New Issue
Block a user