diff --git a/DOSBOX_DOOM.ZIP b/DOSBOX_DOOM.ZIP new file mode 100644 index 0000000..be6e0fa Binary files /dev/null and b/DOSBOX_DOOM.ZIP differ diff --git a/frontend/src/lib/api.js b/frontend/src/lib/api.js index 8812e3b..b4de421 100644 --- a/frontend/src/lib/api.js +++ b/frontend/src/lib/api.js @@ -75,7 +75,7 @@ export function artworkUrl(path) { export function bundleUrl(game) { if (!game) return null; if (game.bundle_type === "sockdrive") { - return `/api/sockdrive/${game.slug}/file?path=.jsdos/dosbox.conf`; + return `/api/sockdrive/${game.id}/file?path=.jsdos/dosbox.conf`; } - return `/games/${game.slug}.jsdos`; + return `/games/${game.id}.jsdos`; } diff --git a/main.go b/main.go index 06b726c..288eb13 100644 --- a/main.go +++ b/main.go @@ -187,11 +187,11 @@ func handleGameByID(w http.ResponseWriter, r *http.Request) { http.Error(w, "Game not found", http.StatusNotFound) return } - // Remove the entire game directory - if err := os.RemoveAll(gameDir(g.ID)); err != nil { - http.Error(w, "Failed to delete game", http.StatusInternalServerError) - return - } + // Remove the game directory (game.json, cover, sockdrive files) + os.RemoveAll(gameDir(g.ID)) + // Also remove the flat .jsdos bundle if it exists + bundlePath := filepath.Join(dataDir, "games", g.ID+".jsdos") + os.Remove(bundlePath) writeJSON(w, http.StatusOK, map[string]string{"status": "deleted"}) default: diff --git a/upload.go b/upload.go index 95953b3..cebfe46 100644 --- a/upload.go +++ b/upload.go @@ -126,9 +126,9 @@ func handleUploadGame(w http.ResponseWriter, r *http.Request) { []byte(fmt.Sprintf(dosboxConfTemplate, relExe)), 0644) bundleFile = ".jsdos/dosbox.conf" } else { - // Create .jsdos ZIP bundle + // Create .jsdos ZIP bundle flat in data/games/ bundleFile = gameID + ".jsdos" - bundlePath := filepath.Join(gameDirPath, bundleFile) + bundlePath := filepath.Join(filepath.Dir(gameDirPath), bundleFile) if err := createJSDOSBundle(extractDir, mainExe, bundlePath); err != nil { http.Error(w, "Failed to create bundle: "+err.Error(), http.StatusInternalServerError) return