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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
-
import {
|
|
2
|
+
import { DataSource } from 'typeorm';
|
|
3
3
|
import { ServerDataBaseConfig } from '../../../common/config/private/PrivateConfig';
|
|
4
4
|
export declare class SQLConnection {
|
|
5
5
|
private static entries;
|
|
@@ -7,7 +7,7 @@ export declare class SQLConnection {
|
|
|
7
7
|
private static FIXED_SQL_TABLE;
|
|
8
8
|
static getEntries(): Function[];
|
|
9
9
|
static addEntries(tables: Function[]): Promise<void>;
|
|
10
|
-
static getConnection(): Promise<
|
|
10
|
+
static getConnection(): Promise<DataSource>;
|
|
11
11
|
static tryConnection(config: ServerDataBaseConfig): Promise<boolean>;
|
|
12
12
|
static init(): Promise<void>;
|
|
13
13
|
static close(): Promise<void>;
|
|
@@ -18,5 +18,7 @@ export declare class SQLConnection {
|
|
|
18
18
|
static getSQLiteDB(config: ServerDataBaseConfig): string;
|
|
19
19
|
private static createConnection;
|
|
20
20
|
private static schemeSync;
|
|
21
|
+
private static getMySQLConfig;
|
|
22
|
+
private static getSQLiteConfig;
|
|
21
23
|
private static getDriver;
|
|
22
24
|
}
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SQLConnection = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
require("reflect-metadata");
|
|
6
|
+
const typeorm_1 = require("typeorm");
|
|
7
|
+
const UserEntity_1 = require("./enitites/UserEntity");
|
|
8
|
+
const UserDTO_1 = require("../../../common/entities/UserDTO");
|
|
9
|
+
const PhotoEntity_1 = require("./enitites/PhotoEntity");
|
|
10
|
+
const DirectoryEntity_1 = require("./enitites/DirectoryEntity");
|
|
11
|
+
const Config_1 = require("../../../common/config/private/Config");
|
|
12
|
+
const SharingEntity_1 = require("./enitites/SharingEntity");
|
|
13
|
+
const PasswordHelper_1 = require("../PasswordHelper");
|
|
14
|
+
const ProjectPath_1 = require("../../ProjectPath");
|
|
15
|
+
const VersionEntity_1 = require("./enitites/VersionEntity");
|
|
16
|
+
const Logger_1 = require("../../Logger");
|
|
17
|
+
const MediaEntity_1 = require("./enitites/MediaEntity");
|
|
18
|
+
const VideoEntity_1 = require("./enitites/VideoEntity");
|
|
19
|
+
const DataStructureVersion_1 = require("../../../common/DataStructureVersion");
|
|
20
|
+
const FileEntity_1 = require("./enitites/FileEntity");
|
|
21
|
+
const PersonEntry_1 = require("./enitites/person/PersonEntry");
|
|
22
|
+
const Utils_1 = require("../../../common/Utils");
|
|
23
|
+
const path = tslib_1.__importStar(require("node:path"));
|
|
24
|
+
const PrivateConfig_1 = require("../../../common/config/private/PrivateConfig");
|
|
25
|
+
const AlbumBaseEntity_1 = require("./enitites/album/AlbumBaseEntity");
|
|
26
|
+
const SavedSearchEntity_1 = require("./enitites/album/SavedSearchEntity");
|
|
27
|
+
const NotifocationManager_1 = require("../NotifocationManager");
|
|
28
|
+
const PersonJunctionTable_1 = require("./enitites/person/PersonJunctionTable");
|
|
29
|
+
const MDFileEntity_1 = require("./enitites/MDFileEntity");
|
|
30
|
+
const ProjectedDirectoryCacheEntity_1 = require("./enitites/ProjectedDirectoryCacheEntity");
|
|
31
|
+
const ProjectedPersonCacheEntity_1 = require("./enitites/person/ProjectedPersonCacheEntity");
|
|
32
|
+
const ProjectedAlbumCacheEntity_1 = require("./enitites/album/ProjectedAlbumCacheEntity");
|
|
33
|
+
const EntityUtils_1 = require("./enitites/EntityUtils");
|
|
34
|
+
const LOG_TAG = '[SQLConnection]';
|
|
35
|
+
class SQLConnection {
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
37
|
+
static { this.entries = [
|
|
38
|
+
UserEntity_1.UserEntity,
|
|
39
|
+
FileEntity_1.FileEntity,
|
|
40
|
+
MDFileEntity_1.MDFileEntity,
|
|
41
|
+
PersonJunctionTable_1.PersonJunctionTable,
|
|
42
|
+
PersonEntry_1.PersonEntry,
|
|
43
|
+
MediaEntity_1.MediaEntity,
|
|
44
|
+
PhotoEntity_1.PhotoEntity,
|
|
45
|
+
VideoEntity_1.VideoEntity,
|
|
46
|
+
DirectoryEntity_1.DirectoryEntity,
|
|
47
|
+
SharingEntity_1.SharingEntity,
|
|
48
|
+
AlbumBaseEntity_1.AlbumBaseEntity,
|
|
49
|
+
SavedSearchEntity_1.SavedSearchEntity,
|
|
50
|
+
VersionEntity_1.VersionEntity,
|
|
51
|
+
// projection-aware cache entries
|
|
52
|
+
ProjectedDirectoryCacheEntity_1.ProjectedDirectoryCacheEntity,
|
|
53
|
+
ProjectedPersonCacheEntity_1.ProjectedPersonCacheEntity,
|
|
54
|
+
ProjectedAlbumCacheEntity_1.ProjectedAlbumCacheEntity
|
|
55
|
+
]; }
|
|
56
|
+
static { this.connection = null; }
|
|
57
|
+
static { this.FIXED_SQL_TABLE = [
|
|
58
|
+
'sqlite_sequence'
|
|
59
|
+
]; }
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
61
|
+
static getEntries() {
|
|
62
|
+
return this.entries;
|
|
63
|
+
}
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
65
|
+
static async addEntries(tables) {
|
|
66
|
+
if (!tables?.length) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
await this.close();
|
|
70
|
+
this.entries = Utils_1.Utils.getUnique(this.entries.concat(tables));
|
|
71
|
+
await (await this.getConnection()).synchronize();
|
|
72
|
+
}
|
|
73
|
+
static async getConnection() {
|
|
74
|
+
if (this.connection == null) {
|
|
75
|
+
const options = this.getDriver(Config_1.Config.Database);
|
|
76
|
+
Logger_1.Logger.debug(LOG_TAG, 'Creating connection: ' + PrivateConfig_1.DatabaseType[Config_1.Config.Database.type], ', with driver:', options.type);
|
|
77
|
+
this.connection = await this.createConnection(options);
|
|
78
|
+
await SQLConnection.schemeSync(this.connection);
|
|
79
|
+
}
|
|
80
|
+
return this.connection;
|
|
81
|
+
}
|
|
82
|
+
static async tryConnection(config) {
|
|
83
|
+
const conn = await this.createConnection(this.getDriver(config));
|
|
84
|
+
try {
|
|
85
|
+
await SQLConnection.schemeSync(conn);
|
|
86
|
+
}
|
|
87
|
+
finally {
|
|
88
|
+
await conn.destroy();
|
|
89
|
+
}
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
static async init() {
|
|
93
|
+
const connection = await this.getConnection();
|
|
94
|
+
if (Config_1.Config.Users.authenticationRequired !== true) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
// Adding enforced users to the db
|
|
98
|
+
const userRepository = connection.getRepository(UserEntity_1.UserEntity);
|
|
99
|
+
if (Array.isArray(Config_1.Config.Users.enforcedUsers) &&
|
|
100
|
+
Config_1.Config.Users.enforcedUsers.length > 0) {
|
|
101
|
+
for (let i = 0; i < Config_1.Config.Users.enforcedUsers.length; ++i) {
|
|
102
|
+
const uc = Config_1.Config.Users.enforcedUsers[i];
|
|
103
|
+
const user = await userRepository.findOneBy({ name: uc.name });
|
|
104
|
+
if (!user) {
|
|
105
|
+
Logger_1.Logger.info(LOG_TAG, 'Saving enforced user: ' + uc.name);
|
|
106
|
+
const a = new UserEntity_1.UserEntity();
|
|
107
|
+
a.name = uc.name;
|
|
108
|
+
if (!uc.encryptedPassword) {
|
|
109
|
+
// the config loader encrypts the password of every enforced user
|
|
110
|
+
throw new Error('Enforced user has no password: ' + uc.name);
|
|
111
|
+
}
|
|
112
|
+
a.password = uc.encryptedPassword;
|
|
113
|
+
a.role = uc.role;
|
|
114
|
+
await userRepository.save(a);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
// Add dummy Admin to the db
|
|
119
|
+
const admins = await userRepository.findBy({ role: UserDTO_1.UserRoles.Admin });
|
|
120
|
+
const devs = await userRepository.findBy({ role: UserDTO_1.UserRoles.Developer });
|
|
121
|
+
if (admins.length === 0 && devs.length === 0) {
|
|
122
|
+
const a = new UserEntity_1.UserEntity();
|
|
123
|
+
a.name = 'admin';
|
|
124
|
+
a.password = PasswordHelper_1.PasswordHelper.cryptPassword('admin');
|
|
125
|
+
a.role = UserDTO_1.UserRoles.Admin;
|
|
126
|
+
await userRepository.save(a);
|
|
127
|
+
}
|
|
128
|
+
const defAdmin = await userRepository.findOneBy({
|
|
129
|
+
name: 'admin',
|
|
130
|
+
role: UserDTO_1.UserRoles.Admin,
|
|
131
|
+
});
|
|
132
|
+
if (defAdmin &&
|
|
133
|
+
PasswordHelper_1.PasswordHelper.comparePassword('admin', defAdmin.password)) {
|
|
134
|
+
if (!Config_1.Config.Users.suppressDefUserWarn) {
|
|
135
|
+
NotifocationManager_1.NotificationManager.error('Using default admin user!', 'You are using the default user: "admin", password: "admin". The is a security issue. Please change the password or remove the user.');
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
static async close() {
|
|
140
|
+
try {
|
|
141
|
+
if (this.connection != null) {
|
|
142
|
+
await this.connection.destroy();
|
|
143
|
+
this.connection = null;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
catch (err) {
|
|
147
|
+
console.error('Error during closing sql db:');
|
|
148
|
+
console.error(err);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Clears up the DB from unused tables. use it when the entities list are up-to-date (extensions won't add any new)
|
|
153
|
+
*/
|
|
154
|
+
static async removeUnusedTables() {
|
|
155
|
+
const conn = await this.getConnection();
|
|
156
|
+
const validTableNames = this.entries.map(e => conn.getRepository(e).metadata.tableName).concat(this.FIXED_SQL_TABLE);
|
|
157
|
+
let currentTables;
|
|
158
|
+
if (Config_1.Config.Database.type === PrivateConfig_1.DatabaseType.sqlite) {
|
|
159
|
+
currentTables = (await conn.query('SELECT name FROM sqlite_master WHERE type=\'table\''))
|
|
160
|
+
.map((r) => r.name);
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
currentTables = (await conn.query(`SELECT table_name
|
|
164
|
+
FROM information_schema.tables ` +
|
|
165
|
+
`WHERE table_schema = '${SQLConnection.getMySQLConfig(Config_1.Config.Database).database}'`))
|
|
166
|
+
.map((r) => r.table_name);
|
|
167
|
+
}
|
|
168
|
+
const tableToDrop = currentTables.filter(ct => !validTableNames.includes(ct));
|
|
169
|
+
for (let i = 0; i < tableToDrop.length; ++i) {
|
|
170
|
+
await conn.query('DROP TABLE ' + tableToDrop[i]);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
static getSQLiteDB(config) {
|
|
174
|
+
return path.join(ProjectPath_1.ProjectPath.getAbsolutePath(config.dbFolder), SQLConnection.getSQLiteConfig(Config_1.Config.Database).DBFileName);
|
|
175
|
+
}
|
|
176
|
+
static async createConnection(options) {
|
|
177
|
+
const initialize = (o) => new typeorm_1.DataSource(o).initialize();
|
|
178
|
+
if (options.type === 'better-sqlite3') {
|
|
179
|
+
return await initialize(options);
|
|
180
|
+
}
|
|
181
|
+
try {
|
|
182
|
+
return await initialize(options);
|
|
183
|
+
}
|
|
184
|
+
catch (e) {
|
|
185
|
+
if (e instanceof Error && 'sqlMessage' in e && e.sqlMessage === 'Unknown database \'' + String(options.database) + '\'') {
|
|
186
|
+
Logger_1.Logger.debug(LOG_TAG, 'creating database: ' + String(options.database));
|
|
187
|
+
const tmpOption = Utils_1.Utils.clone(options);
|
|
188
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
189
|
+
// @ts-ignore
|
|
190
|
+
delete tmpOption.database;
|
|
191
|
+
const tmpConn = await initialize(tmpOption);
|
|
192
|
+
await tmpConn.query('CREATE DATABASE IF NOT EXISTS ' + String(options.database));
|
|
193
|
+
await tmpConn.destroy();
|
|
194
|
+
return await initialize(options);
|
|
195
|
+
}
|
|
196
|
+
throw e;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
static async schemeSync(connection) {
|
|
200
|
+
let version = null;
|
|
201
|
+
try {
|
|
202
|
+
version = (await connection.getRepository(VersionEntity_1.VersionEntity).find())[0];
|
|
203
|
+
// eslint-disable-next-line no-empty
|
|
204
|
+
}
|
|
205
|
+
catch {
|
|
206
|
+
}
|
|
207
|
+
if (version && version.version === DataStructureVersion_1.DataStructureVersion) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
Logger_1.Logger.info(LOG_TAG, 'Updating database scheme');
|
|
211
|
+
if (!version) {
|
|
212
|
+
version = new VersionEntity_1.VersionEntity();
|
|
213
|
+
}
|
|
214
|
+
version.version = DataStructureVersion_1.DataStructureVersion;
|
|
215
|
+
let users = [];
|
|
216
|
+
try {
|
|
217
|
+
// only select the columns that exist in the old scheme, so adding a column to the user does not lose the users
|
|
218
|
+
const metadata = connection.getMetadata(UserEntity_1.UserEntity);
|
|
219
|
+
const queryRunner = connection.createQueryRunner();
|
|
220
|
+
const table = await queryRunner.getTable(metadata.tableName);
|
|
221
|
+
await queryRunner.release();
|
|
222
|
+
const existingColumns = new Set((table?.columns || []).map(c => c.name));
|
|
223
|
+
users = await connection
|
|
224
|
+
.getRepository(UserEntity_1.UserEntity)
|
|
225
|
+
.createQueryBuilder('user')
|
|
226
|
+
.select(metadata.columns
|
|
227
|
+
.filter(c => existingColumns.has(c.databaseName))
|
|
228
|
+
.map(c => 'user.' + c.propertyName))
|
|
229
|
+
.getMany();
|
|
230
|
+
// eslint-disable-next-line no-empty
|
|
231
|
+
}
|
|
232
|
+
catch {
|
|
233
|
+
}
|
|
234
|
+
await connection.dropDatabase();
|
|
235
|
+
await connection.synchronize();
|
|
236
|
+
await connection.getRepository(VersionEntity_1.VersionEntity).save(version);
|
|
237
|
+
try {
|
|
238
|
+
await connection.getRepository(UserEntity_1.UserEntity).save(users);
|
|
239
|
+
}
|
|
240
|
+
catch (e) {
|
|
241
|
+
await connection.dropDatabase();
|
|
242
|
+
await connection.synchronize();
|
|
243
|
+
await connection.getRepository(VersionEntity_1.VersionEntity).save(version);
|
|
244
|
+
Logger_1.Logger.warn(LOG_TAG, 'Could not move users to the new db scheme, deleting them. Details:' +
|
|
245
|
+
String(e));
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
static getMySQLConfig(config) {
|
|
249
|
+
if (!config.mysql) {
|
|
250
|
+
throw new Error('MySQL is selected, but its config is missing');
|
|
251
|
+
}
|
|
252
|
+
return config.mysql;
|
|
253
|
+
}
|
|
254
|
+
static getSQLiteConfig(config) {
|
|
255
|
+
if (!config.sqlite) {
|
|
256
|
+
throw new Error('SQLite is selected, but its config is missing');
|
|
257
|
+
}
|
|
258
|
+
return config.sqlite;
|
|
259
|
+
}
|
|
260
|
+
static getDriver(config) {
|
|
261
|
+
let driver;
|
|
262
|
+
if (config.type === PrivateConfig_1.DatabaseType.mysql) {
|
|
263
|
+
const mysql = SQLConnection.getMySQLConfig(config);
|
|
264
|
+
driver = {
|
|
265
|
+
type: 'mysql',
|
|
266
|
+
host: mysql.host,
|
|
267
|
+
port: mysql.port,
|
|
268
|
+
username: mysql.username,
|
|
269
|
+
password: mysql.password,
|
|
270
|
+
database: mysql.database,
|
|
271
|
+
charset: 'utf8mb4',
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
else if (config.type === PrivateConfig_1.DatabaseType.sqlite) {
|
|
275
|
+
driver = {
|
|
276
|
+
type: 'better-sqlite3',
|
|
277
|
+
database: path.join(ProjectPath_1.ProjectPath.getAbsolutePath(config.dbFolder), SQLConnection.getSQLiteConfig(config).DBFileName),
|
|
278
|
+
// for the accent- and case-insensitive search (#1309)
|
|
279
|
+
prepareDatabase: (db) => {
|
|
280
|
+
db.function('fold', { deterministic: true }, EntityUtils_1.foldText);
|
|
281
|
+
},
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
throw new Error('Unsupported database type: ' + String(config.type));
|
|
286
|
+
}
|
|
287
|
+
driver.entities = this.entries;
|
|
288
|
+
driver.synchronize = false;
|
|
289
|
+
if (Config_1.Config.Server.Log.sqlLevel !== PrivateConfig_1.SQLLogLevel.none) {
|
|
290
|
+
driver.logging = PrivateConfig_1.SQLLogLevel[Config_1.Config.Server.Log.sqlLevel];
|
|
291
|
+
}
|
|
292
|
+
return driver;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
exports.SQLConnection = SQLConnection;
|
|
@@ -1,22 +1,32 @@
|
|
|
1
1
|
import { AutoCompleteItem } from '../../../common/entities/AutoCompleteItem';
|
|
2
2
|
import { SearchResultDTO } from '../../../common/entities/SearchResultDTO';
|
|
3
3
|
import { PhotoEntity } from './enitites/PhotoEntity';
|
|
4
|
-
import { Brackets, SelectQueryBuilder } from 'typeorm';
|
|
4
|
+
import { Brackets, ObjectLiteral, SelectQueryBuilder } from 'typeorm';
|
|
5
5
|
import { SearchQueryDTO, SearchQueryTypes } from '../../../common/entities/SearchQueryDTO';
|
|
6
6
|
import { SortingMethod } from '../../../common/entities/SortingMethods';
|
|
7
7
|
import { SessionContext } from '../SessionContext';
|
|
8
8
|
export declare class SearchManager {
|
|
9
9
|
private DIRECTORY_SELECT;
|
|
10
10
|
private queryIdBase;
|
|
11
|
-
static
|
|
11
|
+
private static likeValue;
|
|
12
|
+
/**
|
|
13
|
+
* A text condition that ignores the accents and the case as far as the DB can, see sqlFoldsText().
|
|
14
|
+
* @param escape '\' escapes the wildcards of the value (MySQL does it by default, SQLite only with ESCAPE)
|
|
15
|
+
* @param wrap an SQL expression around the compared text (not around the IS NOT NULL check)
|
|
16
|
+
*/
|
|
17
|
+
private static like;
|
|
18
|
+
private static containsText;
|
|
19
|
+
static setSorting<T extends ObjectLiteral>(query: SelectQueryBuilder<T>, sortings: SortingMethod[]): SelectQueryBuilder<T>;
|
|
12
20
|
private static autoCompleteItemsUnique;
|
|
13
21
|
autocomplete(session: SessionContext, value: string, type: SearchQueryTypes): Promise<AutoCompleteItem[]>;
|
|
14
22
|
search(session: SessionContext, queryIN: SearchQueryDTO): Promise<SearchResultDTO>;
|
|
15
23
|
getNMedia(session: SessionContext, query: SearchQueryDTO, sortings: SortingMethod[], take: number, photoOnly?: boolean): Promise<PhotoEntity[]>;
|
|
16
24
|
getCount(session: SessionContext, query: SearchQueryDTO): Promise<number>;
|
|
17
|
-
prepareAndBuildWhereQuery(queryIN: SearchQueryDTO, directoryOnly?:
|
|
18
|
-
|
|
19
|
-
|
|
25
|
+
prepareAndBuildWhereQuery(queryIN: SearchQueryDTO, directoryOnly?: false, aliases?: Record<string, string>): Promise<Brackets>;
|
|
26
|
+
/**
|
|
27
|
+
* directoryOnly: null if the query has no directory related part
|
|
28
|
+
*/
|
|
29
|
+
prepareAndBuildWhereQuery(queryIN: SearchQueryDTO, directoryOnly: boolean, aliases?: Record<string, string>): Promise<Brackets | null>;
|
|
20
30
|
prepareQuery(queryIN: SearchQueryDTO): Promise<SearchQueryDTO>;
|
|
21
31
|
/**
|
|
22
32
|
* Builds the SQL Where query from search query
|
|
@@ -25,11 +35,16 @@ export declare class SearchManager {
|
|
|
25
35
|
* @param aliases for SQL alias mapping
|
|
26
36
|
* @private
|
|
27
37
|
*/
|
|
28
|
-
buildWhereQuery(query: SearchQueryDTO, directoryOnly?: boolean, aliases?:
|
|
29
|
-
[key: string]: string;
|
|
30
|
-
}): Brackets;
|
|
38
|
+
buildWhereQuery(query: SearchQueryDTO, directoryOnly?: boolean, aliases?: Record<string, string>): Brackets;
|
|
31
39
|
hasDirectoryQuery(query: SearchQueryDTO): boolean;
|
|
32
40
|
protected flattenSameOfQueries(query: SearchQueryDTO): SearchQueryDTO;
|
|
41
|
+
/**
|
|
42
|
+
* A directory glob with a trailing '/*' means the directory itself and everything below it.
|
|
43
|
+
* The SQL glob only matches below the directory, so the directory itself is added as an exact match.
|
|
44
|
+
* See SearchQueryUtils.matchDirectorySearch for the same logic without DB.
|
|
45
|
+
*/
|
|
46
|
+
protected expandDirectoryGlobs(query: SearchQueryDTO): SearchQueryDTO;
|
|
47
|
+
protected convertMatchTypeToGlob(query: SearchQueryDTO): SearchQueryDTO;
|
|
33
48
|
/**
|
|
34
49
|
* Assigning IDs to search queries. It is a help / simplification to typeorm,
|
|
35
50
|
* so less parameters are needed to pass down to SQL.
|