diff --git a/Dockerfile b/Dockerfile index 6e7b68e..da5b04c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,7 +25,7 @@ ENV VERSION=$VERSION ENV NODE_ENV=production -RUN apk add --no-cache curl +RUN apk add --no-cache curl ffmpeg RUN addgroup -g 1001 -S nodejs RUN adduser -S nextjs -u 1001 diff --git a/docker-compose.yml b/docker-compose.yml index 47083f7..6fabef3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,20 +1,27 @@ -version: '3.8' +name: immich-power-tools services: - immich_power_tools: + immich-power-tools: container_name: immich_power_tools - image: ghcr.io/immich-power-tools/immich-power-tools:latest + build: + context: . + dockerfile: Dockerfile ports: - "3000:3000" volumes: - - immich-power-tools-data:/app/data + - /data/docker/immich-power-tools:/app/data env_file: - .env + networks: + - default + - immich healthcheck: interval: 30s timeout: 10s retries: 3 start_period: 10s -volumes: - immich-power-tools-data: +networks: + immich: + external: true + name: immich_default diff --git a/src/components/shared/AssetGrid.tsx b/src/components/shared/AssetGrid.tsx index 160d52d..43db220 100644 --- a/src/components/shared/AssetGrid.tsx +++ b/src/components/shared/AssetGrid.tsx @@ -34,6 +34,11 @@ export interface AssetPhoto extends Photo { isVideo: boolean; duration?: string; isSelected: boolean; + originalFileName?: string; + fileSizeInByte?: number; + exifImageWidth?: number; + exifImageHeight?: number; + compressionUnsupportedReason?: string; } interface AssetGridProps { @@ -43,6 +48,8 @@ interface AssetGridProps { onSelectionChange?: (ids: string[]) => void; onDeleteAsset?: (id: string) => void; onFavoriteAsset?: (id: string, isFavorite: boolean) => void; + showMetadataOverlay?: boolean; + allowAssetMutations?: boolean; } interface AssetGridRef { @@ -51,7 +58,7 @@ interface AssetGridRef { unselectAll: () => void; } -const AssetGrid = forwardRef(({ assets, isInternal = true, selectable = false, onSelectionChange, onDeleteAsset, onFavoriteAsset }, ref) => { +const AssetGrid = forwardRef(({ assets, isInternal = true, selectable = false, onSelectionChange, onDeleteAsset, onFavoriteAsset, showMetadataOverlay = false, allowAssetMutations = true }, ref) => { const [index, setIndex] = useState(-1); const [lastSelectedIndex, setLastSelectedIndex] = useState(-1); const [showInfoPanel, setShowInfoPanel] = useState(() => { @@ -109,7 +116,7 @@ const AssetGrid = forwardRef(({ assets, isInternal useImperativeHandle(ref, () => ({ getSelectedIds: () => selectedIds, selectAll: () => { - const allIds = assets.map((asset) => asset.id); + const allIds = assets.filter((asset) => !asset.compressionUnsupportedReason).map((asset) => asset.id); updateContext({ selectedIds: allIds }); onSelectionChange?.(allIds); }, @@ -123,6 +130,7 @@ const AssetGrid = forwardRef(({ assets, isInternal const handleSelect = (_idx: number, asset: AssetPhoto, event: React.MouseEvent) => { event.stopPropagation(); + if (asset.compressionUnsupportedReason) return; const isPresent = selectedIds.includes(asset.id); if (isPresent) { const newSelectedIds = selectedIds.filter((id) => id !== asset.id); @@ -132,7 +140,7 @@ const AssetGrid = forwardRef(({ assets, isInternal const clickedIndex = images.findIndex((image) => { return image.id === asset.id; }); - if (event.shiftKey) { + if (event.shiftKey && lastSelectedIndex >= 0) { const startIndex = Math.min(clickedIndex, lastSelectedIndex); const endIndex = Math.max(clickedIndex, lastSelectedIndex); const rangeSelectedIds = images.slice(startIndex, endIndex + 1).map((image) => image.id); @@ -150,7 +158,7 @@ const AssetGrid = forwardRef(({ assets, isInternal }; const handleClick = (index: number, asset: AssetPhoto, event: React.MouseEvent) => { - if (selectable && (event.metaKey || event.ctrlKey || selectedIds.length > 0)) { + if (selectable && !asset.compressionUnsupportedReason && (event.metaKey || event.ctrlKey || selectedIds.length > 0)) { handleSelect(index, asset, event); } else { setIndex(index); @@ -214,9 +222,10 @@ const AssetGrid = forwardRef(({ assets, isInternal photo={context.photo} width={context.width} height={context.height} - selectable={selectable} + selectable={selectable && !context.photo.compressionUnsupportedReason} onSelect={(event) => handleSelect(context.index, context.photo, event)} selectionMode={selectable && selectedIds.length > 0} + showMetadataOverlay={showMetadataOverlay} /> ); }; @@ -231,7 +240,7 @@ const AssetGrid = forwardRef(({ assets, isInternal if (!currentAsset) return []; const isFav = favoriteIds.has(currentAsset.id); return [ - , - , - ]; - }, [currentAsset, showInfoPanel, onDeleteAsset, onFavoriteAsset, handleOpenInImmich, favoriteIds, handleToggleFavorite]); + ].filter(Boolean) as React.ReactNode[]; + }, [currentAsset, showInfoPanel, handleOpenInImmich, favoriteIds, handleToggleFavorite, allowAssetMutations]); return (
diff --git a/src/components/ui/lazy-grid-image.tsx b/src/components/ui/lazy-grid-image.tsx index dc82d17..0512ceb 100644 --- a/src/components/ui/lazy-grid-image.tsx +++ b/src/components/ui/lazy-grid-image.tsx @@ -1,5 +1,5 @@ -import { humanizeDuration } from '@/helpers/string.helper' +import { humanizeBytes, humanizeDuration } from '@/helpers/string.helper' import { PlayIcon } from '@radix-ui/react-icons' import { CircleCheck } from 'lucide-react' import React, { useEffect } from 'react' @@ -15,9 +15,10 @@ interface LazyGridImageProps { onSelect?: (event: React.MouseEvent) => void; /** When true, dim non-selected siblings so the selected set is visible in dense grids. */ selectionMode?: boolean; + showMetadataOverlay?: boolean; } -export default function LazyGridImage({ imageProps, photo, width, height, selectable, onSelect, selectionMode = false }: LazyGridImageProps) { +export default function LazyGridImage({ imageProps, photo, width, height, selectable, onSelect, selectionMode = false, showMetadataOverlay = false }: LazyGridImageProps) { const [isVisible, setIsVisible] = React.useState(false) const imageRef = React.useRef(null) @@ -61,13 +62,28 @@ export default function LazyGridImage({ imageProps, photo, width, height, select className={`group ${photo.isSelected ? 'ring-4 ring-blue-500 ring-inset' : ''} ${dim}`.trim()} > {imageProps.alt - {photo.isVideo &&
+ {photo.isVideo &&
{!!photo.duration && {humanizeDuration(photo.duration)}}
} + {showMetadataOverlay && photo.fileSizeInByte != null && ( +
+
{photo.originalFileName}
+
+ {humanizeBytes(photo.fileSizeInByte)} + {photo.exifImageWidth && photo.exifImageHeight ? ` · ${photo.exifImageWidth}×${photo.exifImageHeight}` : ''} +
+
+ )} + {photo.compressionUnsupportedReason && ( +
+ {photo.compressionUnsupportedReason} +
+ )} {selectable && (
{ e.stopPropagation(); onSelect?.(e); diff --git a/src/config/constants/sidebarNavs.tsx b/src/config/constants/sidebarNavs.tsx index b511a7e..502b64e 100644 --- a/src/config/constants/sidebarNavs.tsx +++ b/src/config/constants/sidebarNavs.tsx @@ -1,4 +1,4 @@ -import { Copy, GalleryHorizontal, GalleryVerticalEnd, Image as ImageIcon, MapPin, MapPinX, PackageSearch, Rewind, Search, Settings, Share2, User, Video, Workflow } from "lucide-react"; +import { Copy, GalleryHorizontal, GalleryVerticalEnd, Image as ImageIcon, MapPin, MapPinX, PackageSearch, Rewind, Search, Settings, Share2, User, Video, Workflow, FileArchive } from "lucide-react"; interface SidebarNav { title: string; @@ -30,6 +30,7 @@ export const sidebarGroups: SidebarGroup[] = [ { title: "Empty Videos", link: "/assets/empty-videos", icon:
+ {/* Compression */} +
+
+ +

Compression

+
+
+

+ FFmpeg is executed directly without a shell. Both {`{input}`} and {`{output}`} placeholders are required. No presets are applied automatically. +

+
+ +