High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
Fixed duplicated filename on upload
Alexb74ad69288e4
diff --git a/README.md b/README.mdindex 9bddd0837f..62c960eeb3 100644--- a/README.md+++ b/README.md@@ -48,7 +48,8 @@ This project is under heavy development, there will be continous functions, feat# Features-- Upload and view assets(videos/images).+- Upload and view assets (videos/images).+- Download asset to local device.- Multi-user supported.- Quick navigation with drag scroll bar.- Auto Backup.@@ -58,7 +59,6 @@ This project is under heavy development, there will be continous functions, feat- Image Tagging/Classification based on ImageNet dataset- Object detection based on COCO SSD.- Search assets based on tags and exif data (lens, make, model, orientation)-- Upload assets from your local computer/server using [immich cli tools](https://www.npmjs.com/package/immich)- [Optional] Reverse geocoding using Mapbox (Generous free-tier of 100,000 search/month)- Show asset's location information on map (OpenStreetMap).- Show curated places on the search pagediff --git a/mobile/web/favicon.png b/mobile/web/favicon.pngdeleted file mode 100644index 8aaa46ac1a..0000000000Binary files a/mobile/web/favicon.png and /dev/null differdiff --git a/mobile/web/icons/Icon-192.png b/mobile/web/icons/Icon-192.pngdeleted file mode 100644index b749bfef07..0000000000Binary files a/mobile/web/icons/Icon-192.png and /dev/null differdiff --git a/mobile/web/icons/Icon-512.png b/mobile/web/icons/Icon-512.pngdeleted file mode 100644index 88cfd48dff..0000000000Binary files a/mobile/web/icons/Icon-512.png and /dev/null differdiff --git a/mobile/web/icons/Icon-maskable-192.png b/mobile/web/icons/Icon-maskable-192.pngdeleted file mode 100644index eb9b4d76e5..0000000000Binary files a/mobile/web/icons/Icon-maskable-192.png and /dev/null differdiff --git a/mobile/web/icons/Icon-maskable-512.png b/mobile/web/icons/Icon-maskable-512.pngdeleted file mode 100644index d69c56691f..0000000000Binary files a/mobile/web/icons/Icon-maskable-512.png and /dev/null differdiff --git a/mobile/web/index.html b/mobile/web/index.htmldeleted file mode 100644index 3c44166255..0000000000--- a/mobile/web/index.html+++ /dev/null@@ -1,104 +0,0 @@-<!DOCTYPE html>-<html>-<head>- <!--- If you are serving your web app in a path other than the root, change the- href value below to reflect the base path you are serving from.-- The path provided below has to start and end with a slash "/" in order for- it to work correctly.-- For more details:- * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base-- This is a placeholder for base href that will be replaced by the value of- the `--base-href` argument provided to `flutter build`.- -->- <base href="$FLUTTER_BASE_HREF">-- <meta charset="UTF-8">- <meta content="IE=Edge" http-equiv="X-UA-Compatible">- <meta name="description" content="A new Flutter project.">-- <!-- iOS meta tags & icons -->- <meta name="apple-mobile-web-app-capable" content="yes">- <meta name="apple-mobile-web-app-status-bar-style" content="black">- <meta name="apple-mobile-web-app-title" content="immich_mobile">- <link rel="apple-touch-icon" href="icons/Icon-192.png">-- <!-- Favicon -->- <link rel="icon" type="image/png" href="favicon.png"/>-- <title>immich_mobile</title>- <link rel="manifest" href="manifest.json">-</head>-<body>- <!-- This script installs service_worker.js to provide PWA functionality to- application. For more information, see:- https://developers.google.com/web/fundamentals/primers/service-workers -->- <script>- var serviceWorkerVersion = null;- var scriptLoaded = false;- function loadMainDartJs() {- if (scriptLoaded) {- return;- }- scriptLoaded = true;- var scriptTag = document.createElement('script');- scriptTag.src = 'main.dart.js';- scriptTag.type = 'application/javascript';- document.body.append(scriptTag);- }-- if ('serviceWorker' in navigator) {- // Service workers are supported. Use them.- window.addEventListener('load', function () {- // Wait for registration to finish before dropping the <script> tag.- // Otherwise, the browser will load the script multiple times,- // potentially different versions.- var serviceWorkerUrl = 'flutter_service_worker.js?v=' + serviceWorkerVersion;- navigator.serviceWorker.register(serviceWorkerUrl)- .then((reg) => {- function waitForActivation(serviceWorker) {- serviceWorker.addEventListener('statechange', () => {- if (serviceWorker.state == 'activated') {- console.log('Installed new service worker.');- loadMainDartJs();- }- });- }- if (!reg.active && (reg.installing || reg.waiting)) {- // No active web worker and we have installed or are installing- // one for the first time. Simply wait for it to activate.- waitForActivation(reg.installing || reg.waiting);- } else if (!reg.active.scriptURL.endsWith(serviceWorkerVersion)) {- // When the app updates the serviceWorkerVersion changes, so we- // need to ask the service worker to update.- console.log('New service worker available.');- reg.update();- waitForActivation(reg.installing);- } else {- // Existing service worker is still good.- console.log('Loading app from service worker.');- loadMainDartJs();- }- });-- // If service worker doesn't succeed in a reasonable amount of time,- // fallback to plaint <script> tag.- setTimeout(() => {- if (!scriptLoaded) {- console.warn(- 'Failed to load app from service worker. Falling back to plain <script> tag.',- );- loadMainDartJs();- }- }, 4000);- });- } else {- // Service workers not supported. Just drop the <script> tag.- loadMainDartJs();- }- </script>-</body>-</html>diff --git a/mobile/web/manifest.json b/mobile/web/manifest.jsondeleted file mode 100644index 2cf8c5235a..0000000000--- a/mobile/web/manifest.json+++ /dev/null@@ -1,35 +0,0 @@-{- "name": "immich_mobile",- "short_name": "immich_mobile",- "start_url": ".",- "display": "standalone",- "background_color": "#0175C2",- "theme_color": "#0175C2",- "description": "A new Flutter project.",- "orientation": "portrait-primary",- "prefer_related_applications": false,- "icons": [- {- "src": "icons/Icon-192.png",- "sizes": "192x192",- "type": "image/png"- },- {- "src": "icons/Icon-512.png",- "sizes": "512x512",- "type": "image/png"- },- {- "src": "icons/Icon-maskable-192.png",- "sizes": "192x192",- "type": "image/png",- "purpose": "maskable"- },- {- "src": "icons/Icon-maskable-512.png",- "sizes": "512x512",- "type": "image/png",- "purpose": "maskable"- }- ]-}diff --git a/server/src/config/multer-option.config.ts b/server/src/config/multer-option.config.tsindex 2d8a87dc9f..fea33e5dc0 100644--- a/server/src/config/multer-option.config.ts+++ b/server/src/config/multer-option.config.ts@@ -5,10 +5,8 @@ import { diskStorage } from 'multer';import { extname } from 'path';import { Request } from 'express';import { APP_UPLOAD_LOCATION } from '../constants/upload_location.constant';--export const multerConfig = {- dest: APP_UPLOAD_LOCATION,-};+import { randomUUID } from 'crypto';+import { CreateAssetDto } from '../api-v1/asset/dto/create-asset.dto';export const multerOption: MulterOptions = {fileFilter: (req: Request, file: any, cb: any) => {@@ -21,7 +19,11 @@ export const multerOption: MulterOptions = {storage: diskStorage({destination: (req: Request, file: Express.Multer.File, cb: any) => {- const uploadPath = multerConfig.dest;+ const uploadPath = APP_UPLOAD_LOCATION;+ const fileInfo = req.body as CreateAssetDto;++ const yearInfo = new Date(fileInfo.createdAt).getFullYear();+ const monthInfo = new Date(fileInfo.createdAt).getMonth();if (file.fieldname == 'assetData') {const originalUploadFolder = `${uploadPath}/${req.user['id']}/original/${req.body['deviceId']}`;@@ -30,6 +32,7 @@ export const multerOption: MulterOptions = {mkdirSync(originalUploadFolder, { recursive: true });}+ // Save original to diskcb(null, originalUploadFolder);} else if (file.fieldname == 'thumbnailData') {const thumbnailUploadFolder = `${uploadPath}/${req.user['id']}/thumb/${req.body['deviceId']}`;@@ -38,17 +41,18 @@ export const multerOption: MulterOptions = {mkdirSync(thumbnailUploadFolder, { recursive: true });}+ // Save thumbnail to diskcb(null, thumbnailUploadFolder);}},filename: (req: Request, file: Express.Multer.File, cb: any) => {// console.log(req, file);-+ const fileNameUUID = randomUUID();if (file.fieldname == 'assetData') {- cb(null, `${file.originalname.split('.')[0]}${req.body['fileExtension']}`);+ cb(null, `${fileNameUUID}${req.body['fileExtension'].toLowerCase()}`);} else if (file.fieldname == 'thumbnailData') {- cb(null, `${file.originalname.split('.')[0]}.jpeg`);+ cb(null, `${fileNameUUID}.jpeg`);}},}),