diff --git a/.gitignore b/.gitignore index 298afe3..1717902 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ dist build images/ *.html -*.png *.jpg *.jpeg *.gif diff --git a/Dockerfile b/Dockerfile index 733ed8e..0128ac1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,5 +5,6 @@ COPY package.json package-lock.json ./ RUN npm install COPY . . +RUN chmod +x start.sh -CMD ["sh", "-c", "node fetchImages.js && node generateSite.js"] +CMD ["./start.sh"] diff --git a/docker-compose.yml b/docker-compose.yml index 94de1c3..cbbd0d4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,8 +4,8 @@ services: gallery: build: . volumes: - - ./public:/app/public - ./images:/app/images + - ./images.json:/app/images.json expose: - "3000" environment: diff --git a/fetchImages.js b/fetchImages.js index e805e8f..2d33786 100644 --- a/fetchImages.js +++ b/fetchImages.js @@ -62,20 +62,22 @@ async function getAlbumAssets() { const fileName = `${asset.id}_${asset.originalFileName || 'untitled'}`; const outputPath = path.join(config.outputDir, fileName); - // Add debug logging to understand the state - console.log(`Checking asset ${asset.id}:`); - console.log(`- Expected path: ${outputPath}`); - // Check if file already exists and is in our metadata const existingImage = existingImages.find(img => img.id === asset.id); if (existingImage) { - console.log(`- Found in metadata: ${existingImage.localPath}`); - if (fs.existsSync(existingImage.localPath)) { - console.log(`- File exists on disk, skipping download`); + // Normalize the paths to ensure consistent comparison + const normalizedExistingPath = path.normalize(existingImage.localPath); + const normalizedOutputPath = path.normalize(outputPath); + + console.log(`Checking paths:`); + console.log(`- Current path: ${normalizedOutputPath}`); + console.log(`- Existing path: ${normalizedExistingPath}`); + + if (fs.existsSync(normalizedOutputPath)) { + console.log(`File exists, skipping: ${fileName}`); images.push(existingImage); continue; } - console.log(`- File not found on disk at ${existingImage.localPath}`); } console.log(`Downloading: ${fileName}`); diff --git a/public/AnalogCamera.png b/public/AnalogCamera.png new file mode 100644 index 0000000..c335963 Binary files /dev/null and b/public/AnalogCamera.png differ diff --git a/public/AnalogCameraS.png b/public/AnalogCameraS.png new file mode 100644 index 0000000..ab9ddc4 Binary files /dev/null and b/public/AnalogCameraS.png differ diff --git a/public/favicon.png b/public/favicon.png new file mode 100644 index 0000000..ab9ddc4 Binary files /dev/null and b/public/favicon.png differ diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..eb6a2bb --- /dev/null +++ b/start.sh @@ -0,0 +1,3 @@ +#!/bin/sh +node generateSite.js & # Run the site generator in background +node fetchImages.js # Run the image fetcher in foreground \ No newline at end of file