Phase 9: PWA & Workbox Caching (merged)
This commit is contained in:
@@ -17,7 +17,7 @@ const PORT = process.env.PORT || 3001;
|
||||
// Ensure upload and export directories exist
|
||||
const uploadsDir = join(__dirname, 'uploads');
|
||||
const exportsDir = join(__dirname, 'exports');
|
||||
[uploadsDir, exportsDir].forEach(dir => {
|
||||
[uploadsDir, exportsDir].forEach((dir) => {
|
||||
if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
|
||||
});
|
||||
|
||||
@@ -39,7 +39,7 @@ const storage = multer.diskStorage({
|
||||
const ext = file.originalname.split('.').pop();
|
||||
const filename = `${uuidv4()}.${ext}`;
|
||||
cb(null, filename);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const fileFilter = (req, file, cb) => {
|
||||
@@ -55,8 +55,8 @@ const upload = multer({
|
||||
storage,
|
||||
fileFilter,
|
||||
limits: {
|
||||
fileSize: 20 * 1024 * 1024 // 20MB
|
||||
}
|
||||
fileSize: 20 * 1024 * 1024, // 20MB
|
||||
},
|
||||
});
|
||||
|
||||
// Health check endpoint
|
||||
@@ -96,13 +96,13 @@ app.post('/api/upload', upload.single('image'), async (req, res) => {
|
||||
url: originalUrl,
|
||||
filename: req.file.filename,
|
||||
size: req.file.size,
|
||||
mimetype: req.file.mimetype
|
||||
mimetype: req.file.mimetype,
|
||||
},
|
||||
preview: {
|
||||
path: previewPath,
|
||||
url: previewUrl,
|
||||
filename: previewFilename
|
||||
}
|
||||
filename: previewFilename,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Upload error:', error);
|
||||
@@ -192,8 +192,8 @@ app.post('/api/export', async (req, res) => {
|
||||
width: EXPORT_SIZE,
|
||||
height: EXPORT_SIZE,
|
||||
dpi: 300,
|
||||
sizeInches: '15x15'
|
||||
}
|
||||
sizeInches: '15x15',
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Export error:', error);
|
||||
|
||||
Reference in New Issue
Block a user