pigallery2-extension-kit 3.5.2 → 3.6.0-edge
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -5
- package/index.d.ts +1 -0
- package/index.js +2 -3
- package/lib/backend/Logger.d.ts +7 -7
- package/lib/backend/Logger.js +104 -0
- package/lib/backend/ProjectPath.d.ts +12 -0
- package/lib/backend/ProjectPath.js +28 -2
- package/lib/backend/exceptions/DirectoryNotFound.d.ts +2 -0
- package/lib/backend/exceptions/DirectoryNotFound.js +7 -0
- package/lib/backend/exceptions/FileAlreadyExists.js +10 -0
- package/lib/backend/exceptions/FolderNotWritable.d.ts +2 -0
- package/lib/backend/exceptions/FolderNotWritable.js +7 -0
- package/lib/backend/exceptions/LocationLookupException.js +10 -0
- package/lib/backend/index.d.ts +1 -1
- package/lib/backend/middlewares/AlbumMWs.js +61 -0
- package/lib/backend/middlewares/GalleryMWs.d.ts +4 -0
- package/lib/backend/middlewares/GalleryMWs.js +380 -0
- package/lib/backend/middlewares/MetaFileMWs.js +41 -0
- package/lib/backend/middlewares/NotificationMWs.js +21 -0
- package/lib/backend/middlewares/PersonMWs.d.ts +1 -1
- package/lib/backend/middlewares/PersonMWs.js +64 -0
- package/lib/backend/middlewares/RenderingMWs.d.ts +24 -0
- package/lib/backend/middlewares/RenderingMWs.js +182 -0
- package/lib/backend/middlewares/RequestParams.d.ts +13 -0
- package/lib/backend/middlewares/RequestParams.js +25 -0
- package/lib/backend/middlewares/RequestSession.d.ts +9 -0
- package/lib/backend/middlewares/RequestSession.js +16 -0
- package/lib/backend/middlewares/ServerTimingMWs.d.ts +6 -6
- package/lib/backend/middlewares/ServerTimingMWs.js +108 -0
- package/lib/backend/middlewares/SharingMWs.d.ts +2 -1
- package/lib/backend/middlewares/SharingMWs.js +240 -0
- package/lib/backend/middlewares/UploadMWs.js +95 -0
- package/lib/backend/middlewares/VersionMWs.d.ts +1 -1
- package/lib/backend/middlewares/VersionMWs.js +41 -0
- package/lib/backend/middlewares/admin/AdminMWs.js +115 -0
- package/lib/backend/middlewares/admin/ExtensionMWs.js +85 -0
- package/lib/backend/middlewares/admin/SettingsMWs.js +54 -0
- package/lib/backend/middlewares/thumbnail/ThumbnailGeneratorMWs.d.ts +1 -1
- package/lib/backend/middlewares/thumbnail/ThumbnailGeneratorMWs.js +153 -0
- package/lib/backend/middlewares/user/AuthenticationMWs.d.ts +37 -0
- package/lib/backend/middlewares/user/AuthenticationMWs.js +346 -0
- package/lib/backend/middlewares/user/OIDCAuthService.d.ts +36 -5
- package/lib/backend/middlewares/user/OIDCAuthService.js +216 -0
- package/lib/backend/middlewares/user/OIDCMWs.d.ts +10 -0
- package/lib/backend/middlewares/user/OIDCMWs.js +30 -0
- package/lib/backend/middlewares/user/UserMWs.d.ts +1 -0
- package/lib/backend/middlewares/user/UserMWs.js +120 -0
- package/lib/backend/middlewares/user/UserRequestConstrainsMWs.d.ts +0 -1
- package/lib/backend/middlewares/user/UserRequestConstrainsMWs.js +29 -0
- package/lib/backend/model/DirectoryAccess.d.ts +78 -0
- package/lib/backend/model/DirectoryAccess.js +222 -0
- package/lib/backend/model/EventLoopHandler.d.ts +1 -1
- package/lib/backend/model/EventLoopHandler.js +24 -0
- package/lib/backend/model/FFmpeg.d.ts +47 -0
- package/lib/backend/model/FFmpeg.js +75 -0
- package/lib/backend/model/FFmpegFactory.d.ts +11 -2
- package/lib/backend/model/FFmpegFactory.js +28 -0
- package/lib/backend/model/Localizations.js +19 -0
- package/lib/backend/model/ObjectManagers.d.ts +1 -1
- package/lib/backend/model/ObjectManagers.js +253 -0
- package/lib/backend/model/PasswordHelper.d.ts +1 -1
- package/lib/backend/model/PasswordHelper.js +6 -2
- package/lib/backend/model/SessionContext.d.ts +16 -6
- package/lib/backend/model/SessionContext.js +11 -0
- package/lib/backend/model/UploadManager.d.ts +6 -3
- package/lib/backend/model/UploadManager.js +101 -0
- package/lib/backend/model/database/AlbumManager.js +122 -0
- package/lib/backend/model/database/CoverManager.d.ts +8 -2
- package/lib/backend/model/database/CoverManager.js +169 -0
- package/lib/backend/model/database/GalleryManager.d.ts +15 -9
- package/lib/backend/model/database/GalleryManager.js +363 -0
- package/lib/backend/model/database/IObjectManager.js +2 -0
- package/lib/backend/model/database/IndexingManager.d.ts +7 -7
- package/lib/backend/model/database/IndexingManager.js +452 -0
- package/lib/backend/model/database/LocationManager.d.ts +2 -3
- package/lib/backend/model/database/LocationManager.js +39 -0
- package/lib/backend/model/database/PersonManager.d.ts +5 -3
- package/lib/backend/model/database/PersonManager.js +248 -0
- package/lib/backend/model/database/ProjectedCacheManager.d.ts +9 -8
- package/lib/backend/model/database/ProjectedCacheManager.js +297 -0
- package/lib/backend/model/database/ProjectionAwareManager.d.ts +4 -4
- package/lib/backend/model/database/ProjectionAwareManager.js +56 -0
- package/lib/backend/model/database/SQLConnection.d.ts +4 -2
- package/lib/backend/model/database/SQLConnection.js +295 -0
- package/lib/backend/model/database/SearchManager.d.ts +23 -8
- package/lib/backend/model/database/SearchManager.js +1032 -0
- package/lib/backend/model/database/SessionManager.d.ts +41 -4
- package/lib/backend/model/database/SessionManager.js +228 -0
- package/lib/backend/model/database/SharingManager.d.ts +11 -6
- package/lib/backend/model/database/SharingManager.js +160 -0
- package/lib/backend/model/database/UserManager.d.ts +8 -1
- package/lib/backend/model/database/UserManager.js +148 -0
- package/lib/backend/model/database/VersionManager.js +60 -0
- package/lib/backend/model/database/enitites/DirectoryEntity.d.ts +1 -1
- package/lib/backend/model/database/enitites/DirectoryEntity.js +76 -0
- package/lib/backend/model/database/enitites/EntityUtils.d.ts +22 -1
- package/lib/backend/model/database/enitites/EntityUtils.js +66 -0
- package/lib/backend/model/database/enitites/FileEntity.js +31 -0
- package/lib/backend/model/database/enitites/MDFileEntity.js +21 -0
- package/lib/backend/model/database/enitites/MediaEntity.d.ts +5 -2
- package/lib/backend/model/database/enitites/MediaEntity.js +223 -0
- package/lib/backend/model/database/enitites/PhotoEntity.js +19 -0
- package/lib/backend/model/database/enitites/ProjectedDirectoryCacheEntity.d.ts +2 -2
- package/lib/backend/model/database/enitites/ProjectedDirectoryCacheEntity.js +61 -0
- package/lib/backend/model/database/enitites/SharingEntity.d.ts +11 -5
- package/lib/backend/model/database/enitites/SharingEntity.js +100 -0
- package/lib/backend/model/database/enitites/UserEntity.d.ts +8 -5
- package/lib/backend/model/database/enitites/UserEntity.js +97 -0
- package/lib/backend/model/database/enitites/VersionEntity.js +19 -0
- package/lib/backend/model/database/enitites/VideoEntity.d.ts +2 -2
- package/lib/backend/model/database/enitites/VideoEntity.js +38 -0
- package/lib/backend/model/database/enitites/album/AlbumBaseEntity.js +32 -0
- package/lib/backend/model/database/enitites/album/ProjectedAlbumCacheEntity.d.ts +2 -2
- package/lib/backend/model/database/enitites/album/ProjectedAlbumCacheEntity.js +52 -0
- package/lib/backend/model/database/enitites/album/SavedSearchEntity.js +29 -0
- package/lib/backend/model/database/enitites/person/PersonEntry.js +36 -0
- package/lib/backend/model/database/enitites/person/PersonJunctionTable.js +37 -0
- package/lib/backend/model/database/enitites/person/ProjectedPersonCacheEntity.d.ts +1 -1
- package/lib/backend/model/database/enitites/person/ProjectedPersonCacheEntity.js +49 -0
- package/lib/backend/model/diagnostics/ConfigDiagnostics.d.ts +31 -12
- package/lib/backend/model/diagnostics/ConfigDiagnostics.js +537 -0
- package/lib/backend/model/extension/ExpressRouterWrapper.d.ts +10 -4
- package/lib/backend/model/extension/ExpressRouterWrapper.js +113 -0
- package/lib/backend/model/extension/ExtensionApp.d.ts +2 -3
- package/lib/backend/model/extension/ExtensionApp.js +18 -0
- package/lib/backend/model/extension/ExtensionConfig.js +17 -0
- package/lib/backend/model/extension/ExtensionConfigTemplateLoader.js +4 -3
- package/lib/backend/model/extension/ExtensionConfigWrapper.js +6 -5
- package/lib/backend/model/extension/ExtensionDB.d.ts +2 -2
- package/lib/backend/model/extension/ExtensionDB.js +22 -0
- package/lib/backend/model/extension/ExtensionDecorator.js +33 -0
- package/lib/backend/model/extension/ExtensionEvent.d.ts +12 -1
- package/lib/backend/model/extension/ExtensionEvent.js +81 -0
- package/lib/backend/model/extension/ExtensionManager.d.ts +22 -4
- package/lib/backend/model/extension/ExtensionManager.js +424 -0
- package/lib/backend/model/extension/ExtensionMessengerHandler.js +28 -0
- package/lib/backend/model/extension/ExtensionObject.d.ts +6 -3
- package/lib/backend/model/extension/ExtensionObject.js +45 -0
- package/lib/backend/model/extension/ExtensionRepository.js +69 -0
- package/lib/backend/model/extension/IExtension.d.ts +35 -18
- package/lib/backend/model/extension/IExtension.js +2 -0
- package/lib/backend/model/extension/UIExtension.js +23 -0
- package/lib/backend/model/fileaccess/DiskManager.d.ts +3 -1
- package/lib/backend/model/fileaccess/DiskManager.js +313 -0
- package/lib/backend/model/fileaccess/MetadataCreationDate.js +27 -0
- package/lib/backend/model/fileaccess/MetadataLoader.d.ts +17 -0
- package/lib/backend/model/fileaccess/MetadataLoader.js +765 -0
- package/lib/backend/model/fileaccess/PhotoWorker.js +159 -0
- package/lib/backend/model/fileaccess/TaskExecuter.js +41 -0
- package/lib/backend/model/fileaccess/TaskQue.d.ts +4 -4
- package/lib/backend/model/fileaccess/TaskQue.js +50 -0
- package/lib/backend/model/fileaccess/VideoConverterWorker.d.ts +4 -1
- package/lib/backend/model/fileaccess/VideoConverterWorker.js +59 -0
- package/lib/backend/model/fileaccess/fileprocessing/GPXProcessing.js +136 -0
- package/lib/backend/model/fileaccess/fileprocessing/PhotoProcessing.d.ts +3 -2
- package/lib/backend/model/fileaccess/fileprocessing/PhotoProcessing.js +251 -0
- package/lib/backend/model/fileaccess/fileprocessing/VideoProcessing.js +97 -0
- package/lib/backend/model/jobs/JobManager.d.ts +2 -4
- package/lib/backend/model/jobs/JobManager.js +129 -0
- package/lib/backend/model/jobs/JobProgressManager.d.ts +5 -3
- package/lib/backend/model/jobs/JobProgressManager.js +94 -0
- package/lib/backend/model/jobs/JobRepository.d.ts +1 -3
- package/lib/backend/model/jobs/JobRepository.js +50 -0
- package/lib/backend/model/jobs/jobs/AlbumCoverFillingJob.d.ts +1 -1
- package/lib/backend/model/jobs/jobs/AlbumCoverFillingJob.js +91 -0
- package/lib/backend/model/jobs/jobs/AlbumCoverResetJob.js +32 -0
- package/lib/backend/model/jobs/jobs/AlbumResetJob.js +30 -0
- package/lib/backend/model/jobs/jobs/FileJob.js +243 -0
- package/lib/backend/model/jobs/jobs/GPXCompressionJob.js +35 -0
- package/lib/backend/model/jobs/jobs/GPXCompressionResetJob.js +23 -0
- package/lib/backend/model/jobs/jobs/GalleryResetJob.js +30 -0
- package/lib/backend/model/jobs/jobs/IJob.js +2 -0
- package/lib/backend/model/jobs/jobs/IJobListener.d.ts +2 -2
- package/lib/backend/model/jobs/jobs/IJobListener.js +2 -0
- package/lib/backend/model/jobs/jobs/IndexingJob.js +99 -0
- package/lib/backend/model/jobs/jobs/Job.d.ts +4 -1
- package/lib/backend/model/jobs/jobs/Job.js +135 -0
- package/lib/backend/model/jobs/jobs/JobProgress.js +100 -0
- package/lib/backend/model/jobs/jobs/PhotoConvertingJob.js +78 -0
- package/lib/backend/model/jobs/jobs/TempFolderCleaningJob.js +122 -0
- package/lib/backend/model/jobs/jobs/TopPickSendJob.js +113 -0
- package/lib/backend/model/jobs/jobs/VideoConvertingJob.js +31 -0
- package/lib/backend/model/messenger/EmailMessenger.d.ts +1 -1
- package/lib/backend/model/messenger/EmailMessenger.js +87 -0
- package/lib/backend/model/messenger/ExtensionMessenger.js +16 -0
- package/lib/backend/model/messenger/Messenger.d.ts +1 -2
- package/lib/backend/model/messenger/Messenger.js +36 -0
- package/lib/backend/model/messenger/MessengerRepository.d.ts +1 -3
- package/lib/backend/model/messenger/MessengerRepository.js +38 -0
- package/lib/backend/model/messenger/StdoutMessenger.js +16 -0
- package/lib/backend/routes/AlbumRouter.js +39 -0
- package/lib/backend/routes/ErrorRouter.d.ts +1 -0
- package/lib/backend/routes/ErrorRouter.js +39 -0
- package/lib/backend/routes/GalleryRouter.d.ts +8 -0
- package/lib/backend/routes/GalleryRouter.js +165 -0
- package/lib/backend/routes/LoggerRouter.js +43 -0
- package/lib/backend/routes/NotificationRouter.js +19 -0
- package/lib/backend/routes/OIDCRouter.js +20 -0
- package/lib/backend/routes/PersonRouter.js +41 -0
- package/lib/backend/routes/PublicRouter.d.ts +3 -6
- package/lib/backend/routes/PublicRouter.js +301 -0
- package/lib/backend/routes/Router.js +36 -0
- package/lib/backend/routes/SharingRouter.d.ts +1 -1
- package/lib/backend/routes/SharingRouter.js +55 -0
- package/lib/backend/routes/UploadRouter.js +18 -0
- package/lib/backend/routes/UserRouter.d.ts +1 -0
- package/lib/backend/routes/UserRouter.js +53 -0
- package/lib/backend/routes/admin/AdminRouter.js +32 -0
- package/lib/backend/routes/admin/ExtensionRouter.js +30 -0
- package/lib/backend/routes/admin/SettingsRouter.js +18 -0
- package/lib/backend/server.d.ts +3 -3
- package/lib/backend/server.js +176 -0
- package/lib/common/CookieNames.js +10 -0
- package/lib/common/CustomHeaders.js +8 -0
- package/lib/common/DataStructureVersion.d.ts +1 -1
- package/lib/common/DataStructureVersion.js +7 -0
- package/lib/common/PG2ConfMap.js +36 -0
- package/lib/common/QueryParams.js +45 -0
- package/lib/common/SearchQueryParser.d.ts +2 -2
- package/lib/common/SearchQueryParser.js +611 -0
- package/lib/common/SearchQueryUtils.d.ts +71 -4
- package/lib/common/SearchQueryUtils.js +443 -0
- package/lib/common/SupportedFormats.d.ts +11 -1
- package/lib/common/SupportedFormats.js +13 -19
- package/lib/common/TextFold.d.ts +6 -0
- package/lib/common/TextFold.js +19 -0
- package/lib/common/UploadUtils.d.ts +4 -0
- package/lib/common/UploadUtils.js +20 -0
- package/lib/common/Utils.d.ts +23 -24
- package/lib/common/Utils.js +37 -97
- package/lib/common/config/private/Config.d.ts +1 -1
- package/lib/common/config/private/Config.js +2 -0
- package/lib/common/config/private/PrivateConfig.d.ts +17 -4
- package/lib/common/config/private/PrivateConfig.js +262 -33
- package/lib/common/config/private/PrivateConfigClass.js +10 -13
- package/lib/common/config/private/WebConfig.d.ts +1 -2
- package/lib/common/config/private/WebConfig.js +0 -2
- package/lib/common/config/private/subconfigs/MessagingConfig.js +8 -0
- package/lib/common/config/private/subconfigs/ServerExtensionsConfig.d.ts +2 -3
- package/lib/common/config/private/subconfigs/ServerExtensionsConfig.js +7 -3
- package/lib/common/config/public/ClientConfig.d.ts +55 -17
- package/lib/common/config/public/ClientConfig.js +291 -20
- package/lib/common/config/public/Config.js +5 -4
- package/lib/common/entities/AutoCompleteItem.d.ts +3 -3
- package/lib/common/entities/ContentWrapper.d.ts +21 -8
- package/lib/common/entities/ContentWrapper.js +286 -318
- package/lib/common/entities/DirectoryDTO.d.ts +7 -6
- package/lib/common/entities/DirectoryDTO.js +10 -5
- package/lib/common/entities/Error.d.ts +12 -7
- package/lib/common/entities/Error.js +15 -3
- package/lib/common/entities/MediaDTO.d.ts +13 -0
- package/lib/common/entities/MediaDTO.js +10 -7
- package/lib/common/entities/Message.d.ts +3 -3
- package/lib/common/entities/NotificationDTO.d.ts +2 -2
- package/lib/common/entities/SearchQueryDTO.d.ts +9 -1
- package/lib/common/entities/SearchQueryDTO.js +1 -0
- package/lib/common/entities/SharingDTO.d.ts +39 -5
- package/lib/common/entities/SortingMethods.d.ts +26 -2
- package/lib/common/entities/SortingMethods.js +14 -1
- package/lib/common/entities/UserDTO.d.ts +5 -2
- package/lib/common/entities/UserSettingsDTO.d.ts +3 -1
- package/lib/common/entities/VideoDTO.d.ts +2 -5
- package/lib/common/entities/album/AlbumBaseDTO.d.ts +2 -2
- package/lib/common/entities/extension/ExtensionListItem.d.ts +1 -1
- package/lib/common/entities/extension/IClientUIConfig.d.ts +19 -12
- package/lib/common/entities/job/JobDTO.d.ts +1 -1
- package/lib/common/entities/job/JobProgressDTO.d.ts +1 -1
- package/lib/common/entities/job/JobScheduleDTO.d.ts +5 -5
- package/lib/common/entities/job/JobScheduleDTO.js +9 -5
- package/lib/common/event/Event.js +49 -0
- package/lib/common/event/EventLimit.d.ts +1 -1
- package/package.json +21 -8
- package/REPOSITORY.md +0 -13
- package/events.drawio +0 -1
- package/events.png +0 -0
- package/index.js.map +0 -1
- package/index.ts +0 -2
- package/lib/backend/model/database/enitites/PersonEntry.d.ts +0 -11
- package/lib/backend/model/database/enitites/PersonJunctionTable.d.ts +0 -10
- package/lib/common/entities/ConentWrapper.d.ts +0 -18
- package/lib/common/entities/ConentWrapper.js +0 -490
- package/lib/frontend/app/app.component.d.ts +0 -18
- package/lib/frontend/app/app.module.d.ts +0 -23
- package/lib/frontend/app/app.routing.d.ts +0 -4
- package/lib/frontend/app/icon.component.d.ts +0 -7
- package/lib/frontend/app/model/IRenderable.d.ts +0 -17
- package/lib/frontend/app/model/backendtext.service.d.ts +0 -7
- package/lib/frontend/app/model/backendtext.service.spec.d.ts +0 -1
- package/lib/frontend/app/model/extension.service.d.ts +0 -5
- package/lib/frontend/app/model/navigation.service.d.ts +0 -12
- package/lib/frontend/app/model/network/autehentication.service.spec.d.ts +0 -1
- package/lib/frontend/app/model/network/authentication.service.d.ts +0 -22
- package/lib/frontend/app/model/network/helper/auth.guard.d.ts +0 -9
- package/lib/frontend/app/model/network/helper/csrf.interceptor.d.ts +0 -8
- package/lib/frontend/app/model/network/helper/error.interceptor.d.ts +0 -8
- package/lib/frontend/app/model/network/network.service.d.ts +0 -29
- package/lib/frontend/app/model/network/network.service.spec.d.ts +0 -1
- package/lib/frontend/app/model/network/user.service.d.ts +0 -13
- package/lib/frontend/app/model/network/user.service.spec.d.ts +0 -1
- package/lib/frontend/app/model/notification.service.d.ts +0 -28
- package/lib/frontend/app/model/page.helper.d.ts +0 -15
- package/lib/frontend/app/model/pi-title.service.d.ts +0 -15
- package/lib/frontend/app/model/query.service.d.ts +0 -19
- package/lib/frontend/app/model/seededRandom.service.d.ts +0 -7
- package/lib/frontend/app/model/theme.service.d.ts +0 -16
- package/lib/frontend/app/model/version.service.d.ts +0 -10
- package/lib/frontend/app/pipes/DurationPipe.d.ts +0 -4
- package/lib/frontend/app/pipes/FileDTOToPathPipe.d.ts +0 -5
- package/lib/frontend/app/pipes/FileDTOToRelativePathPipe.d.ts +0 -5
- package/lib/frontend/app/pipes/FileSizePipe.d.ts +0 -4
- package/lib/frontend/app/pipes/GPXFilesFilterPipe.d.ts +0 -5
- package/lib/frontend/app/pipes/MDFilesFilterPipe.d.ts +0 -6
- package/lib/frontend/app/pipes/ParseIntPipe.d.ts +0 -4
- package/lib/frontend/app/pipes/PhotoFilterPipe.d.ts +0 -6
- package/lib/frontend/app/pipes/SafeHTMLPipe.d.ts +0 -7
- package/lib/frontend/app/pipes/StringifyEnum.d.ts +0 -4
- package/lib/frontend/app/pipes/StringifyGridSize.d.ts +0 -5
- package/lib/frontend/app/pipes/StringifyRolePipe.d.ts +0 -4
- package/lib/frontend/app/pipes/StringifySearchQuery.d.ts +0 -8
- package/lib/frontend/app/pipes/StringifySearchType.d.ts +0 -5
- package/lib/frontend/app/pipes/StringifySortingMethod.d.ts +0 -4
- package/lib/frontend/app/ui/EnumTranslations.d.ts +0 -5
- package/lib/frontend/app/ui/admin/admin.component.d.ts +0 -36
- package/lib/frontend/app/ui/albums/album/album.component.d.ts +0 -26
- package/lib/frontend/app/ui/albums/albums.component.d.ts +0 -31
- package/lib/frontend/app/ui/albums/albums.service.d.ts +0 -12
- package/lib/frontend/app/ui/albums/saved-search-popup/saved-search-popup.component.d.ts +0 -15
- package/lib/frontend/app/ui/duplicates/duplicates.component.d.ts +0 -36
- package/lib/frontend/app/ui/duplicates/duplicates.service.d.ts +0 -9
- package/lib/frontend/app/ui/duplicates/photo/photo.duplicates.component.d.ts +0 -11
- package/lib/frontend/app/ui/faces/Person.d.ts +0 -9
- package/lib/frontend/app/ui/faces/face/face.component.d.ts +0 -22
- package/lib/frontend/app/ui/faces/faces.component.d.ts +0 -18
- package/lib/frontend/app/ui/faces/faces.service.d.ts +0 -14
- package/lib/frontend/app/ui/faces/navigator/navigator.faces.component.d.ts +0 -15
- package/lib/frontend/app/ui/frame/frame.component.d.ts +0 -60
- package/lib/frontend/app/ui/gallery/Media.d.ts +0 -15
- package/lib/frontend/app/ui/gallery/MediaIcon.d.ts +0 -29
- package/lib/frontend/app/ui/gallery/blog/blog.gallery.component.d.ts +0 -16
- package/lib/frontend/app/ui/gallery/blog/blog.service.d.ts +0 -85
- package/lib/frontend/app/ui/gallery/blog/blog.service.spec.d.ts +0 -1
- package/lib/frontend/app/ui/gallery/cache.gallery.service.d.ts +0 -51
- package/lib/frontend/app/ui/gallery/content.service.d.ts +0 -11
- package/lib/frontend/app/ui/gallery/contentLoader.service.d.ts +0 -37
- package/lib/frontend/app/ui/gallery/directories/directories.component.d.ts +0 -14
- package/lib/frontend/app/ui/gallery/directories/directory/directory.gallery.component.d.ts +0 -20
- package/lib/frontend/app/ui/gallery/filter/filter.gallery.component.d.ts +0 -32
- package/lib/frontend/app/ui/gallery/filter/filter.service.d.ts +0 -51
- package/lib/frontend/app/ui/gallery/filter/filter.service.spec.d.ts +0 -1
- package/lib/frontend/app/ui/gallery/fullscreen.service.d.ts +0 -7
- package/lib/frontend/app/ui/gallery/gallery.component.d.ts +0 -64
- package/lib/frontend/app/ui/gallery/gallery.component.spec.d.ts +0 -1
- package/lib/frontend/app/ui/gallery/gallery.service.d.ts +0 -13
- package/lib/frontend/app/ui/gallery/grid/GridMedia.d.ts +0 -13
- package/lib/frontend/app/ui/gallery/grid/GridRowBuilder.d.ts +0 -16
- package/lib/frontend/app/ui/gallery/grid/grid.gallery.component.d.ts +0 -88
- package/lib/frontend/app/ui/gallery/grid/grid.gallery.component.spec.d.ts +0 -1
- package/lib/frontend/app/ui/gallery/grid/photo/loading/loading.photo.grid.gallery.component.d.ts +0 -4
- package/lib/frontend/app/ui/gallery/grid/photo/media-button-modal/media-button-modal.component.d.ts +0 -20
- package/lib/frontend/app/ui/gallery/grid/photo/media-button-modal/media-button-modal.service.d.ts +0 -27
- package/lib/frontend/app/ui/gallery/grid/photo/photo.grid.gallery.component.d.ts +0 -53
- package/lib/frontend/app/ui/gallery/lightbox/controls/controls.lightbox.gallery.component.d.ts +0 -103
- package/lib/frontend/app/ui/gallery/lightbox/infopanel/info-panel.lightbox.gallery.component.d.ts +0 -51
- package/lib/frontend/app/ui/gallery/lightbox/lightbox.gallery.component.d.ts +0 -95
- package/lib/frontend/app/ui/gallery/lightbox/lightbox.gallery.component.spec.d.ts +0 -1
- package/lib/frontend/app/ui/gallery/lightbox/lightbox.service.d.ts +0 -45
- package/lib/frontend/app/ui/gallery/lightbox/media/media.lightbox.gallery.component.d.ts +0 -71
- package/lib/frontend/app/ui/gallery/map/MarkerFactory.d.ts +0 -12
- package/lib/frontend/app/ui/gallery/map/lightbox/lightbox.map.gallery.component.d.ts +0 -80
- package/lib/frontend/app/ui/gallery/map/map.gallery.component.d.ts +0 -36
- package/lib/frontend/app/ui/gallery/map/map.service.d.ts +0 -30
- package/lib/frontend/app/ui/gallery/navigator/navigator.gallery.component.d.ts +0 -81
- package/lib/frontend/app/ui/gallery/navigator/navigator.service.d.ts +0 -14
- package/lib/frontend/app/ui/gallery/navigator/sorting.service.d.ts +0 -38
- package/lib/frontend/app/ui/gallery/overlay.service.d.ts +0 -9
- package/lib/frontend/app/ui/gallery/photo-frame-builder/photo-frame-builder.gallery.component.d.ts +0 -40
- package/lib/frontend/app/ui/gallery/random-query-builder/random-query-builder.gallery.component.d.ts +0 -30
- package/lib/frontend/app/ui/gallery/search/AutoCompleteRenderItem.d.ts +0 -11
- package/lib/frontend/app/ui/gallery/search/autocomplete.service.d.ts +0 -33
- package/lib/frontend/app/ui/gallery/search/query-builder/query-bulder.gallery.component.d.ts +0 -22
- package/lib/frontend/app/ui/gallery/search/query-enrty/query-entry.search.gallery.component.d.ts +0 -43
- package/lib/frontend/app/ui/gallery/search/search-field/search-field.gallery.component.d.ts +0 -31
- package/lib/frontend/app/ui/gallery/search/search-field-base/search-field-base.gallery.component.d.ts +0 -57
- package/lib/frontend/app/ui/gallery/search/search-query-parser.service.d.ts +0 -7
- package/lib/frontend/app/ui/gallery/search/search.gallery.component.d.ts +0 -39
- package/lib/frontend/app/ui/gallery/share/share.gallery.component.d.ts +0 -67
- package/lib/frontend/app/ui/gallery/share.service.d.ts +0 -35
- package/lib/frontend/app/ui/gallery/thumbnailLoader.service.d.ts +0 -41
- package/lib/frontend/app/ui/gallery/thumbnailManager.service.d.ts +0 -46
- package/lib/frontend/app/ui/gallery/uploader/uploader.gallery.component.d.ts +0 -15
- package/lib/frontend/app/ui/gallery/uploader/uploader.service.d.ts +0 -36
- package/lib/frontend/app/ui/gallery/wakelock.service.d.ts +0 -19
- package/lib/frontend/app/ui/language/language.component.d.ts +0 -10
- package/lib/frontend/app/ui/login/login.component.d.ts +0 -18
- package/lib/frontend/app/ui/settings/extension-installer/extension-installer.component.d.ts +0 -18
- package/lib/frontend/app/ui/settings/extension-installer/extension-installer.service.d.ts +0 -10
- package/lib/frontend/app/ui/settings/gallery-statistic/gallery-statistic.component.d.ts +0 -5
- package/lib/frontend/app/ui/settings/scheduled-jobs.service.d.ts +0 -41
- package/lib/frontend/app/ui/settings/settings.service.d.ts +0 -27
- package/lib/frontend/app/ui/settings/sharings-list/sharings-list.component.d.ts +0 -14
- package/lib/frontend/app/ui/settings/template/CustomSettingsEntries.d.ts +0 -57
- package/lib/frontend/app/ui/settings/template/ISettingsComponent.d.ts +0 -13
- package/lib/frontend/app/ui/settings/template/settings-entry/settings-entry.component.d.ts +0 -118
- package/lib/frontend/app/ui/settings/template/settings-entry/sorting-method/sorting-method.settings-entry.component.d.ts +0 -28
- package/lib/frontend/app/ui/settings/template/template.component.d.ts +0 -97
- package/lib/frontend/app/ui/settings/users/users.component.d.ts +0 -47
- package/lib/frontend/app/ui/settings/users/users.service.d.ts +0 -12
- package/lib/frontend/app/ui/settings/workflow/button/job-button.settings.component.d.ts +0 -32
- package/lib/frontend/app/ui/settings/workflow/progress/job-progress.settings.component.d.ts +0 -25
- package/lib/frontend/app/ui/settings/workflow/workflow.component.d.ts +0 -68
- package/lib/frontend/app/ui/sharelogin/share-login.component.d.ts +0 -16
- package/lib/frontend/app/ui/utils/grid-size-icon/grid-size-icon.component.d.ts +0 -5
- package/lib/frontend/app/ui/utils/sorting-method-icon/sorting-method-icon.component.d.ts +0 -13
- package/lib/frontend/app/ui/utils/timestamp-datepicker/datepicker.component.d.ts +0 -10
- package/lib/frontend/app/ui/utils/timestamp-timepicker/timepicker.component.d.ts +0 -11
- package/lib/frontend/environments/environment.d.ts +0 -3
- package/lib/frontend/environments/environment.prod.d.ts +0 -3
- package/lib/frontend/main.d.ts +0 -21
- package/lib/frontend/polyfills.d.ts +0 -60
- package/lib/frontend/test.d.ts +0 -1
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GalleryMWs = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const path = tslib_1.__importStar(require("node:path"));
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
7
|
+
const archiver_1 = require("archiver");
|
|
8
|
+
const Error_1 = require("../../common/entities/Error");
|
|
9
|
+
const ObjectManagers_1 = require("../model/ObjectManagers");
|
|
10
|
+
const DirectoryAccess_1 = require("../model/DirectoryAccess");
|
|
11
|
+
const ContentWrapper_1 = require("../../common/entities/ContentWrapper");
|
|
12
|
+
const ProjectPath_1 = require("../ProjectPath");
|
|
13
|
+
const Config_1 = require("../../common/config/private/Config");
|
|
14
|
+
const MediaDTO_1 = require("../../common/entities/MediaDTO");
|
|
15
|
+
const QueryParams_1 = require("../../common/QueryParams");
|
|
16
|
+
const VideoProcessing_1 = require("../model/fileaccess/fileprocessing/VideoProcessing");
|
|
17
|
+
const SearchQueryDTO_1 = require("../../common/entities/SearchQueryDTO");
|
|
18
|
+
const SearchQueryUtils_1 = require("../../common/SearchQueryUtils");
|
|
19
|
+
const LocationLookupException_1 = require("../exceptions/LocationLookupException");
|
|
20
|
+
const ServerTimingMWs_1 = require("./ServerTimingMWs");
|
|
21
|
+
const SortingMethods_1 = require("../../common/entities/SortingMethods");
|
|
22
|
+
const RequestParams_1 = require("./RequestParams");
|
|
23
|
+
const RequestSession_1 = require("./RequestSession");
|
|
24
|
+
class GalleryMWs {
|
|
25
|
+
/**
|
|
26
|
+
* Middleware to safely parse searchQueryDTO from URL parameters
|
|
27
|
+
* Handles URL decoding and JSON parsing with proper error handling
|
|
28
|
+
*/
|
|
29
|
+
static parseSearchQuery(req, res, next) {
|
|
30
|
+
try {
|
|
31
|
+
const rawQueryParam = RequestParams_1.RequestParams.get(req, 'searchQueryDTO');
|
|
32
|
+
if (!rawQueryParam) {
|
|
33
|
+
return next();
|
|
34
|
+
}
|
|
35
|
+
// the shortened query of the search page urls (e.g. the random link of the gallery) or the full JSON
|
|
36
|
+
const query = SearchQueryUtils_1.SearchQueryUtils.parseURLifiedQuery(rawQueryParam);
|
|
37
|
+
// Store the parsed query for use by subsequent middlewares
|
|
38
|
+
req.resultPipe = query;
|
|
39
|
+
return next();
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
return next(new Error_1.ErrorDTO(Error_1.ErrorCodes.GENERAL_ERROR, 'Error parsing search query', err));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
static async listDirectory(req, res, next) {
|
|
46
|
+
const directoryName = RequestParams_1.RequestParams.get(req, 'directory') || '/';
|
|
47
|
+
const absoluteDirectoryName = ProjectPath_1.ProjectPath.resolveInImageFolder(directoryName);
|
|
48
|
+
// set by AuthenticationMWs.authoriseDirectory
|
|
49
|
+
const access = req.directoryAccess ?? DirectoryAccess_1.DirectoryAccessTypes.available;
|
|
50
|
+
let isDirectory = false;
|
|
51
|
+
try {
|
|
52
|
+
isDirectory = !!absoluteDirectoryName && (await node_fs_1.promises.stat(absoluteDirectoryName)).isDirectory();
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
// not existing
|
|
56
|
+
}
|
|
57
|
+
if (!isDirectory) {
|
|
58
|
+
// the same answer as AuthenticationMWs.authoriseDirectory gives for not available directories
|
|
59
|
+
return next(new Error_1.ErrorDTO(Error_1.ErrorCodes.DIRECTORY_NOT_FOUND, 'Directory not found'));
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
const directory = await ObjectManagers_1.ObjectManagers.getInstance().GalleryManager.listDirectory(RequestSession_1.RequestSession.getContext(req), directoryName, parseInt(req.query[QueryParams_1.QueryParams.gallery.knownLastModified], 10), parseInt(req.query[QueryParams_1.QueryParams.gallery.knownLastScanned], 10), {
|
|
63
|
+
// sharing without directory query only sees already indexed directories with visible photos
|
|
64
|
+
allowIndexing: !RequestSession_1.RequestSession.getContext(req).directoryAccess.byPhotos,
|
|
65
|
+
// parents only show the way to the available directories
|
|
66
|
+
withMetaFiles: access === DirectoryAccess_1.DirectoryAccessTypes.available
|
|
67
|
+
});
|
|
68
|
+
if (directory == null) {
|
|
69
|
+
req.resultPipe = ContentWrapper_1.ContentWrapperUtils.build(null, null, true);
|
|
70
|
+
return next();
|
|
71
|
+
}
|
|
72
|
+
directory.availableParents = RequestSession_1.RequestSession.getContext(req).directoryAccess.getAvailableParents(directoryName);
|
|
73
|
+
req.resultPipe = ContentWrapper_1.ContentWrapperUtils.build(directory, null);
|
|
74
|
+
return next();
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
return next(new Error_1.ErrorDTO(Error_1.ErrorCodes.GENERAL_ERROR, 'Error during listing the directory', err));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
static async zipDirectory(req, res, next) {
|
|
81
|
+
if (Config_1.Config.Gallery.NavBar.enableDownloadZip === false) {
|
|
82
|
+
return next();
|
|
83
|
+
}
|
|
84
|
+
if (Config_1.Config.Search.enabled === false || !req.resultPipe) {
|
|
85
|
+
return next();
|
|
86
|
+
}
|
|
87
|
+
// Handle search-query-based zip
|
|
88
|
+
try {
|
|
89
|
+
const query = req.resultPipe;
|
|
90
|
+
// Get all media items from search
|
|
91
|
+
const searchResult = await ObjectManagers_1.ObjectManagers.getInstance().SearchManager.search(RequestSession_1.RequestSession.getContext(req), query);
|
|
92
|
+
if (!searchResult.media || searchResult.media.length === 0) {
|
|
93
|
+
return next(new Error_1.ErrorDTO(Error_1.ErrorCodes.INPUT_ERROR, 'No media found for zip'));
|
|
94
|
+
}
|
|
95
|
+
res.set('Content-Type', 'application/zip');
|
|
96
|
+
// sets filename* too, so non-ASCII names survive
|
|
97
|
+
res.attachment(GalleryMWs.zipName(query));
|
|
98
|
+
const archive = new archiver_1.ZipArchive({
|
|
99
|
+
store: true, // disable compression
|
|
100
|
+
});
|
|
101
|
+
res.on('close', () => {
|
|
102
|
+
console.log('zip ' + archive.pointer() + ' bytes');
|
|
103
|
+
});
|
|
104
|
+
archive.on('error', (err) => {
|
|
105
|
+
throw err;
|
|
106
|
+
});
|
|
107
|
+
archive.pipe(res);
|
|
108
|
+
// Track used filenames (case insensitive)
|
|
109
|
+
const usedNames = new Map();
|
|
110
|
+
// Add each media file to the archive with unique names
|
|
111
|
+
for (const media of searchResult.media) {
|
|
112
|
+
const mediaPath = path.join(ProjectPath_1.ProjectPath.ImageFolder, media.directory.path, media.directory.name, media.name);
|
|
113
|
+
// Get file extension and base name
|
|
114
|
+
const ext = path.extname(media.name);
|
|
115
|
+
const baseName = path.basename(media.name, ext);
|
|
116
|
+
const lowerName = media.name.toLowerCase();
|
|
117
|
+
// Check if this name was used before
|
|
118
|
+
let uniqueName = media.name;
|
|
119
|
+
const usedCount = usedNames.get(lowerName);
|
|
120
|
+
if (usedCount !== undefined) {
|
|
121
|
+
const count = usedCount + 1;
|
|
122
|
+
usedNames.set(lowerName, count);
|
|
123
|
+
uniqueName = baseName + '_' + count + ext;
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
usedNames.set(lowerName, 1);
|
|
127
|
+
}
|
|
128
|
+
archive.file(mediaPath, { name: uniqueName });
|
|
129
|
+
}
|
|
130
|
+
await archive.finalize();
|
|
131
|
+
return next();
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
return next(new Error_1.ErrorDTO(Error_1.ErrorCodes.GENERAL_ERROR, 'Error creating search results zip', err));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* The zip of a folder (the navbar's exact directory query) is named after the folder, other searches are SearchResults.zip.
|
|
139
|
+
*/
|
|
140
|
+
static zipName(query) {
|
|
141
|
+
const dirQuery = query;
|
|
142
|
+
if (query.type !== SearchQueryDTO_1.SearchQueryTypes.directory || dirQuery.matchType !== SearchQueryDTO_1.TextSearchQueryMatchTypes.exact_match || dirQuery.negate) {
|
|
143
|
+
return 'SearchResults.zip';
|
|
144
|
+
}
|
|
145
|
+
// './a/b', 'a/b' or '.' (the root)
|
|
146
|
+
const folder = dirQuery.value.split('/').filter(p => p !== '' && p !== '.').pop();
|
|
147
|
+
return (folder ?? Config_1.Config.Server.applicationTitle) + '.zip';
|
|
148
|
+
}
|
|
149
|
+
static cleanUpGalleryResults(req, res, next) {
|
|
150
|
+
if (!req.resultPipe) {
|
|
151
|
+
return next();
|
|
152
|
+
}
|
|
153
|
+
const cw = req.resultPipe;
|
|
154
|
+
if (cw.notModified === true) {
|
|
155
|
+
return next();
|
|
156
|
+
}
|
|
157
|
+
if (Config_1.Config.Media.Video.enabled === false) {
|
|
158
|
+
if (cw.directory) {
|
|
159
|
+
const removeVideos = (dir) => {
|
|
160
|
+
dir.media = dir.media.filter((m) => !MediaDTO_1.MediaDTOUtils.isVideo(m));
|
|
161
|
+
};
|
|
162
|
+
removeVideos(cw.directory);
|
|
163
|
+
}
|
|
164
|
+
if (cw.searchResult) {
|
|
165
|
+
cw.searchResult.media = cw.searchResult.media.filter((m) => !MediaDTO_1.MediaDTOUtils.isVideo(m));
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (Config_1.Config.Media.LivePhoto.enabled) {
|
|
169
|
+
const pairLivePhotos = (mediaList, parentDir) => {
|
|
170
|
+
// Build a map of (contentIdentifier + dirPath) → video for companion videos
|
|
171
|
+
const companionMap = new Map();
|
|
172
|
+
for (const m of mediaList) {
|
|
173
|
+
if (MediaDTO_1.MediaDTOUtils.isVideo(m) &&
|
|
174
|
+
m.metadata?.contentIdentifier) {
|
|
175
|
+
const dir = m.directory || parentDir;
|
|
176
|
+
const dirPath = path.join(dir?.path || '', dir?.name || '');
|
|
177
|
+
companionMap.set(m.metadata.contentIdentifier + '|' + dirPath, m);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
// Pair photos with their companion videos, remove paired videos from list
|
|
181
|
+
const pairedVideoKeys = new Set();
|
|
182
|
+
for (const m of mediaList) {
|
|
183
|
+
if (!MediaDTO_1.MediaDTOUtils.isVideo(m) &&
|
|
184
|
+
m.metadata?.contentIdentifier) {
|
|
185
|
+
const dir = m.directory || parentDir;
|
|
186
|
+
const dirPath = path.join(dir?.path || '', dir?.name || '');
|
|
187
|
+
const key = m.metadata.contentIdentifier + '|' + dirPath;
|
|
188
|
+
const companion = companionMap.get(key);
|
|
189
|
+
if (companion) {
|
|
190
|
+
const companionDir = companion.directory || parentDir;
|
|
191
|
+
m.liveVideoPath = path.join(companionDir?.path || '', companionDir?.name || '', companion.name);
|
|
192
|
+
const videoMeta = companion.metadata;
|
|
193
|
+
m.liveVideoInfo = {
|
|
194
|
+
name: companion.name,
|
|
195
|
+
size: videoMeta.size,
|
|
196
|
+
fileSize: videoMeta.fileSize,
|
|
197
|
+
duration: videoMeta.duration,
|
|
198
|
+
fps: videoMeta.fps,
|
|
199
|
+
bitRate: videoMeta.bitRate,
|
|
200
|
+
};
|
|
201
|
+
pairedVideoKeys.add(key);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return mediaList.filter((m) => {
|
|
206
|
+
if (!MediaDTO_1.MediaDTOUtils.isVideo(m) || !m.metadata?.contentIdentifier) {
|
|
207
|
+
return true;
|
|
208
|
+
}
|
|
209
|
+
const dir = m.directory || parentDir;
|
|
210
|
+
const dirPath = path.join(dir?.path || '', dir?.name || '');
|
|
211
|
+
return !pairedVideoKeys.has(m.metadata.contentIdentifier + '|' + dirPath);
|
|
212
|
+
});
|
|
213
|
+
};
|
|
214
|
+
if (cw.directory) {
|
|
215
|
+
cw.directory.media = pairLivePhotos(cw.directory.media, cw.directory);
|
|
216
|
+
}
|
|
217
|
+
if (cw.searchResult) {
|
|
218
|
+
cw.searchResult.media = pairLivePhotos(cw.searchResult.media);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
// Always strip contentIdentifier from responses — it's a server-side
|
|
222
|
+
// matching key, not needed by the client.
|
|
223
|
+
const stripContentId = (media) => {
|
|
224
|
+
for (const m of media) {
|
|
225
|
+
if (m.metadata?.contentIdentifier) {
|
|
226
|
+
delete m.metadata.contentIdentifier;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
if (cw.directory?.media) {
|
|
231
|
+
stripContentId(cw.directory.media);
|
|
232
|
+
}
|
|
233
|
+
if (cw.searchResult?.media) {
|
|
234
|
+
stripContentId(cw.searchResult.media);
|
|
235
|
+
}
|
|
236
|
+
req.resultPipe = ContentWrapper_1.ContentWrapperUtils.pack(cw);
|
|
237
|
+
return next();
|
|
238
|
+
}
|
|
239
|
+
static async loadFile(req, res, next) {
|
|
240
|
+
const mediaPath = RequestParams_1.RequestParams.get(req, 'mediaPath');
|
|
241
|
+
if (!mediaPath) {
|
|
242
|
+
return next();
|
|
243
|
+
}
|
|
244
|
+
const fullMediaPath = ProjectPath_1.ProjectPath.resolveInImageFolder(mediaPath);
|
|
245
|
+
// check if file exist
|
|
246
|
+
try {
|
|
247
|
+
if (!fullMediaPath) {
|
|
248
|
+
throw new Error('Path is outside of the image folder');
|
|
249
|
+
}
|
|
250
|
+
if ((await node_fs_1.promises.stat(fullMediaPath)).isDirectory()) {
|
|
251
|
+
return next();
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
catch {
|
|
255
|
+
return next(new Error_1.ErrorDTO(Error_1.ErrorCodes.PATH_ERROR, 'no such file:' + RequestParams_1.RequestParams.get(req, 'mediaPath'), 'can\'t find file: ' + fullMediaPath));
|
|
256
|
+
}
|
|
257
|
+
req.resultPipe = fullMediaPath;
|
|
258
|
+
return next();
|
|
259
|
+
}
|
|
260
|
+
static async loadBestFitVideo(req, res, next) {
|
|
261
|
+
try {
|
|
262
|
+
if (!req.resultPipe) {
|
|
263
|
+
return next();
|
|
264
|
+
}
|
|
265
|
+
const fullMediaPath = req.resultPipe;
|
|
266
|
+
const convertedVideo = VideoProcessing_1.VideoProcessing.generateConvertedFilePath(fullMediaPath);
|
|
267
|
+
// check if transcoded video exist
|
|
268
|
+
await node_fs_1.promises.access(convertedVideo);
|
|
269
|
+
req.resultPipe = convertedVideo;
|
|
270
|
+
// eslint-disable-next-line no-empty
|
|
271
|
+
}
|
|
272
|
+
catch {
|
|
273
|
+
}
|
|
274
|
+
return next();
|
|
275
|
+
}
|
|
276
|
+
static async search(req, res, next) {
|
|
277
|
+
try {
|
|
278
|
+
if (Config_1.Config.Search.enabled === false ||
|
|
279
|
+
!req.resultPipe) {
|
|
280
|
+
return next();
|
|
281
|
+
}
|
|
282
|
+
const query = req.resultPipe;
|
|
283
|
+
const result = await ObjectManagers_1.ObjectManagers.getInstance().SearchManager.search(RequestSession_1.RequestSession.getContext(req), query);
|
|
284
|
+
result.directories.forEach((dir) => (dir.media = dir.media || []));
|
|
285
|
+
req.resultPipe = ContentWrapper_1.ContentWrapperUtils.build(null, result);
|
|
286
|
+
return next();
|
|
287
|
+
}
|
|
288
|
+
catch (err) {
|
|
289
|
+
if (err instanceof LocationLookupException_1.LocationLookupException) {
|
|
290
|
+
return next(new Error_1.ErrorDTO(Error_1.ErrorCodes.LocationLookUp_ERROR, 'Cannot find location: ' + err.location, err));
|
|
291
|
+
}
|
|
292
|
+
return next(new Error_1.ErrorDTO(Error_1.ErrorCodes.GENERAL_ERROR, 'Error during searching', err));
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
static async autocomplete(req, res, next) {
|
|
296
|
+
try {
|
|
297
|
+
if (Config_1.Config.Search.AutoComplete.enabled === false) {
|
|
298
|
+
return next();
|
|
299
|
+
}
|
|
300
|
+
const value = RequestParams_1.RequestParams.get(req, 'value');
|
|
301
|
+
if (!value) {
|
|
302
|
+
return next();
|
|
303
|
+
}
|
|
304
|
+
let type = SearchQueryDTO_1.SearchQueryTypes.any_text;
|
|
305
|
+
if (req.query[QueryParams_1.QueryParams.gallery.search.type]) {
|
|
306
|
+
type = parseInt(req.query[QueryParams_1.QueryParams.gallery.search.type], 10);
|
|
307
|
+
}
|
|
308
|
+
req.resultPipe =
|
|
309
|
+
await ObjectManagers_1.ObjectManagers.getInstance().SearchManager.autocomplete(RequestSession_1.RequestSession.getContext(req), value, type);
|
|
310
|
+
return next();
|
|
311
|
+
}
|
|
312
|
+
catch (err) {
|
|
313
|
+
return next(new Error_1.ErrorDTO(Error_1.ErrorCodes.GENERAL_ERROR, 'Error during searching', err));
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
static async getRandomImage(req, res, next) {
|
|
317
|
+
try {
|
|
318
|
+
if (Config_1.Config.RandomPhoto.enabled === false ||
|
|
319
|
+
!req.resultPipe) {
|
|
320
|
+
return next();
|
|
321
|
+
}
|
|
322
|
+
const query = req.resultPipe;
|
|
323
|
+
const photos = await ObjectManagers_1.ObjectManagers.getInstance().SearchManager.getNMedia(RequestSession_1.RequestSession.getContext(req), query, [{ method: SortingMethods_1.SortByTypes.Random, ascending: null }], 1, true);
|
|
324
|
+
if (!photos || photos.length !== 1) {
|
|
325
|
+
// the link opens in a browser, a photo frame or an <img> (#1313): a plain text, not a JSON error
|
|
326
|
+
res.status(404).type('text/plain').send('No photos match this random link.');
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
req.params['mediaPath'] = path.join(photos[0].directory.path, photos[0].directory.name, photos[0].name);
|
|
330
|
+
return next();
|
|
331
|
+
}
|
|
332
|
+
catch (e) {
|
|
333
|
+
return next(new Error_1.ErrorDTO(Error_1.ErrorCodes.GENERAL_ERROR, 'Can\'t get random photo: ' + String(e)));
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
static async getMediaEntry(req, res, next) {
|
|
337
|
+
try {
|
|
338
|
+
const mediaPath = RequestParams_1.RequestParams.get(req, 'mediaPath');
|
|
339
|
+
if (!mediaPath) {
|
|
340
|
+
return next();
|
|
341
|
+
}
|
|
342
|
+
req.resultPipe = await ObjectManagers_1.ObjectManagers.getInstance().GalleryManager.getMedia(RequestSession_1.RequestSession.getContext(req), mediaPath);
|
|
343
|
+
return next();
|
|
344
|
+
}
|
|
345
|
+
catch (e) {
|
|
346
|
+
return next(new Error_1.ErrorDTO(Error_1.ErrorCodes.GENERAL_ERROR, 'Can\'t get random photo: ' + String(e)));
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
exports.GalleryMWs = GalleryMWs;
|
|
351
|
+
tslib_1.__decorate([
|
|
352
|
+
(0, ServerTimingMWs_1.ServerTime)('1.db', 'List Directory'),
|
|
353
|
+
tslib_1.__metadata("design:type", Function),
|
|
354
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object, Function]),
|
|
355
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
356
|
+
], GalleryMWs, "listDirectory", null);
|
|
357
|
+
tslib_1.__decorate([
|
|
358
|
+
(0, ServerTimingMWs_1.ServerTime)('1.zip', 'Zip Directory'),
|
|
359
|
+
tslib_1.__metadata("design:type", Function),
|
|
360
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object, Function]),
|
|
361
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
362
|
+
], GalleryMWs, "zipDirectory", null);
|
|
363
|
+
tslib_1.__decorate([
|
|
364
|
+
(0, ServerTimingMWs_1.ServerTime)('3.pack', 'pack result'),
|
|
365
|
+
tslib_1.__metadata("design:type", Function),
|
|
366
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object, Function]),
|
|
367
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
368
|
+
], GalleryMWs, "cleanUpGalleryResults", null);
|
|
369
|
+
tslib_1.__decorate([
|
|
370
|
+
(0, ServerTimingMWs_1.ServerTime)('1.db', 'Search'),
|
|
371
|
+
tslib_1.__metadata("design:type", Function),
|
|
372
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object, Function]),
|
|
373
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
374
|
+
], GalleryMWs, "search", null);
|
|
375
|
+
tslib_1.__decorate([
|
|
376
|
+
(0, ServerTimingMWs_1.ServerTime)('1.db', 'Autocomplete'),
|
|
377
|
+
tslib_1.__metadata("design:type", Function),
|
|
378
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object, Function]),
|
|
379
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
380
|
+
], GalleryMWs, "autocomplete", null);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MetaFileMWs = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const fs = tslib_1.__importStar(require("node:fs"));
|
|
6
|
+
const Config_1 = require("../../common/config/private/Config");
|
|
7
|
+
const GPXProcessing_1 = require("../model/fileaccess/fileprocessing/GPXProcessing");
|
|
8
|
+
const Logger_1 = require("../Logger");
|
|
9
|
+
const LOG_TAG = 'MetaFileMWs';
|
|
10
|
+
class MetaFileMWs {
|
|
11
|
+
static async compressGPX(req, res, next) {
|
|
12
|
+
if (!req.resultPipe) {
|
|
13
|
+
return next();
|
|
14
|
+
}
|
|
15
|
+
// if conversion is not enabled redirect, so browser can cache the full
|
|
16
|
+
if (Config_1.Config.MetaFile.GPXCompressing.enabled === false) {
|
|
17
|
+
return res.redirect(req.originalUrl.slice(0, -1 * '\\bestFit'.length));
|
|
18
|
+
}
|
|
19
|
+
const fullPath = req.resultPipe;
|
|
20
|
+
try {
|
|
21
|
+
const compressedGPX = GPXProcessing_1.GPXProcessing.generateConvertedPath(fullPath);
|
|
22
|
+
// check if converted photo exist
|
|
23
|
+
if (fs.existsSync(compressedGPX) === true) {
|
|
24
|
+
req.resultPipe = compressedGPX;
|
|
25
|
+
return next();
|
|
26
|
+
}
|
|
27
|
+
if (Config_1.Config.MetaFile.GPXCompressing.onTheFly === true) {
|
|
28
|
+
req.resultPipe = await GPXProcessing_1.GPXProcessing.compressGPX(fullPath);
|
|
29
|
+
return next();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
// Graceful degradation if compression fails
|
|
34
|
+
Logger_1.Logger.warn(LOG_TAG, 'Error during compressingGPX, using original file: ' + fullPath);
|
|
35
|
+
return res.redirect(req.originalUrl.slice(0, -1 * '\\bestFit'.length));
|
|
36
|
+
}
|
|
37
|
+
// not converted and won't be now
|
|
38
|
+
return res.redirect(req.originalUrl.slice(0, -1 * '\\bestFit'.length));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.MetaFileMWs = MetaFileMWs;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotificationMWs = void 0;
|
|
4
|
+
const UserDTO_1 = require("../../common/entities/UserDTO");
|
|
5
|
+
const NotifocationManager_1 = require("../model/NotifocationManager");
|
|
6
|
+
class NotificationMWs {
|
|
7
|
+
static list(req, res, next) {
|
|
8
|
+
const role = req.session.context?.user.role;
|
|
9
|
+
if (role !== undefined && role >= UserDTO_1.UserRoles.Admin) {
|
|
10
|
+
req.resultPipe = NotifocationManager_1.NotificationManager.notifications;
|
|
11
|
+
}
|
|
12
|
+
else if (NotifocationManager_1.NotificationManager.notifications.length > 0) {
|
|
13
|
+
req.resultPipe = NotifocationManager_1.NotificationManager.HasNotification;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
req.resultPipe = [];
|
|
17
|
+
}
|
|
18
|
+
return next();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.NotificationMWs = NotificationMWs;
|
|
@@ -3,5 +3,5 @@ export declare class PersonMWs {
|
|
|
3
3
|
static updatePerson(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
4
4
|
static getPerson(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
5
5
|
static listPersons(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
6
|
-
static cleanUpPersonResults(req: Request, res: Response, next: NextFunction):
|
|
6
|
+
static cleanUpPersonResults(req: Request, res: Response, next: NextFunction): void;
|
|
7
7
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PersonMWs = void 0;
|
|
4
|
+
const Error_1 = require("../../common/entities/Error");
|
|
5
|
+
const ObjectManagers_1 = require("../model/ObjectManagers");
|
|
6
|
+
const Utils_1 = require("../../common/Utils");
|
|
7
|
+
const RequestParams_1 = require("./RequestParams");
|
|
8
|
+
const RequestSession_1 = require("./RequestSession");
|
|
9
|
+
class PersonMWs {
|
|
10
|
+
static async updatePerson(req, res, next) {
|
|
11
|
+
const name = RequestParams_1.RequestParams.get(req, 'name');
|
|
12
|
+
if (!name) {
|
|
13
|
+
return next();
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
await ObjectManagers_1.ObjectManagers.getInstance().PersonManager.updatePerson(name, (req.body ?? {}));
|
|
17
|
+
req.resultPipe = await ObjectManagers_1.ObjectManagers.getInstance().PersonManager.get(RequestSession_1.RequestSession.getContext(req), name);
|
|
18
|
+
return next();
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
return next(new Error_1.ErrorDTO(Error_1.ErrorCodes.PERSON_ERROR, 'Error during updating a person', err));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
static async getPerson(req, res, next) {
|
|
25
|
+
const name = RequestParams_1.RequestParams.get(req, 'name');
|
|
26
|
+
if (!name) {
|
|
27
|
+
return next();
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
req.resultPipe = await ObjectManagers_1.ObjectManagers.getInstance().PersonManager.get(RequestSession_1.RequestSession.getContext(req), name);
|
|
31
|
+
return next();
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
return next(new Error_1.ErrorDTO(Error_1.ErrorCodes.PERSON_ERROR, 'Error during updating a person', err));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
static async listPersons(req, res, next) {
|
|
38
|
+
try {
|
|
39
|
+
req.resultPipe =
|
|
40
|
+
await ObjectManagers_1.ObjectManagers.getInstance().PersonManager.getAll(RequestSession_1.RequestSession.getContext(req));
|
|
41
|
+
return next();
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
return next(new Error_1.ErrorDTO(Error_1.ErrorCodes.PERSON_ERROR, 'Error during listing persons', err));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
static cleanUpPersonResults(req, res, next) {
|
|
48
|
+
if (!req.resultPipe) {
|
|
49
|
+
return next();
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
const persons = Utils_1.Utils.clone(req.resultPipe);
|
|
53
|
+
for (const item of persons) {
|
|
54
|
+
delete item.cache.sampleRegion;
|
|
55
|
+
}
|
|
56
|
+
req.resultPipe = persons;
|
|
57
|
+
return next();
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
return next(new Error_1.ErrorDTO(Error_1.ErrorCodes.PERSON_ERROR, 'Error during removing sample photo from all persons', err));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.PersonMWs = PersonMWs;
|
|
@@ -4,9 +4,33 @@ export declare class RenderingMWs {
|
|
|
4
4
|
static renderSessionUser(req: Request, res: Response, next: NextFunction): void;
|
|
5
5
|
static renderSharing(req: Request, res: Response, next: NextFunction): void;
|
|
6
6
|
static renderSharingList(req: Request, res: Response, next: NextFunction): void;
|
|
7
|
+
/**
|
|
8
|
+
* For media that rarely changes under the same URL (photos, thumbnails, previews).
|
|
9
|
+
* Cached for a day only: a photo can be replaced in the folder, a thumbnail regenerated with other settings.
|
|
10
|
+
* private: these are behind authentication, so shared caches (proxies, CDNs) must not store them.
|
|
11
|
+
*/
|
|
7
12
|
static renderFile(req: Request, res: Response, next: NextFunction): void;
|
|
13
|
+
/**
|
|
14
|
+
* For files that can change under the same URL (e.g. bestFit switches to the transcoded video once it is ready).
|
|
15
|
+
* The browser revalidates them with the ETag.
|
|
16
|
+
*/
|
|
17
|
+
static renderFileNoCache(req: Request, res: Response, next: NextFunction): void;
|
|
18
|
+
/**
|
|
19
|
+
* For responses that differ on every request (e.g. random photo).
|
|
20
|
+
*/
|
|
21
|
+
static renderFileNoStore(req: Request, res: Response, next: NextFunction): void;
|
|
22
|
+
private static sendFile;
|
|
8
23
|
static renderOK(req: Request, res: Response): void;
|
|
9
24
|
static renderConfig(req: Request, res: Response): Promise<void>;
|
|
25
|
+
static notFound(req: Request, res: Response, next: NextFunction): void;
|
|
10
26
|
static renderError(err: Error, req: Request, res: Response, next: NextFunction): void;
|
|
27
|
+
/**
|
|
28
|
+
* An http-errors error of the client (status 4xx), raised by express or its middlewares.
|
|
29
|
+
*/
|
|
30
|
+
static isClientHttpError(err: unknown): err is Error & {
|
|
31
|
+
status: number;
|
|
32
|
+
headers?: Record<string, string>;
|
|
33
|
+
};
|
|
34
|
+
private static httpStatus;
|
|
11
35
|
protected static renderMessage<T>(res: Response, content: T): void;
|
|
12
36
|
}
|