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,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserMWs = 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 Config_1 = require("../../../common/config/private/Config");
|
|
8
|
+
const RequestParams_1 = require("../RequestParams");
|
|
9
|
+
class UserMWs {
|
|
10
|
+
static async createUser(req, res, next) {
|
|
11
|
+
if (Config_1.Config.Users.authenticationRequired === false) {
|
|
12
|
+
return next(new Error_1.ErrorDTO(Error_1.ErrorCodes.USER_MANAGEMENT_DISABLED));
|
|
13
|
+
}
|
|
14
|
+
const body = req.body;
|
|
15
|
+
if (typeof body === 'undefined' ||
|
|
16
|
+
typeof body.newUser === 'undefined') {
|
|
17
|
+
return next();
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
await ObjectManagers_1.ObjectManagers.getInstance().UserManager.createUser(body.newUser);
|
|
21
|
+
return next();
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
return next(new Error_1.ErrorDTO(Error_1.ErrorCodes.USER_CREATION_ERROR, null, err));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
static async deleteUser(req, res, next) {
|
|
28
|
+
if (Config_1.Config.Users.authenticationRequired === false) {
|
|
29
|
+
return next(new Error_1.ErrorDTO(Error_1.ErrorCodes.USER_MANAGEMENT_DISABLED));
|
|
30
|
+
}
|
|
31
|
+
if (typeof req.params === 'undefined' ||
|
|
32
|
+
typeof RequestParams_1.RequestParams.get(req, 'id') === 'undefined') {
|
|
33
|
+
return next();
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
// the sessions of the deleted user end on their next request (see AuthenticationMWs.authenticate)
|
|
37
|
+
await ObjectManagers_1.ObjectManagers.getInstance().UserManager.deleteUser(parseInt(RequestParams_1.RequestParams.getRequired(req, 'id'), 10));
|
|
38
|
+
return next();
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
return next(new Error_1.ErrorDTO(Error_1.ErrorCodes.GENERAL_ERROR, null, err));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
static async changeRole(req, res, next) {
|
|
45
|
+
if (Config_1.Config.Users.authenticationRequired === false) {
|
|
46
|
+
return next(new Error_1.ErrorDTO(Error_1.ErrorCodes.USER_MANAGEMENT_DISABLED));
|
|
47
|
+
}
|
|
48
|
+
const body = req.body;
|
|
49
|
+
if (typeof req.params === 'undefined' ||
|
|
50
|
+
typeof RequestParams_1.RequestParams.get(req, 'id') === 'undefined' ||
|
|
51
|
+
typeof body === 'undefined' ||
|
|
52
|
+
typeof body.newRole === 'undefined') {
|
|
53
|
+
return next();
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
await ObjectManagers_1.ObjectManagers.getInstance().UserManager.changeRole(parseInt(RequestParams_1.RequestParams.getRequired(req, 'id'), 10), body.newRole);
|
|
57
|
+
return next();
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
return next(new Error_1.ErrorDTO(Error_1.ErrorCodes.GENERAL_ERROR, null, err));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
static async updateSettings(req, res, next) {
|
|
64
|
+
if (Config_1.Config.Users.authenticationRequired === false) {
|
|
65
|
+
return next(new Error_1.ErrorDTO(Error_1.ErrorCodes.USER_MANAGEMENT_DISABLED));
|
|
66
|
+
}
|
|
67
|
+
const body = req.body;
|
|
68
|
+
if (typeof req.params === 'undefined' ||
|
|
69
|
+
typeof RequestParams_1.RequestParams.get(req, 'id') === 'undefined' ||
|
|
70
|
+
typeof body === 'undefined' ||
|
|
71
|
+
typeof body.settings === 'undefined') {
|
|
72
|
+
return next();
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
const updatedUser = await ObjectManagers_1.ObjectManagers.getInstance().UserManager.updateSettings(parseInt(RequestParams_1.RequestParams.getRequired(req, 'id'), 10), body.settings);
|
|
76
|
+
if (req.session?.context?.user?.id === updatedUser.id) {
|
|
77
|
+
//clean up after a change
|
|
78
|
+
await ObjectManagers_1.ObjectManagers.getInstance().ProjectedCacheManager.cleanupNonExistingProjections();
|
|
79
|
+
}
|
|
80
|
+
return next();
|
|
81
|
+
}
|
|
82
|
+
catch (err) {
|
|
83
|
+
return next(new Error_1.ErrorDTO(Error_1.ErrorCodes.GENERAL_ERROR, 'Can\'t update user settings', err));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
static async unlinkOidc(req, res, next) {
|
|
87
|
+
if (Config_1.Config.Users.authenticationRequired === false) {
|
|
88
|
+
return next(new Error_1.ErrorDTO(Error_1.ErrorCodes.USER_MANAGEMENT_DISABLED));
|
|
89
|
+
}
|
|
90
|
+
if (typeof req.params === 'undefined' ||
|
|
91
|
+
typeof RequestParams_1.RequestParams.get(req, 'id') === 'undefined') {
|
|
92
|
+
return next();
|
|
93
|
+
}
|
|
94
|
+
try {
|
|
95
|
+
await ObjectManagers_1.ObjectManagers.getInstance().UserManager.setOidcSubject(parseInt(RequestParams_1.RequestParams.getRequired(req, 'id'), 10), null);
|
|
96
|
+
return next();
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
return next(new Error_1.ErrorDTO(Error_1.ErrorCodes.GENERAL_ERROR, null, err));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
static async listUsers(req, res, next) {
|
|
103
|
+
if (Config_1.Config.Users.authenticationRequired === false) {
|
|
104
|
+
return next(new Error_1.ErrorDTO(Error_1.ErrorCodes.USER_MANAGEMENT_DISABLED));
|
|
105
|
+
}
|
|
106
|
+
try {
|
|
107
|
+
let result = await ObjectManagers_1.ObjectManagers.getInstance().UserManager.find({});
|
|
108
|
+
result = Utils_1.Utils.clone(result);
|
|
109
|
+
for (const item of result) {
|
|
110
|
+
item.password = '';
|
|
111
|
+
}
|
|
112
|
+
req.resultPipe = result;
|
|
113
|
+
next();
|
|
114
|
+
}
|
|
115
|
+
catch (err) {
|
|
116
|
+
return next(new Error_1.ErrorDTO(Error_1.ErrorCodes.GENERAL_ERROR, null, err));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.UserMWs = UserMWs;
|
|
@@ -2,5 +2,4 @@ import { NextFunction, Request, Response } from 'express';
|
|
|
2
2
|
export declare class UserRequestConstrainsMWs {
|
|
3
3
|
static forceSelfRequest(req: Request, res: Response, next: NextFunction): void;
|
|
4
4
|
static notSelfRequest(req: Request, res: Response, next: NextFunction): void;
|
|
5
|
-
static notSelfRequestOr2Admins(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
6
5
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserRequestConstrainsMWs = void 0;
|
|
4
|
+
const Error_1 = require("../../../common/entities/Error");
|
|
5
|
+
const RequestParams_1 = require("../RequestParams");
|
|
6
|
+
const RequestSession_1 = require("../RequestSession");
|
|
7
|
+
class UserRequestConstrainsMWs {
|
|
8
|
+
static forceSelfRequest(req, res, next) {
|
|
9
|
+
if (typeof req.params === 'undefined' ||
|
|
10
|
+
typeof RequestParams_1.RequestParams.get(req, 'id') === 'undefined') {
|
|
11
|
+
return next();
|
|
12
|
+
}
|
|
13
|
+
if (RequestSession_1.RequestSession.getContext(req).user.id !== parseInt(RequestParams_1.RequestParams.getRequired(req, 'id'), 10)) {
|
|
14
|
+
return next(new Error_1.ErrorDTO(Error_1.ErrorCodes.NOT_AUTHORISED));
|
|
15
|
+
}
|
|
16
|
+
return next();
|
|
17
|
+
}
|
|
18
|
+
static notSelfRequest(req, res, next) {
|
|
19
|
+
if (typeof req.params === 'undefined' ||
|
|
20
|
+
typeof RequestParams_1.RequestParams.get(req, 'id') === 'undefined') {
|
|
21
|
+
return next();
|
|
22
|
+
}
|
|
23
|
+
if (RequestSession_1.RequestSession.getContext(req).user.id === parseInt(RequestParams_1.RequestParams.getRequired(req, 'id'), 10)) {
|
|
24
|
+
return next(new Error_1.ErrorDTO(Error_1.ErrorCodes.NOT_AUTHORISED));
|
|
25
|
+
}
|
|
26
|
+
return next();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.UserRequestConstrainsMWs = UserRequestConstrainsMWs;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Brackets, WhereExpressionBuilder } from 'typeorm';
|
|
2
|
+
import type { SessionContext } from './SessionContext';
|
|
3
|
+
import { DirectoryCacheDTO, SubDirectoryDTO } from '../../common/entities/DirectoryDTO';
|
|
4
|
+
import { DirectorySearch } from '../../common/entities/SearchQueryDTO';
|
|
5
|
+
export declare enum DirectoryAccessTypes {
|
|
6
|
+
none = 0,// not available, behaves as if it would not exist
|
|
7
|
+
parent = 1,// can be opened to navigate to available directories, but its own content is hidden
|
|
8
|
+
available = 2
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Directory filter prebuilt for the two directory aliases used in the queries
|
|
12
|
+
*/
|
|
13
|
+
export interface DirectoryFilter {
|
|
14
|
+
directory: Brackets;
|
|
15
|
+
directories: Brackets;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Decides which directories a session can open, based on the directory allow and block lists.
|
|
19
|
+
* It lives in SessionContext.directoryAccess.
|
|
20
|
+
* - A blocked directory is never available.
|
|
21
|
+
* - A directory matching all allow lists is available.
|
|
22
|
+
* - Users can open the parents of the available directories (their content is hidden).
|
|
23
|
+
* These parents are found from the path for anchored searches (exact path, 'path/*'), otherwise from the DB.
|
|
24
|
+
* - Sharing users can't open parents.
|
|
25
|
+
* - Sharing without directory query: only directories with visible photos are available,
|
|
26
|
+
* directories with visible photos below them are parents.
|
|
27
|
+
*/
|
|
28
|
+
export declare class DirectoryAccess {
|
|
29
|
+
allowLists?: DirectorySearch[][];
|
|
30
|
+
blockList?: DirectorySearch[];
|
|
31
|
+
byPhotos?: boolean;
|
|
32
|
+
allowQuery?: DirectoryFilter;
|
|
33
|
+
notBlockedQuery?: DirectoryFilter;
|
|
34
|
+
private readonly context;
|
|
35
|
+
constructor(context: SessionContext, init?: Partial<Pick<DirectoryAccess, 'allowLists' | 'blockList' | 'byPhotos' | 'allowQuery' | 'notBlockedQuery'>>);
|
|
36
|
+
get isSharing(): boolean;
|
|
37
|
+
isBlocked(dirPath: string): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* True if the directory matches all allow lists (does not check the block list)
|
|
40
|
+
*/
|
|
41
|
+
isAllowed(dirPath: string): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Media and metafiles of a directory are only shown if it is available.
|
|
44
|
+
*/
|
|
45
|
+
isAvailable(dirPath: string): Promise<boolean>;
|
|
46
|
+
getAccess(dirPath: string): Promise<DirectoryAccessTypes>;
|
|
47
|
+
/**
|
|
48
|
+
* Which parents (root is the first) the session can open.
|
|
49
|
+
* The directory itself is accessible, so all its parents lead to an available directory.
|
|
50
|
+
*/
|
|
51
|
+
getAvailableParents(dirPath: string): boolean[];
|
|
52
|
+
/**
|
|
53
|
+
* Directories in search results and autocomplete need to be available (not just parents)
|
|
54
|
+
*/
|
|
55
|
+
isListedInSearch(cache: DirectoryCacheDTO | undefined): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Applies the directory allow/block list on a directory query.
|
|
58
|
+
* Parents are not added, those need to be filtered by the caller (see isListedInSearch).
|
|
59
|
+
*/
|
|
60
|
+
filterDirectoryQuery(qb: WhereExpressionBuilder, alias: keyof DirectoryFilter): void;
|
|
61
|
+
/**
|
|
62
|
+
* Filters the subdirectories of a listed directory. The caches of the subdirectories need to be filled.
|
|
63
|
+
*/
|
|
64
|
+
filterSubDirectories<T extends SubDirectoryDTO>(parent: {
|
|
65
|
+
path: string;
|
|
66
|
+
name: string;
|
|
67
|
+
}, subDirs: T[]): Promise<T[]>;
|
|
68
|
+
private isAnchoredParent;
|
|
69
|
+
/**
|
|
70
|
+
* Parents of like, negated and non-trailing glob searches can only be found from the DB
|
|
71
|
+
*/
|
|
72
|
+
private needsDBForParents;
|
|
73
|
+
private getAccessByPhotos;
|
|
74
|
+
/**
|
|
75
|
+
* Returns the available (allowed and not blocked) directories below the given directory
|
|
76
|
+
*/
|
|
77
|
+
private getAvailableDirectoriesBelow;
|
|
78
|
+
}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DirectoryAccess = exports.DirectoryAccessTypes = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const path = tslib_1.__importStar(require("node:path"));
|
|
6
|
+
const SearchQueryUtils_1 = require("../../common/SearchQueryUtils");
|
|
7
|
+
const SQLConnection_1 = require("./database/SQLConnection");
|
|
8
|
+
const DirectoryEntity_1 = require("./database/enitites/DirectoryEntity");
|
|
9
|
+
const ObjectManagers_1 = require("./ObjectManagers");
|
|
10
|
+
const GalleryManager_1 = require("./database/GalleryManager");
|
|
11
|
+
const EntityUtils_1 = require("./database/enitites/EntityUtils");
|
|
12
|
+
const DiskManager_1 = require("./fileaccess/DiskManager");
|
|
13
|
+
const Config_1 = require("../../common/config/private/Config");
|
|
14
|
+
const PrivateConfig_1 = require("../../common/config/private/PrivateConfig");
|
|
15
|
+
var DirectoryAccessTypes;
|
|
16
|
+
(function (DirectoryAccessTypes) {
|
|
17
|
+
DirectoryAccessTypes[DirectoryAccessTypes["none"] = 0] = "none";
|
|
18
|
+
DirectoryAccessTypes[DirectoryAccessTypes["parent"] = 1] = "parent";
|
|
19
|
+
DirectoryAccessTypes[DirectoryAccessTypes["available"] = 2] = "available"; // content (media and metafiles) is available
|
|
20
|
+
})(DirectoryAccessTypes || (exports.DirectoryAccessTypes = DirectoryAccessTypes = {}));
|
|
21
|
+
/**
|
|
22
|
+
* Decides which directories a session can open, based on the directory allow and block lists.
|
|
23
|
+
* It lives in SessionContext.directoryAccess.
|
|
24
|
+
* - A blocked directory is never available.
|
|
25
|
+
* - A directory matching all allow lists is available.
|
|
26
|
+
* - Users can open the parents of the available directories (their content is hidden).
|
|
27
|
+
* These parents are found from the path for anchored searches (exact path, 'path/*'), otherwise from the DB.
|
|
28
|
+
* - Sharing users can't open parents.
|
|
29
|
+
* - Sharing without directory query: only directories with visible photos are available,
|
|
30
|
+
* directories with visible photos below them are parents.
|
|
31
|
+
*/
|
|
32
|
+
class DirectoryAccess {
|
|
33
|
+
constructor(context, init = {}) {
|
|
34
|
+
Object.defineProperty(this, 'context', { value: context, enumerable: false });
|
|
35
|
+
Object.assign(this, init);
|
|
36
|
+
}
|
|
37
|
+
get isSharing() {
|
|
38
|
+
return !!this.context?.user?.usedSharingKey;
|
|
39
|
+
}
|
|
40
|
+
// The lists are also applied in SQL (allowQuery, notBlockedQuery): the checks here ignore the accents the same way
|
|
41
|
+
isBlocked(dirPath) {
|
|
42
|
+
return !!this.blockList && SearchQueryUtils_1.SearchQueryUtils.matchDirectoryList(dirPath, this.blockList, (0, EntityUtils_1.sqlIgnoresAccents)());
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* True if the directory matches all allow lists (does not check the block list)
|
|
46
|
+
*/
|
|
47
|
+
isAllowed(dirPath) {
|
|
48
|
+
return (this.allowLists || []).every(list => SearchQueryUtils_1.SearchQueryUtils.matchDirectoryList(dirPath, list, (0, EntityUtils_1.sqlIgnoresAccents)()));
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Media and metafiles of a directory are only shown if it is available.
|
|
52
|
+
*/
|
|
53
|
+
async isAvailable(dirPath) {
|
|
54
|
+
return (await this.getAccess(dirPath)) === DirectoryAccessTypes.available;
|
|
55
|
+
}
|
|
56
|
+
async getAccess(dirPath) {
|
|
57
|
+
if (this.isBlocked(dirPath)) {
|
|
58
|
+
return DirectoryAccessTypes.none;
|
|
59
|
+
}
|
|
60
|
+
if (this.byPhotos) {
|
|
61
|
+
return this.getAccessByPhotos(dirPath);
|
|
62
|
+
}
|
|
63
|
+
if (this.isAllowed(dirPath)) {
|
|
64
|
+
return DirectoryAccessTypes.available;
|
|
65
|
+
}
|
|
66
|
+
if (this.isSharing) {
|
|
67
|
+
return DirectoryAccessTypes.none;
|
|
68
|
+
}
|
|
69
|
+
if (this.isAnchoredParent(dirPath)) {
|
|
70
|
+
return DirectoryAccessTypes.parent;
|
|
71
|
+
}
|
|
72
|
+
if (this.needsDBForParents() && (await this.getAvailableDirectoriesBelow(dirPath, true)).length > 0) {
|
|
73
|
+
return DirectoryAccessTypes.parent;
|
|
74
|
+
}
|
|
75
|
+
return DirectoryAccessTypes.none;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Which parents (root is the first) the session can open.
|
|
79
|
+
* The directory itself is accessible, so all its parents lead to an available directory.
|
|
80
|
+
*/
|
|
81
|
+
getAvailableParents(dirPath) {
|
|
82
|
+
const segments = SearchQueryUtils_1.SearchQueryUtils.normalizeDirectoryPath(dirPath).split('/').filter(s => s !== '');
|
|
83
|
+
const strict = this.isSharing && !this.byPhotos;
|
|
84
|
+
// segments.length parents: root, segments[0], segments[0]/segments[1], ...
|
|
85
|
+
return segments.map((_, i) => {
|
|
86
|
+
const parent = segments.slice(0, i).join('/');
|
|
87
|
+
return !this.isBlocked(parent) && (!strict || this.isAllowed(parent));
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Directories in search results and autocomplete need to be available (not just parents)
|
|
92
|
+
*/
|
|
93
|
+
isListedInSearch(cache) {
|
|
94
|
+
if (this.byPhotos) {
|
|
95
|
+
return (cache?.mediaCount ?? 0) > 0;
|
|
96
|
+
}
|
|
97
|
+
return (cache?.recursiveMediaCount ?? 0) > 0;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Applies the directory allow/block list on a directory query.
|
|
101
|
+
* Parents are not added, those need to be filtered by the caller (see isListedInSearch).
|
|
102
|
+
*/
|
|
103
|
+
filterDirectoryQuery(qb, alias) {
|
|
104
|
+
if (this.notBlockedQuery) {
|
|
105
|
+
qb.andWhere(this.notBlockedQuery[alias]);
|
|
106
|
+
}
|
|
107
|
+
if (this.allowQuery) {
|
|
108
|
+
qb.andWhere(this.allowQuery[alias]);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Filters the subdirectories of a listed directory. The caches of the subdirectories need to be filled.
|
|
113
|
+
*/
|
|
114
|
+
async filterSubDirectories(parent, subDirs) {
|
|
115
|
+
if (!subDirs || subDirs.length === 0) {
|
|
116
|
+
return subDirs;
|
|
117
|
+
}
|
|
118
|
+
if (!this.blockList && !this.allowLists && !this.byPhotos) {
|
|
119
|
+
return subDirs;
|
|
120
|
+
}
|
|
121
|
+
const relPath = (d) => SearchQueryUtils_1.SearchQueryUtils.normalizeDirectoryPath(path.join(d.path, d.name));
|
|
122
|
+
if (this.byPhotos) {
|
|
123
|
+
return subDirs.filter(d => !this.isBlocked(relPath(d)) && (d.cache?.recursiveMediaCount ?? 0) > 0);
|
|
124
|
+
}
|
|
125
|
+
// first path segments (below the listed directory) of the available directories, only loaded if needed
|
|
126
|
+
let availableBelow = null;
|
|
127
|
+
const parentRelPath = relPath(parent);
|
|
128
|
+
const getAvailableBelow = async () => {
|
|
129
|
+
if (availableBelow === null) {
|
|
130
|
+
const prefixLength = parentRelPath === '' ? 0 : parentRelPath.length + 1;
|
|
131
|
+
availableBelow = new Set((await this.getAvailableDirectoriesBelow(parentRelPath, false))
|
|
132
|
+
.map(d => relPath(d).substring(prefixLength).split('/')[0].toLowerCase()));
|
|
133
|
+
}
|
|
134
|
+
return availableBelow;
|
|
135
|
+
};
|
|
136
|
+
const ret = [];
|
|
137
|
+
for (const d of subDirs) {
|
|
138
|
+
const p = relPath(d);
|
|
139
|
+
if (this.isBlocked(p)) {
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
if (this.isAllowed(p)) {
|
|
143
|
+
ret.push(d);
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
if (this.isSharing) {
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
if (this.isAnchoredParent(p) ||
|
|
150
|
+
(this.needsDBForParents() && (await getAvailableBelow()).has(d.name.toLowerCase()))) {
|
|
151
|
+
ret.push(d);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return ret;
|
|
155
|
+
}
|
|
156
|
+
isAnchoredParent(dirPath) {
|
|
157
|
+
// users only have one allow list
|
|
158
|
+
const list = this.allowLists?.[0];
|
|
159
|
+
return !!list && SearchQueryUtils_1.SearchQueryUtils.isDirectoryAnchoredParent(dirPath, list, (0, EntityUtils_1.sqlIgnoresAccents)());
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Parents of like, negated and non-trailing glob searches can only be found from the DB
|
|
163
|
+
*/
|
|
164
|
+
needsDBForParents() {
|
|
165
|
+
const list = this.allowLists?.[0];
|
|
166
|
+
return !!list && list.some(d => !SearchQueryUtils_1.SearchQueryUtils.isDirectorySearchAnchored(d));
|
|
167
|
+
}
|
|
168
|
+
async getAccessByPhotos(dirPath) {
|
|
169
|
+
const p = GalleryManager_1.GalleryManager.parseRelativeDirPath(dirPath);
|
|
170
|
+
const connection = await SQLConnection_1.SQLConnection.getConnection();
|
|
171
|
+
const dir = await connection
|
|
172
|
+
.getRepository(DirectoryEntity_1.DirectoryEntity)
|
|
173
|
+
.createQueryBuilder('directory')
|
|
174
|
+
.where('directory.name = :name AND directory.path = :path', { name: p.name, path: p.parent })
|
|
175
|
+
.leftJoinAndSelect('directory.cache', 'cache', 'cache.projectionKey = :pk AND cache.valid = 1', { pk: this.context.user.projectionKey })
|
|
176
|
+
.select(['directory.id', 'directory.name', 'directory.path', 'cache'])
|
|
177
|
+
.getOne();
|
|
178
|
+
if (!dir) {
|
|
179
|
+
return DirectoryAccessTypes.none;
|
|
180
|
+
}
|
|
181
|
+
if (!dir.cache?.valid) {
|
|
182
|
+
dir.cache = await ObjectManagers_1.ObjectManagers.getInstance().ProjectedCacheManager.setAndGetCacheForDirectory(connection, this.context, dir);
|
|
183
|
+
}
|
|
184
|
+
if (dir.cache.mediaCount > 0) {
|
|
185
|
+
return DirectoryAccessTypes.available;
|
|
186
|
+
}
|
|
187
|
+
if ((dir.cache.recursiveMediaCount ?? 0) > 0) {
|
|
188
|
+
return DirectoryAccessTypes.parent;
|
|
189
|
+
}
|
|
190
|
+
return DirectoryAccessTypes.none;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Returns the available (allowed and not blocked) directories below the given directory
|
|
194
|
+
*/
|
|
195
|
+
async getAvailableDirectoriesBelow(dirPath, onlyOne) {
|
|
196
|
+
const connection = await SQLConnection_1.SQLConnection.getConnection();
|
|
197
|
+
const qb = connection
|
|
198
|
+
.getRepository(DirectoryEntity_1.DirectoryEntity)
|
|
199
|
+
.createQueryBuilder('directory')
|
|
200
|
+
.select(['directory.path', 'directory.name']);
|
|
201
|
+
const p = GalleryManager_1.GalleryManager.parseRelativeDirPath(dirPath);
|
|
202
|
+
const root = GalleryManager_1.GalleryManager.parseRelativeDirPath('.');
|
|
203
|
+
if (p.name === root.name && p.parent === root.parent) {
|
|
204
|
+
qb.where('NOT (directory.name = :rootName AND directory.path = :rootPath)', { rootName: root.name, rootPath: root.parent });
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
const childrenPath = DiskManager_1.DiskManager.pathFromParent({ path: p.parent, name: p.name });
|
|
208
|
+
if (Config_1.Config.Database.type === PrivateConfig_1.DatabaseType.mysql) {
|
|
209
|
+
qb.where('directory.path LIKE :childrenPath', { childrenPath: childrenPath.replace(/[\\%_]/g, '\\$&') + '%' });
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
qb.where('directory.path GLOB :childrenPath', { childrenPath: childrenPath.replace(/[[*?]/g, '[$&]') + '*' });
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
this.filterDirectoryQuery(qb, 'directory');
|
|
216
|
+
if (onlyOne) {
|
|
217
|
+
qb.limit(1);
|
|
218
|
+
}
|
|
219
|
+
return await qb.getMany();
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
exports.DirectoryAccess = DirectoryAccess;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EventLoopHandler = void 0;
|
|
4
|
+
class EventLoopHandler {
|
|
5
|
+
constructor(MAX_LOOP = 10) {
|
|
6
|
+
this.MAX_LOOP = MAX_LOOP;
|
|
7
|
+
this.eventCounter = 0;
|
|
8
|
+
}
|
|
9
|
+
/*
|
|
10
|
+
* setImmediate is slow, but does the right thing
|
|
11
|
+
* next tick is super fast, but does not help much with the event loop as it does not allow a full event loop cycle
|
|
12
|
+
* https://medium.com/dkatalis/eventloop-in-nodejs-settimeout-setimmediate-vs-process-nexttick-37c852c67acb
|
|
13
|
+
* */
|
|
14
|
+
step(fn) {
|
|
15
|
+
this.eventCounter = this.eventCounter % 10;
|
|
16
|
+
if (this.eventCounter++ === 1) {
|
|
17
|
+
setImmediate(fn);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
process.nextTick(fn);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.EventLoopHandler = EventLoopHandler;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The part of `ffprobe -print_format json -show_format -show_streams` that the app reads.
|
|
3
|
+
* ffprobe prints most numbers as strings.
|
|
4
|
+
*/
|
|
5
|
+
export interface FfprobeStream {
|
|
6
|
+
codec_type?: string;
|
|
7
|
+
width?: number;
|
|
8
|
+
height?: number;
|
|
9
|
+
duration?: string;
|
|
10
|
+
bit_rate?: string;
|
|
11
|
+
avg_frame_rate?: string;
|
|
12
|
+
side_data_list?: {
|
|
13
|
+
side_data_type?: string;
|
|
14
|
+
rotation?: number;
|
|
15
|
+
}[];
|
|
16
|
+
tags?: Record<string, string>;
|
|
17
|
+
}
|
|
18
|
+
export interface FfprobeFormat {
|
|
19
|
+
duration?: string;
|
|
20
|
+
bit_rate?: string;
|
|
21
|
+
tags?: Record<string, string>;
|
|
22
|
+
}
|
|
23
|
+
export interface FfprobeData {
|
|
24
|
+
streams: FfprobeStream[];
|
|
25
|
+
format: FfprobeFormat;
|
|
26
|
+
}
|
|
27
|
+
export interface FFmpegRunOptions {
|
|
28
|
+
/** Called with every line ffmpeg writes to stderr (ffmpeg writes all its output there). */
|
|
29
|
+
onStderrLine?: (line: string) => void;
|
|
30
|
+
/** Called with the full command line before ffmpeg starts. */
|
|
31
|
+
onStart?: (cmd: string) => void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Thin wrapper over the ffmpeg and ffprobe executables.
|
|
35
|
+
*/
|
|
36
|
+
export declare class FFmpeg {
|
|
37
|
+
/** stderr lines kept for the error message of a failed run */
|
|
38
|
+
private static readonly ERROR_LINES;
|
|
39
|
+
static probe(file: string): Promise<FfprobeData>;
|
|
40
|
+
static run(args: string[], options?: FFmpegRunOptions): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Splits each `'-option value'` (exactly two words) into two arguments, so config values like
|
|
43
|
+
* `'-movflags +faststart'` work (fluent-ffmpeg did the same).
|
|
44
|
+
*/
|
|
45
|
+
static splitOptions(options?: string[]): string[];
|
|
46
|
+
private static spawn;
|
|
47
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FFmpeg = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const node_child_process_1 = require("node:child_process");
|
|
6
|
+
const path = tslib_1.__importStar(require("node:path"));
|
|
7
|
+
const FFmpegFactory_1 = require("./FFmpegFactory");
|
|
8
|
+
/**
|
|
9
|
+
* Thin wrapper over the ffmpeg and ffprobe executables.
|
|
10
|
+
*/
|
|
11
|
+
class FFmpeg {
|
|
12
|
+
/** stderr lines kept for the error message of a failed run */
|
|
13
|
+
static { this.ERROR_LINES = 20; }
|
|
14
|
+
static async probe(file) {
|
|
15
|
+
const stdout = await this.spawn(FFmpegFactory_1.FFmpegFactory.getPaths().ffprobe, ['-v', 'error', '-print_format', 'json', '-show_format', '-show_streams', file], {}, true);
|
|
16
|
+
const data = JSON.parse(stdout);
|
|
17
|
+
return { streams: data.streams || [], format: data.format || {} };
|
|
18
|
+
}
|
|
19
|
+
static async run(args, options = {}) {
|
|
20
|
+
await this.spawn(FFmpegFactory_1.FFmpegFactory.getPaths().ffmpeg, args, options, false);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Splits each `'-option value'` (exactly two words) into two arguments, so config values like
|
|
24
|
+
* `'-movflags +faststart'` work (fluent-ffmpeg did the same).
|
|
25
|
+
*/
|
|
26
|
+
static splitOptions(options = []) {
|
|
27
|
+
return options.flatMap((o) => {
|
|
28
|
+
const split = String(o).split(' ');
|
|
29
|
+
return split.length === 2 ? split : [o];
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
static spawn(bin, args, options, collectStdout) {
|
|
33
|
+
const cmd = [bin, ...args].join(' ');
|
|
34
|
+
options.onStart?.(cmd);
|
|
35
|
+
return new Promise((resolve, reject) => {
|
|
36
|
+
const proc = (0, node_child_process_1.spawn)(bin, args, { windowsHide: true });
|
|
37
|
+
const stdout = [];
|
|
38
|
+
const lastLines = [];
|
|
39
|
+
let partialLine = '';
|
|
40
|
+
const onLine = (line) => {
|
|
41
|
+
if (line.length === 0) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
options.onStderrLine?.(line);
|
|
45
|
+
lastLines.push(line);
|
|
46
|
+
if (lastLines.length > this.ERROR_LINES) {
|
|
47
|
+
lastLines.shift();
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
proc.stdout.on('data', (chunk) => {
|
|
51
|
+
if (collectStdout) {
|
|
52
|
+
stdout.push(chunk);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
proc.stderr.setEncoding('utf8');
|
|
56
|
+
proc.stderr.on('data', (chunk) => {
|
|
57
|
+
const lines = (partialLine + chunk).split(/\r\n|\r|\n/);
|
|
58
|
+
partialLine = lines.pop() ?? ''; // split() returns at least one item
|
|
59
|
+
lines.forEach(onLine);
|
|
60
|
+
});
|
|
61
|
+
proc.on('error', (err) => {
|
|
62
|
+
reject(new Error('[FFmpeg] cannot run ' + bin + ': ' + err.message));
|
|
63
|
+
});
|
|
64
|
+
proc.on('close', (code, signal) => {
|
|
65
|
+
onLine(partialLine);
|
|
66
|
+
if (code === 0) {
|
|
67
|
+
return resolve(Buffer.concat(stdout).toString('utf8'));
|
|
68
|
+
}
|
|
69
|
+
reject(new Error('[FFmpeg] ' + path.basename(bin) + ' exited with ' + (signal ? 'signal ' + signal : 'code ' + code) +
|
|
70
|
+
': ' + lastLines.join('\n') + '\nexecuted: ' + cmd));
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.FFmpeg = FFmpeg;
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
export interface FFmpegPaths {
|
|
2
|
+
ffmpeg: string;
|
|
3
|
+
ffprobe: string;
|
|
4
|
+
}
|
|
2
5
|
export declare class FFmpegFactory {
|
|
3
|
-
static
|
|
6
|
+
private static paths;
|
|
7
|
+
/**
|
|
8
|
+
* Paths of the ffmpeg and ffprobe executables.
|
|
9
|
+
* Prefers the optional ffmpeg-static/ffprobe-static packages, then FFMPEG_PATH/FFPROBE_PATH, then the PATH.
|
|
10
|
+
*/
|
|
11
|
+
static getPaths(): FFmpegPaths;
|
|
12
|
+
private static requirePath;
|
|
4
13
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FFmpegFactory = void 0;
|
|
4
|
+
class FFmpegFactory {
|
|
5
|
+
static { this.paths = null; }
|
|
6
|
+
/**
|
|
7
|
+
* Paths of the ffmpeg and ffprobe executables.
|
|
8
|
+
* Prefers the optional ffmpeg-static/ffprobe-static packages, then FFMPEG_PATH/FFPROBE_PATH, then the PATH.
|
|
9
|
+
*/
|
|
10
|
+
static getPaths() {
|
|
11
|
+
if (this.paths === null) {
|
|
12
|
+
this.paths = {
|
|
13
|
+
ffmpeg: this.requirePath(() => require('ffmpeg-static')) || process.env['FFMPEG_PATH'] || 'ffmpeg',
|
|
14
|
+
ffprobe: this.requirePath(() => require('ffprobe-static').path) || process.env['FFPROBE_PATH'] || 'ffprobe'
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
return this.paths;
|
|
18
|
+
}
|
|
19
|
+
static requirePath(load) {
|
|
20
|
+
try {
|
|
21
|
+
return load();
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return null; // the optional package is not installed
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.FFmpegFactory = FFmpegFactory;
|