Skip to content

Show it a video you love. Get a new video in the same style. An AI crew (Claude Code or Codex) plans, builds and reviews it with you.

Merge origin/main; recover interrupted jobs only once the port is ours

許元豪0ffbf1aeb0b6
diff --cc app/server/index.ts
index 7d5145c,10d768b..80a6e70
--- a/app/server/index.ts
+++ b/app/server/index.ts
@@@ -126,10 -126,6 +126,15 @@@ app.get<'/files/:id/*', { id: string; 0
const dist = join(import.meta.dirname, '..', 'dist');
if (existsSync(dist)) { app.use(express.static(dist)); app.get(/^\/(?!api|files).*/, (req, res) => res.sendFile(join(dist, 'index.html'))); }
- J.recoverOrphans();
- const server = app.listen(PORT, '127.0.0.1', () => console.log(`ReelMimic → http://localhost:${PORT}`));
-const cut = J.recoverOrphans();
-if (cut.length && process.env.AUTO_RESUME !== '0') { console.log(`Resuming ${cut.length} interrupted job(s): ${cut.join(', ')}`); J.autoResume(cut); }
-app.listen(PORT, '127.0.0.1', () => console.log(`ReelMimic → http://localhost:${PORT}`));
++// Recover only once the port is ours: a second copy (start.bat double-clicked again) used to mark the first copy's
++// running jobs as interrupted before it found the port taken. Now it just says so and exits.
++const server = app.listen(PORT, '127.0.0.1', () => {
++ console.log(`ReelMimic → http://localhost:${PORT}`);
++ const cut = J.recoverOrphans();
++ if (cut.length && process.env.AUTO_RESUME !== '0') { console.log(`Resuming ${cut.length} interrupted job(s): ${cut.join(', ')}`); J.autoResume(cut); }
++});
+server.on('error', (err: NodeJS.ErrnoException) => {
+ if (err.code !== 'EADDRINUSE') throw err;
+ console.error(`Port ${PORT} is already in use. ReelMimic may already be open at http://localhost:${PORT}. Set PORT to use another port.`);
+ process.exit(1);
+});