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.
Files changed (420) hide show
  1. package/README.md +11 -5
  2. package/index.d.ts +1 -0
  3. package/index.js +2 -3
  4. package/lib/backend/Logger.d.ts +7 -7
  5. package/lib/backend/Logger.js +104 -0
  6. package/lib/backend/ProjectPath.d.ts +12 -0
  7. package/lib/backend/ProjectPath.js +28 -2
  8. package/lib/backend/exceptions/DirectoryNotFound.d.ts +2 -0
  9. package/lib/backend/exceptions/DirectoryNotFound.js +7 -0
  10. package/lib/backend/exceptions/FileAlreadyExists.js +10 -0
  11. package/lib/backend/exceptions/FolderNotWritable.d.ts +2 -0
  12. package/lib/backend/exceptions/FolderNotWritable.js +7 -0
  13. package/lib/backend/exceptions/LocationLookupException.js +10 -0
  14. package/lib/backend/index.d.ts +1 -1
  15. package/lib/backend/middlewares/AlbumMWs.js +61 -0
  16. package/lib/backend/middlewares/GalleryMWs.d.ts +4 -0
  17. package/lib/backend/middlewares/GalleryMWs.js +380 -0
  18. package/lib/backend/middlewares/MetaFileMWs.js +41 -0
  19. package/lib/backend/middlewares/NotificationMWs.js +21 -0
  20. package/lib/backend/middlewares/PersonMWs.d.ts +1 -1
  21. package/lib/backend/middlewares/PersonMWs.js +64 -0
  22. package/lib/backend/middlewares/RenderingMWs.d.ts +24 -0
  23. package/lib/backend/middlewares/RenderingMWs.js +182 -0
  24. package/lib/backend/middlewares/RequestParams.d.ts +13 -0
  25. package/lib/backend/middlewares/RequestParams.js +25 -0
  26. package/lib/backend/middlewares/RequestSession.d.ts +9 -0
  27. package/lib/backend/middlewares/RequestSession.js +16 -0
  28. package/lib/backend/middlewares/ServerTimingMWs.d.ts +6 -6
  29. package/lib/backend/middlewares/ServerTimingMWs.js +108 -0
  30. package/lib/backend/middlewares/SharingMWs.d.ts +2 -1
  31. package/lib/backend/middlewares/SharingMWs.js +240 -0
  32. package/lib/backend/middlewares/UploadMWs.js +95 -0
  33. package/lib/backend/middlewares/VersionMWs.d.ts +1 -1
  34. package/lib/backend/middlewares/VersionMWs.js +41 -0
  35. package/lib/backend/middlewares/admin/AdminMWs.js +115 -0
  36. package/lib/backend/middlewares/admin/ExtensionMWs.js +85 -0
  37. package/lib/backend/middlewares/admin/SettingsMWs.js +54 -0
  38. package/lib/backend/middlewares/thumbnail/ThumbnailGeneratorMWs.d.ts +1 -1
  39. package/lib/backend/middlewares/thumbnail/ThumbnailGeneratorMWs.js +153 -0
  40. package/lib/backend/middlewares/user/AuthenticationMWs.d.ts +37 -0
  41. package/lib/backend/middlewares/user/AuthenticationMWs.js +346 -0
  42. package/lib/backend/middlewares/user/OIDCAuthService.d.ts +36 -5
  43. package/lib/backend/middlewares/user/OIDCAuthService.js +216 -0
  44. package/lib/backend/middlewares/user/OIDCMWs.d.ts +10 -0
  45. package/lib/backend/middlewares/user/OIDCMWs.js +30 -0
  46. package/lib/backend/middlewares/user/UserMWs.d.ts +1 -0
  47. package/lib/backend/middlewares/user/UserMWs.js +120 -0
  48. package/lib/backend/middlewares/user/UserRequestConstrainsMWs.d.ts +0 -1
  49. package/lib/backend/middlewares/user/UserRequestConstrainsMWs.js +29 -0
  50. package/lib/backend/model/DirectoryAccess.d.ts +78 -0
  51. package/lib/backend/model/DirectoryAccess.js +222 -0
  52. package/lib/backend/model/EventLoopHandler.d.ts +1 -1
  53. package/lib/backend/model/EventLoopHandler.js +24 -0
  54. package/lib/backend/model/FFmpeg.d.ts +47 -0
  55. package/lib/backend/model/FFmpeg.js +75 -0
  56. package/lib/backend/model/FFmpegFactory.d.ts +11 -2
  57. package/lib/backend/model/FFmpegFactory.js +28 -0
  58. package/lib/backend/model/Localizations.js +19 -0
  59. package/lib/backend/model/ObjectManagers.d.ts +1 -1
  60. package/lib/backend/model/ObjectManagers.js +253 -0
  61. package/lib/backend/model/PasswordHelper.d.ts +1 -1
  62. package/lib/backend/model/PasswordHelper.js +6 -2
  63. package/lib/backend/model/SessionContext.d.ts +16 -6
  64. package/lib/backend/model/SessionContext.js +11 -0
  65. package/lib/backend/model/UploadManager.d.ts +6 -3
  66. package/lib/backend/model/UploadManager.js +101 -0
  67. package/lib/backend/model/database/AlbumManager.js +122 -0
  68. package/lib/backend/model/database/CoverManager.d.ts +8 -2
  69. package/lib/backend/model/database/CoverManager.js +169 -0
  70. package/lib/backend/model/database/GalleryManager.d.ts +15 -9
  71. package/lib/backend/model/database/GalleryManager.js +363 -0
  72. package/lib/backend/model/database/IObjectManager.js +2 -0
  73. package/lib/backend/model/database/IndexingManager.d.ts +7 -7
  74. package/lib/backend/model/database/IndexingManager.js +452 -0
  75. package/lib/backend/model/database/LocationManager.d.ts +2 -3
  76. package/lib/backend/model/database/LocationManager.js +39 -0
  77. package/lib/backend/model/database/PersonManager.d.ts +5 -3
  78. package/lib/backend/model/database/PersonManager.js +248 -0
  79. package/lib/backend/model/database/ProjectedCacheManager.d.ts +9 -8
  80. package/lib/backend/model/database/ProjectedCacheManager.js +297 -0
  81. package/lib/backend/model/database/ProjectionAwareManager.d.ts +4 -4
  82. package/lib/backend/model/database/ProjectionAwareManager.js +56 -0
  83. package/lib/backend/model/database/SQLConnection.d.ts +4 -2
  84. package/lib/backend/model/database/SQLConnection.js +295 -0
  85. package/lib/backend/model/database/SearchManager.d.ts +23 -8
  86. package/lib/backend/model/database/SearchManager.js +1032 -0
  87. package/lib/backend/model/database/SessionManager.d.ts +41 -4
  88. package/lib/backend/model/database/SessionManager.js +228 -0
  89. package/lib/backend/model/database/SharingManager.d.ts +11 -6
  90. package/lib/backend/model/database/SharingManager.js +160 -0
  91. package/lib/backend/model/database/UserManager.d.ts +8 -1
  92. package/lib/backend/model/database/UserManager.js +148 -0
  93. package/lib/backend/model/database/VersionManager.js +60 -0
  94. package/lib/backend/model/database/enitites/DirectoryEntity.d.ts +1 -1
  95. package/lib/backend/model/database/enitites/DirectoryEntity.js +76 -0
  96. package/lib/backend/model/database/enitites/EntityUtils.d.ts +22 -1
  97. package/lib/backend/model/database/enitites/EntityUtils.js +66 -0
  98. package/lib/backend/model/database/enitites/FileEntity.js +31 -0
  99. package/lib/backend/model/database/enitites/MDFileEntity.js +21 -0
  100. package/lib/backend/model/database/enitites/MediaEntity.d.ts +5 -2
  101. package/lib/backend/model/database/enitites/MediaEntity.js +223 -0
  102. package/lib/backend/model/database/enitites/PhotoEntity.js +19 -0
  103. package/lib/backend/model/database/enitites/ProjectedDirectoryCacheEntity.d.ts +2 -2
  104. package/lib/backend/model/database/enitites/ProjectedDirectoryCacheEntity.js +61 -0
  105. package/lib/backend/model/database/enitites/SharingEntity.d.ts +11 -5
  106. package/lib/backend/model/database/enitites/SharingEntity.js +100 -0
  107. package/lib/backend/model/database/enitites/UserEntity.d.ts +8 -5
  108. package/lib/backend/model/database/enitites/UserEntity.js +97 -0
  109. package/lib/backend/model/database/enitites/VersionEntity.js +19 -0
  110. package/lib/backend/model/database/enitites/VideoEntity.d.ts +2 -2
  111. package/lib/backend/model/database/enitites/VideoEntity.js +38 -0
  112. package/lib/backend/model/database/enitites/album/AlbumBaseEntity.js +32 -0
  113. package/lib/backend/model/database/enitites/album/ProjectedAlbumCacheEntity.d.ts +2 -2
  114. package/lib/backend/model/database/enitites/album/ProjectedAlbumCacheEntity.js +52 -0
  115. package/lib/backend/model/database/enitites/album/SavedSearchEntity.js +29 -0
  116. package/lib/backend/model/database/enitites/person/PersonEntry.js +36 -0
  117. package/lib/backend/model/database/enitites/person/PersonJunctionTable.js +37 -0
  118. package/lib/backend/model/database/enitites/person/ProjectedPersonCacheEntity.d.ts +1 -1
  119. package/lib/backend/model/database/enitites/person/ProjectedPersonCacheEntity.js +49 -0
  120. package/lib/backend/model/diagnostics/ConfigDiagnostics.d.ts +31 -12
  121. package/lib/backend/model/diagnostics/ConfigDiagnostics.js +537 -0
  122. package/lib/backend/model/extension/ExpressRouterWrapper.d.ts +10 -4
  123. package/lib/backend/model/extension/ExpressRouterWrapper.js +113 -0
  124. package/lib/backend/model/extension/ExtensionApp.d.ts +2 -3
  125. package/lib/backend/model/extension/ExtensionApp.js +18 -0
  126. package/lib/backend/model/extension/ExtensionConfig.js +17 -0
  127. package/lib/backend/model/extension/ExtensionConfigTemplateLoader.js +4 -3
  128. package/lib/backend/model/extension/ExtensionConfigWrapper.js +6 -5
  129. package/lib/backend/model/extension/ExtensionDB.d.ts +2 -2
  130. package/lib/backend/model/extension/ExtensionDB.js +22 -0
  131. package/lib/backend/model/extension/ExtensionDecorator.js +33 -0
  132. package/lib/backend/model/extension/ExtensionEvent.d.ts +12 -1
  133. package/lib/backend/model/extension/ExtensionEvent.js +81 -0
  134. package/lib/backend/model/extension/ExtensionManager.d.ts +22 -4
  135. package/lib/backend/model/extension/ExtensionManager.js +424 -0
  136. package/lib/backend/model/extension/ExtensionMessengerHandler.js +28 -0
  137. package/lib/backend/model/extension/ExtensionObject.d.ts +6 -3
  138. package/lib/backend/model/extension/ExtensionObject.js +45 -0
  139. package/lib/backend/model/extension/ExtensionRepository.js +69 -0
  140. package/lib/backend/model/extension/IExtension.d.ts +35 -18
  141. package/lib/backend/model/extension/IExtension.js +2 -0
  142. package/lib/backend/model/extension/UIExtension.js +23 -0
  143. package/lib/backend/model/fileaccess/DiskManager.d.ts +3 -1
  144. package/lib/backend/model/fileaccess/DiskManager.js +313 -0
  145. package/lib/backend/model/fileaccess/MetadataCreationDate.js +27 -0
  146. package/lib/backend/model/fileaccess/MetadataLoader.d.ts +17 -0
  147. package/lib/backend/model/fileaccess/MetadataLoader.js +765 -0
  148. package/lib/backend/model/fileaccess/PhotoWorker.js +159 -0
  149. package/lib/backend/model/fileaccess/TaskExecuter.js +41 -0
  150. package/lib/backend/model/fileaccess/TaskQue.d.ts +4 -4
  151. package/lib/backend/model/fileaccess/TaskQue.js +50 -0
  152. package/lib/backend/model/fileaccess/VideoConverterWorker.d.ts +4 -1
  153. package/lib/backend/model/fileaccess/VideoConverterWorker.js +59 -0
  154. package/lib/backend/model/fileaccess/fileprocessing/GPXProcessing.js +136 -0
  155. package/lib/backend/model/fileaccess/fileprocessing/PhotoProcessing.d.ts +3 -2
  156. package/lib/backend/model/fileaccess/fileprocessing/PhotoProcessing.js +251 -0
  157. package/lib/backend/model/fileaccess/fileprocessing/VideoProcessing.js +97 -0
  158. package/lib/backend/model/jobs/JobManager.d.ts +2 -4
  159. package/lib/backend/model/jobs/JobManager.js +129 -0
  160. package/lib/backend/model/jobs/JobProgressManager.d.ts +5 -3
  161. package/lib/backend/model/jobs/JobProgressManager.js +94 -0
  162. package/lib/backend/model/jobs/JobRepository.d.ts +1 -3
  163. package/lib/backend/model/jobs/JobRepository.js +50 -0
  164. package/lib/backend/model/jobs/jobs/AlbumCoverFillingJob.d.ts +1 -1
  165. package/lib/backend/model/jobs/jobs/AlbumCoverFillingJob.js +91 -0
  166. package/lib/backend/model/jobs/jobs/AlbumCoverResetJob.js +32 -0
  167. package/lib/backend/model/jobs/jobs/AlbumResetJob.js +30 -0
  168. package/lib/backend/model/jobs/jobs/FileJob.js +243 -0
  169. package/lib/backend/model/jobs/jobs/GPXCompressionJob.js +35 -0
  170. package/lib/backend/model/jobs/jobs/GPXCompressionResetJob.js +23 -0
  171. package/lib/backend/model/jobs/jobs/GalleryResetJob.js +30 -0
  172. package/lib/backend/model/jobs/jobs/IJob.js +2 -0
  173. package/lib/backend/model/jobs/jobs/IJobListener.d.ts +2 -2
  174. package/lib/backend/model/jobs/jobs/IJobListener.js +2 -0
  175. package/lib/backend/model/jobs/jobs/IndexingJob.js +99 -0
  176. package/lib/backend/model/jobs/jobs/Job.d.ts +4 -1
  177. package/lib/backend/model/jobs/jobs/Job.js +135 -0
  178. package/lib/backend/model/jobs/jobs/JobProgress.js +100 -0
  179. package/lib/backend/model/jobs/jobs/PhotoConvertingJob.js +78 -0
  180. package/lib/backend/model/jobs/jobs/TempFolderCleaningJob.js +122 -0
  181. package/lib/backend/model/jobs/jobs/TopPickSendJob.js +113 -0
  182. package/lib/backend/model/jobs/jobs/VideoConvertingJob.js +31 -0
  183. package/lib/backend/model/messenger/EmailMessenger.d.ts +1 -1
  184. package/lib/backend/model/messenger/EmailMessenger.js +87 -0
  185. package/lib/backend/model/messenger/ExtensionMessenger.js +16 -0
  186. package/lib/backend/model/messenger/Messenger.d.ts +1 -2
  187. package/lib/backend/model/messenger/Messenger.js +36 -0
  188. package/lib/backend/model/messenger/MessengerRepository.d.ts +1 -3
  189. package/lib/backend/model/messenger/MessengerRepository.js +38 -0
  190. package/lib/backend/model/messenger/StdoutMessenger.js +16 -0
  191. package/lib/backend/routes/AlbumRouter.js +39 -0
  192. package/lib/backend/routes/ErrorRouter.d.ts +1 -0
  193. package/lib/backend/routes/ErrorRouter.js +39 -0
  194. package/lib/backend/routes/GalleryRouter.d.ts +8 -0
  195. package/lib/backend/routes/GalleryRouter.js +165 -0
  196. package/lib/backend/routes/LoggerRouter.js +43 -0
  197. package/lib/backend/routes/NotificationRouter.js +19 -0
  198. package/lib/backend/routes/OIDCRouter.js +20 -0
  199. package/lib/backend/routes/PersonRouter.js +41 -0
  200. package/lib/backend/routes/PublicRouter.d.ts +3 -6
  201. package/lib/backend/routes/PublicRouter.js +301 -0
  202. package/lib/backend/routes/Router.js +36 -0
  203. package/lib/backend/routes/SharingRouter.d.ts +1 -1
  204. package/lib/backend/routes/SharingRouter.js +55 -0
  205. package/lib/backend/routes/UploadRouter.js +18 -0
  206. package/lib/backend/routes/UserRouter.d.ts +1 -0
  207. package/lib/backend/routes/UserRouter.js +53 -0
  208. package/lib/backend/routes/admin/AdminRouter.js +32 -0
  209. package/lib/backend/routes/admin/ExtensionRouter.js +30 -0
  210. package/lib/backend/routes/admin/SettingsRouter.js +18 -0
  211. package/lib/backend/server.d.ts +3 -3
  212. package/lib/backend/server.js +176 -0
  213. package/lib/common/CookieNames.js +10 -0
  214. package/lib/common/CustomHeaders.js +8 -0
  215. package/lib/common/DataStructureVersion.d.ts +1 -1
  216. package/lib/common/DataStructureVersion.js +7 -0
  217. package/lib/common/PG2ConfMap.js +36 -0
  218. package/lib/common/QueryParams.js +45 -0
  219. package/lib/common/SearchQueryParser.d.ts +2 -2
  220. package/lib/common/SearchQueryParser.js +611 -0
  221. package/lib/common/SearchQueryUtils.d.ts +71 -4
  222. package/lib/common/SearchQueryUtils.js +443 -0
  223. package/lib/common/SupportedFormats.d.ts +11 -1
  224. package/lib/common/SupportedFormats.js +13 -19
  225. package/lib/common/TextFold.d.ts +6 -0
  226. package/lib/common/TextFold.js +19 -0
  227. package/lib/common/UploadUtils.d.ts +4 -0
  228. package/lib/common/UploadUtils.js +20 -0
  229. package/lib/common/Utils.d.ts +23 -24
  230. package/lib/common/Utils.js +37 -97
  231. package/lib/common/config/private/Config.d.ts +1 -1
  232. package/lib/common/config/private/Config.js +2 -0
  233. package/lib/common/config/private/PrivateConfig.d.ts +17 -4
  234. package/lib/common/config/private/PrivateConfig.js +262 -33
  235. package/lib/common/config/private/PrivateConfigClass.js +10 -13
  236. package/lib/common/config/private/WebConfig.d.ts +1 -2
  237. package/lib/common/config/private/WebConfig.js +0 -2
  238. package/lib/common/config/private/subconfigs/MessagingConfig.js +8 -0
  239. package/lib/common/config/private/subconfigs/ServerExtensionsConfig.d.ts +2 -3
  240. package/lib/common/config/private/subconfigs/ServerExtensionsConfig.js +7 -3
  241. package/lib/common/config/public/ClientConfig.d.ts +55 -17
  242. package/lib/common/config/public/ClientConfig.js +291 -20
  243. package/lib/common/config/public/Config.js +5 -4
  244. package/lib/common/entities/AutoCompleteItem.d.ts +3 -3
  245. package/lib/common/entities/ContentWrapper.d.ts +21 -8
  246. package/lib/common/entities/ContentWrapper.js +286 -318
  247. package/lib/common/entities/DirectoryDTO.d.ts +7 -6
  248. package/lib/common/entities/DirectoryDTO.js +10 -5
  249. package/lib/common/entities/Error.d.ts +12 -7
  250. package/lib/common/entities/Error.js +15 -3
  251. package/lib/common/entities/MediaDTO.d.ts +13 -0
  252. package/lib/common/entities/MediaDTO.js +10 -7
  253. package/lib/common/entities/Message.d.ts +3 -3
  254. package/lib/common/entities/NotificationDTO.d.ts +2 -2
  255. package/lib/common/entities/SearchQueryDTO.d.ts +9 -1
  256. package/lib/common/entities/SearchQueryDTO.js +1 -0
  257. package/lib/common/entities/SharingDTO.d.ts +39 -5
  258. package/lib/common/entities/SortingMethods.d.ts +26 -2
  259. package/lib/common/entities/SortingMethods.js +14 -1
  260. package/lib/common/entities/UserDTO.d.ts +5 -2
  261. package/lib/common/entities/UserSettingsDTO.d.ts +3 -1
  262. package/lib/common/entities/VideoDTO.d.ts +2 -5
  263. package/lib/common/entities/album/AlbumBaseDTO.d.ts +2 -2
  264. package/lib/common/entities/extension/ExtensionListItem.d.ts +1 -1
  265. package/lib/common/entities/extension/IClientUIConfig.d.ts +19 -12
  266. package/lib/common/entities/job/JobDTO.d.ts +1 -1
  267. package/lib/common/entities/job/JobProgressDTO.d.ts +1 -1
  268. package/lib/common/entities/job/JobScheduleDTO.d.ts +5 -5
  269. package/lib/common/entities/job/JobScheduleDTO.js +9 -5
  270. package/lib/common/event/Event.js +49 -0
  271. package/lib/common/event/EventLimit.d.ts +1 -1
  272. package/package.json +21 -8
  273. package/REPOSITORY.md +0 -13
  274. package/events.drawio +0 -1
  275. package/events.png +0 -0
  276. package/index.js.map +0 -1
  277. package/index.ts +0 -2
  278. package/lib/backend/model/database/enitites/PersonEntry.d.ts +0 -11
  279. package/lib/backend/model/database/enitites/PersonJunctionTable.d.ts +0 -10
  280. package/lib/common/entities/ConentWrapper.d.ts +0 -18
  281. package/lib/common/entities/ConentWrapper.js +0 -490
  282. package/lib/frontend/app/app.component.d.ts +0 -18
  283. package/lib/frontend/app/app.module.d.ts +0 -23
  284. package/lib/frontend/app/app.routing.d.ts +0 -4
  285. package/lib/frontend/app/icon.component.d.ts +0 -7
  286. package/lib/frontend/app/model/IRenderable.d.ts +0 -17
  287. package/lib/frontend/app/model/backendtext.service.d.ts +0 -7
  288. package/lib/frontend/app/model/backendtext.service.spec.d.ts +0 -1
  289. package/lib/frontend/app/model/extension.service.d.ts +0 -5
  290. package/lib/frontend/app/model/navigation.service.d.ts +0 -12
  291. package/lib/frontend/app/model/network/autehentication.service.spec.d.ts +0 -1
  292. package/lib/frontend/app/model/network/authentication.service.d.ts +0 -22
  293. package/lib/frontend/app/model/network/helper/auth.guard.d.ts +0 -9
  294. package/lib/frontend/app/model/network/helper/csrf.interceptor.d.ts +0 -8
  295. package/lib/frontend/app/model/network/helper/error.interceptor.d.ts +0 -8
  296. package/lib/frontend/app/model/network/network.service.d.ts +0 -29
  297. package/lib/frontend/app/model/network/network.service.spec.d.ts +0 -1
  298. package/lib/frontend/app/model/network/user.service.d.ts +0 -13
  299. package/lib/frontend/app/model/network/user.service.spec.d.ts +0 -1
  300. package/lib/frontend/app/model/notification.service.d.ts +0 -28
  301. package/lib/frontend/app/model/page.helper.d.ts +0 -15
  302. package/lib/frontend/app/model/pi-title.service.d.ts +0 -15
  303. package/lib/frontend/app/model/query.service.d.ts +0 -19
  304. package/lib/frontend/app/model/seededRandom.service.d.ts +0 -7
  305. package/lib/frontend/app/model/theme.service.d.ts +0 -16
  306. package/lib/frontend/app/model/version.service.d.ts +0 -10
  307. package/lib/frontend/app/pipes/DurationPipe.d.ts +0 -4
  308. package/lib/frontend/app/pipes/FileDTOToPathPipe.d.ts +0 -5
  309. package/lib/frontend/app/pipes/FileDTOToRelativePathPipe.d.ts +0 -5
  310. package/lib/frontend/app/pipes/FileSizePipe.d.ts +0 -4
  311. package/lib/frontend/app/pipes/GPXFilesFilterPipe.d.ts +0 -5
  312. package/lib/frontend/app/pipes/MDFilesFilterPipe.d.ts +0 -6
  313. package/lib/frontend/app/pipes/ParseIntPipe.d.ts +0 -4
  314. package/lib/frontend/app/pipes/PhotoFilterPipe.d.ts +0 -6
  315. package/lib/frontend/app/pipes/SafeHTMLPipe.d.ts +0 -7
  316. package/lib/frontend/app/pipes/StringifyEnum.d.ts +0 -4
  317. package/lib/frontend/app/pipes/StringifyGridSize.d.ts +0 -5
  318. package/lib/frontend/app/pipes/StringifyRolePipe.d.ts +0 -4
  319. package/lib/frontend/app/pipes/StringifySearchQuery.d.ts +0 -8
  320. package/lib/frontend/app/pipes/StringifySearchType.d.ts +0 -5
  321. package/lib/frontend/app/pipes/StringifySortingMethod.d.ts +0 -4
  322. package/lib/frontend/app/ui/EnumTranslations.d.ts +0 -5
  323. package/lib/frontend/app/ui/admin/admin.component.d.ts +0 -36
  324. package/lib/frontend/app/ui/albums/album/album.component.d.ts +0 -26
  325. package/lib/frontend/app/ui/albums/albums.component.d.ts +0 -31
  326. package/lib/frontend/app/ui/albums/albums.service.d.ts +0 -12
  327. package/lib/frontend/app/ui/albums/saved-search-popup/saved-search-popup.component.d.ts +0 -15
  328. package/lib/frontend/app/ui/duplicates/duplicates.component.d.ts +0 -36
  329. package/lib/frontend/app/ui/duplicates/duplicates.service.d.ts +0 -9
  330. package/lib/frontend/app/ui/duplicates/photo/photo.duplicates.component.d.ts +0 -11
  331. package/lib/frontend/app/ui/faces/Person.d.ts +0 -9
  332. package/lib/frontend/app/ui/faces/face/face.component.d.ts +0 -22
  333. package/lib/frontend/app/ui/faces/faces.component.d.ts +0 -18
  334. package/lib/frontend/app/ui/faces/faces.service.d.ts +0 -14
  335. package/lib/frontend/app/ui/faces/navigator/navigator.faces.component.d.ts +0 -15
  336. package/lib/frontend/app/ui/frame/frame.component.d.ts +0 -60
  337. package/lib/frontend/app/ui/gallery/Media.d.ts +0 -15
  338. package/lib/frontend/app/ui/gallery/MediaIcon.d.ts +0 -29
  339. package/lib/frontend/app/ui/gallery/blog/blog.gallery.component.d.ts +0 -16
  340. package/lib/frontend/app/ui/gallery/blog/blog.service.d.ts +0 -85
  341. package/lib/frontend/app/ui/gallery/blog/blog.service.spec.d.ts +0 -1
  342. package/lib/frontend/app/ui/gallery/cache.gallery.service.d.ts +0 -51
  343. package/lib/frontend/app/ui/gallery/content.service.d.ts +0 -11
  344. package/lib/frontend/app/ui/gallery/contentLoader.service.d.ts +0 -37
  345. package/lib/frontend/app/ui/gallery/directories/directories.component.d.ts +0 -14
  346. package/lib/frontend/app/ui/gallery/directories/directory/directory.gallery.component.d.ts +0 -20
  347. package/lib/frontend/app/ui/gallery/filter/filter.gallery.component.d.ts +0 -32
  348. package/lib/frontend/app/ui/gallery/filter/filter.service.d.ts +0 -51
  349. package/lib/frontend/app/ui/gallery/filter/filter.service.spec.d.ts +0 -1
  350. package/lib/frontend/app/ui/gallery/fullscreen.service.d.ts +0 -7
  351. package/lib/frontend/app/ui/gallery/gallery.component.d.ts +0 -64
  352. package/lib/frontend/app/ui/gallery/gallery.component.spec.d.ts +0 -1
  353. package/lib/frontend/app/ui/gallery/gallery.service.d.ts +0 -13
  354. package/lib/frontend/app/ui/gallery/grid/GridMedia.d.ts +0 -13
  355. package/lib/frontend/app/ui/gallery/grid/GridRowBuilder.d.ts +0 -16
  356. package/lib/frontend/app/ui/gallery/grid/grid.gallery.component.d.ts +0 -88
  357. package/lib/frontend/app/ui/gallery/grid/grid.gallery.component.spec.d.ts +0 -1
  358. package/lib/frontend/app/ui/gallery/grid/photo/loading/loading.photo.grid.gallery.component.d.ts +0 -4
  359. package/lib/frontend/app/ui/gallery/grid/photo/media-button-modal/media-button-modal.component.d.ts +0 -20
  360. package/lib/frontend/app/ui/gallery/grid/photo/media-button-modal/media-button-modal.service.d.ts +0 -27
  361. package/lib/frontend/app/ui/gallery/grid/photo/photo.grid.gallery.component.d.ts +0 -53
  362. package/lib/frontend/app/ui/gallery/lightbox/controls/controls.lightbox.gallery.component.d.ts +0 -103
  363. package/lib/frontend/app/ui/gallery/lightbox/infopanel/info-panel.lightbox.gallery.component.d.ts +0 -51
  364. package/lib/frontend/app/ui/gallery/lightbox/lightbox.gallery.component.d.ts +0 -95
  365. package/lib/frontend/app/ui/gallery/lightbox/lightbox.gallery.component.spec.d.ts +0 -1
  366. package/lib/frontend/app/ui/gallery/lightbox/lightbox.service.d.ts +0 -45
  367. package/lib/frontend/app/ui/gallery/lightbox/media/media.lightbox.gallery.component.d.ts +0 -71
  368. package/lib/frontend/app/ui/gallery/map/MarkerFactory.d.ts +0 -12
  369. package/lib/frontend/app/ui/gallery/map/lightbox/lightbox.map.gallery.component.d.ts +0 -80
  370. package/lib/frontend/app/ui/gallery/map/map.gallery.component.d.ts +0 -36
  371. package/lib/frontend/app/ui/gallery/map/map.service.d.ts +0 -30
  372. package/lib/frontend/app/ui/gallery/navigator/navigator.gallery.component.d.ts +0 -81
  373. package/lib/frontend/app/ui/gallery/navigator/navigator.service.d.ts +0 -14
  374. package/lib/frontend/app/ui/gallery/navigator/sorting.service.d.ts +0 -38
  375. package/lib/frontend/app/ui/gallery/overlay.service.d.ts +0 -9
  376. package/lib/frontend/app/ui/gallery/photo-frame-builder/photo-frame-builder.gallery.component.d.ts +0 -40
  377. package/lib/frontend/app/ui/gallery/random-query-builder/random-query-builder.gallery.component.d.ts +0 -30
  378. package/lib/frontend/app/ui/gallery/search/AutoCompleteRenderItem.d.ts +0 -11
  379. package/lib/frontend/app/ui/gallery/search/autocomplete.service.d.ts +0 -33
  380. package/lib/frontend/app/ui/gallery/search/query-builder/query-bulder.gallery.component.d.ts +0 -22
  381. package/lib/frontend/app/ui/gallery/search/query-enrty/query-entry.search.gallery.component.d.ts +0 -43
  382. package/lib/frontend/app/ui/gallery/search/search-field/search-field.gallery.component.d.ts +0 -31
  383. package/lib/frontend/app/ui/gallery/search/search-field-base/search-field-base.gallery.component.d.ts +0 -57
  384. package/lib/frontend/app/ui/gallery/search/search-query-parser.service.d.ts +0 -7
  385. package/lib/frontend/app/ui/gallery/search/search.gallery.component.d.ts +0 -39
  386. package/lib/frontend/app/ui/gallery/share/share.gallery.component.d.ts +0 -67
  387. package/lib/frontend/app/ui/gallery/share.service.d.ts +0 -35
  388. package/lib/frontend/app/ui/gallery/thumbnailLoader.service.d.ts +0 -41
  389. package/lib/frontend/app/ui/gallery/thumbnailManager.service.d.ts +0 -46
  390. package/lib/frontend/app/ui/gallery/uploader/uploader.gallery.component.d.ts +0 -15
  391. package/lib/frontend/app/ui/gallery/uploader/uploader.service.d.ts +0 -36
  392. package/lib/frontend/app/ui/gallery/wakelock.service.d.ts +0 -19
  393. package/lib/frontend/app/ui/language/language.component.d.ts +0 -10
  394. package/lib/frontend/app/ui/login/login.component.d.ts +0 -18
  395. package/lib/frontend/app/ui/settings/extension-installer/extension-installer.component.d.ts +0 -18
  396. package/lib/frontend/app/ui/settings/extension-installer/extension-installer.service.d.ts +0 -10
  397. package/lib/frontend/app/ui/settings/gallery-statistic/gallery-statistic.component.d.ts +0 -5
  398. package/lib/frontend/app/ui/settings/scheduled-jobs.service.d.ts +0 -41
  399. package/lib/frontend/app/ui/settings/settings.service.d.ts +0 -27
  400. package/lib/frontend/app/ui/settings/sharings-list/sharings-list.component.d.ts +0 -14
  401. package/lib/frontend/app/ui/settings/template/CustomSettingsEntries.d.ts +0 -57
  402. package/lib/frontend/app/ui/settings/template/ISettingsComponent.d.ts +0 -13
  403. package/lib/frontend/app/ui/settings/template/settings-entry/settings-entry.component.d.ts +0 -118
  404. package/lib/frontend/app/ui/settings/template/settings-entry/sorting-method/sorting-method.settings-entry.component.d.ts +0 -28
  405. package/lib/frontend/app/ui/settings/template/template.component.d.ts +0 -97
  406. package/lib/frontend/app/ui/settings/users/users.component.d.ts +0 -47
  407. package/lib/frontend/app/ui/settings/users/users.service.d.ts +0 -12
  408. package/lib/frontend/app/ui/settings/workflow/button/job-button.settings.component.d.ts +0 -32
  409. package/lib/frontend/app/ui/settings/workflow/progress/job-progress.settings.component.d.ts +0 -25
  410. package/lib/frontend/app/ui/settings/workflow/workflow.component.d.ts +0 -68
  411. package/lib/frontend/app/ui/sharelogin/share-login.component.d.ts +0 -16
  412. package/lib/frontend/app/ui/utils/grid-size-icon/grid-size-icon.component.d.ts +0 -5
  413. package/lib/frontend/app/ui/utils/sorting-method-icon/sorting-method-icon.component.d.ts +0 -13
  414. package/lib/frontend/app/ui/utils/timestamp-datepicker/datepicker.component.d.ts +0 -10
  415. package/lib/frontend/app/ui/utils/timestamp-timepicker/timepicker.component.d.ts +0 -11
  416. package/lib/frontend/environments/environment.d.ts +0 -3
  417. package/lib/frontend/environments/environment.prod.d.ts +0 -3
  418. package/lib/frontend/main.d.ts +0 -21
  419. package/lib/frontend/polyfills.d.ts +0 -60
  420. package/lib/frontend/test.d.ts +0 -1
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ImageRendererFactory = exports.VideoRendererFactory = exports.ThumbnailSourceType = exports.PhotoWorker = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const sharp_1 = tslib_1.__importDefault(require("sharp"));
6
+ const Logger_1 = require("../../Logger");
7
+ const FFmpeg_1 = require("../FFmpeg");
8
+ const ExtensionDecorator_1 = require("../extension/ExtensionDecorator");
9
+ sharp_1.default.cache(false);
10
+ class PhotoWorker {
11
+ static { this.videoRenderer = null; }
12
+ static render(input) {
13
+ if (input.type === ThumbnailSourceType.Photo) {
14
+ return this.renderFromImage(input);
15
+ }
16
+ if (input.type === ThumbnailSourceType.Video) {
17
+ return this.renderFromVideo(input);
18
+ }
19
+ throw new Error('Unsupported media type to render thumbnail:' + String(input.type));
20
+ }
21
+ static renderFromImage(input, dryRun = false) {
22
+ return ImageRendererFactory.render(input, dryRun);
23
+ }
24
+ static renderFromVideo(input) {
25
+ if (PhotoWorker.videoRenderer === null) {
26
+ PhotoWorker.videoRenderer = VideoRendererFactory.build();
27
+ }
28
+ return PhotoWorker.videoRenderer(input);
29
+ }
30
+ }
31
+ exports.PhotoWorker = PhotoWorker;
32
+ var ThumbnailSourceType;
33
+ (function (ThumbnailSourceType) {
34
+ ThumbnailSourceType[ThumbnailSourceType["Photo"] = 1] = "Photo";
35
+ ThumbnailSourceType[ThumbnailSourceType["Video"] = 2] = "Video";
36
+ })(ThumbnailSourceType || (exports.ThumbnailSourceType = ThumbnailSourceType = {}));
37
+ class VideoRendererFactory {
38
+ static build() {
39
+ return async (input) => {
40
+ Logger_1.Logger.silly('[FFmpeg] rendering thumbnail: ' + input.mediaPath);
41
+ const data = await FFmpeg_1.FFmpeg.probe(input.mediaPath);
42
+ let width = null;
43
+ let height = null;
44
+ for (const stream of data.streams) {
45
+ if (stream.width && stream.height && !isNaN(stream.width) && !isNaN(stream.height)) {
46
+ width = stream.width;
47
+ height = stream.height;
48
+ break;
49
+ }
50
+ }
51
+ if (!width || !height || isNaN(width) || isNaN(height)) {
52
+ throw new Error(`[FFmpeg] Can not read video dimension. Found: ${width}x${height}`);
53
+ }
54
+ const duration = parseFloat(data.format.duration ?? '');
55
+ if (isNaN(duration)) {
56
+ throw new Error('[FFmpeg] Can not read video duration: ' + input.mediaPath);
57
+ }
58
+ let scale;
59
+ if (input.makeSquare === false) {
60
+ // keeps the aspect ratio with an even size, and does not upscale
61
+ scale = width < height
62
+ ? 'scale=w=' + Math.min(input.size, width) + ':h=trunc(ow/a/2)*2'
63
+ : 'scale=w=trunc(oh*a/2)*2:h=' + Math.min(input.size, height);
64
+ }
65
+ else {
66
+ scale = 'scale=w=' + input.size + ':h=' + input.size;
67
+ }
68
+ if (!input.outPath) {
69
+ throw new Error('[FFmpeg] No output path for the video thumbnail: ' + input.mediaPath);
70
+ }
71
+ await FFmpeg_1.FFmpeg.run([
72
+ '-ss', '' + (10 / 100) * duration, // frame at 10%
73
+ '-i', input.mediaPath,
74
+ '-y',
75
+ '-vf', scale,
76
+ '-frames:v', '1',
77
+ '-qscale:v', '50',
78
+ input.outPath
79
+ ]);
80
+ };
81
+ }
82
+ }
83
+ exports.VideoRendererFactory = VideoRendererFactory;
84
+ class ImageRendererFactory {
85
+ static async render(input, dryRun = false) {
86
+ let image;
87
+ if (input.mediaPath) {
88
+ Logger_1.Logger.silly('[SharpRenderer] rendering photo:' +
89
+ input.mediaPath +
90
+ ', size:' +
91
+ input.size);
92
+ image = (0, sharp_1.default)(input.mediaPath, {
93
+ failOnError: false,
94
+ animated: input.animate, ...(input.sharpOptions || {})
95
+ });
96
+ }
97
+ else {
98
+ const svg_buffer = Buffer.from(input.svgString);
99
+ image = (0, sharp_1.default)(svg_buffer, { density: 450 });
100
+ }
101
+ image.rotate();
102
+ const metadata = await image.metadata();
103
+ const kernel = input.useLanczos3 === true
104
+ ? sharp_1.default.kernel.lanczos3
105
+ : sharp_1.default.kernel.nearest;
106
+ if (input.cut) {
107
+ image.extract(input.cut);
108
+ }
109
+ if (input.makeSquare === false) {
110
+ if (metadata.height > metadata.width) {
111
+ image.resize(Math.min(input.size, metadata.width), null, {
112
+ kernel,
113
+ });
114
+ }
115
+ else {
116
+ image.resize(null, Math.min(input.size, metadata.height), {
117
+ kernel,
118
+ });
119
+ }
120
+ }
121
+ else {
122
+ image.resize(input.size, input.size, {
123
+ kernel,
124
+ position: sharp_1.default.gravity.centre,
125
+ fit: 'cover',
126
+ });
127
+ }
128
+ let processedImg;
129
+ if (input.mediaPath) {
130
+ processedImg = image.webp({
131
+ effort: 6,
132
+ quality: input.quality,
133
+ smartSubsample: input.smartSubsample
134
+ });
135
+ }
136
+ else {
137
+ if (!input.svgString) {
138
+ throw new Error('Nothing to render: neither mediaPath nor svgString is set');
139
+ }
140
+ processedImg = image.png({ effort: 6, quality: input.quality });
141
+ }
142
+ // do not save to file
143
+ if (dryRun) {
144
+ await processedImg.toFormat('webp').toBuffer();
145
+ return;
146
+ }
147
+ if (!input.outPath) {
148
+ throw new Error('No output path to render to');
149
+ }
150
+ await processedImg.toFile(input.outPath);
151
+ }
152
+ }
153
+ exports.ImageRendererFactory = ImageRendererFactory;
154
+ tslib_1.__decorate([
155
+ (0, ExtensionDecorator_1.ExtensionDecorator)(e => e.gallery.ImageRenderer.render),
156
+ tslib_1.__metadata("design:type", Function),
157
+ tslib_1.__metadata("design:paramtypes", [Object, Object]),
158
+ tslib_1.__metadata("design:returntype", Promise)
159
+ ], ImageRendererFactory, "render", null);
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TaskExecuter = void 0;
4
+ const TaskQue_1 = require("./TaskQue");
5
+ const EventLoopHandler_1 = require("../EventLoopHandler");
6
+ class TaskExecuter {
7
+ constructor(size, worker) {
8
+ this.size = size;
9
+ this.worker = worker;
10
+ this.taskQue = new TaskQue_1.TaskQue();
11
+ this.taskInProgress = 0;
12
+ this.el = new EventLoopHandler_1.EventLoopHandler();
13
+ this.run = async () => {
14
+ if (this.taskInProgress >= this.size) {
15
+ return;
16
+ }
17
+ const task = this.taskQue.get();
18
+ if (!task) {
19
+ return;
20
+ }
21
+ this.taskInProgress++;
22
+ try {
23
+ task.promise.resolve(await this.worker(task.data));
24
+ }
25
+ catch (err) {
26
+ task.promise.reject(err);
27
+ }
28
+ this.taskQue.ready(task);
29
+ this.taskInProgress--;
30
+ this.el.step(() => {
31
+ this.run().catch(console.error);
32
+ });
33
+ };
34
+ }
35
+ execute(input) {
36
+ const promise = this.taskQue.add(input).promise.obj;
37
+ this.run().catch(console.error);
38
+ return promise;
39
+ }
40
+ }
41
+ exports.TaskExecuter = TaskExecuter;
@@ -1,9 +1,9 @@
1
1
  export interface TaskQueEntry<I, O> {
2
2
  data: I;
3
3
  promise: {
4
- obj: Promise<O> | null;
5
- resolve: ((ret: O) => void) | null;
6
- reject: ((err: any) => void) | null;
4
+ obj: Promise<O>;
5
+ resolve: (ret: O) => void;
6
+ reject: (err: unknown) => void;
7
7
  };
8
8
  }
9
9
  export declare class TaskQue<I, O> {
@@ -11,7 +11,7 @@ export declare class TaskQue<I, O> {
11
11
  private processing;
12
12
  isEmpty(): boolean;
13
13
  add(input: I): TaskQueEntry<I, O>;
14
- get(): TaskQueEntry<I, O>;
14
+ get(): TaskQueEntry<I, O> | undefined;
15
15
  ready(task: TaskQueEntry<I, O>): void;
16
16
  private getSameTask;
17
17
  private putNewTask;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TaskQue = void 0;
4
+ const Utils_1 = require("../../../common/Utils");
5
+ class TaskQue {
6
+ constructor() {
7
+ this.tasks = [];
8
+ this.processing = [];
9
+ }
10
+ isEmpty() {
11
+ return this.tasks.length === 0;
12
+ }
13
+ add(input) {
14
+ return this.getSameTask(input) || this.putNewTask(input);
15
+ }
16
+ get() {
17
+ const task = this.tasks.shift();
18
+ if (task) {
19
+ this.processing.push(task);
20
+ }
21
+ return task;
22
+ }
23
+ ready(task) {
24
+ const index = this.processing.indexOf(task);
25
+ if (index === -1) {
26
+ throw new Error('Task does not exist');
27
+ }
28
+ this.processing.splice(index, 1);
29
+ }
30
+ getSameTask(input) {
31
+ return this.tasks.find((t) => Utils_1.Utils.equalsFilter(t.data, input)) ||
32
+ this.processing.find((t) => Utils_1.Utils.equalsFilter(t.data, input));
33
+ }
34
+ putNewTask(input) {
35
+ // assigned synchronously by the Promise executor
36
+ let resolve;
37
+ let reject;
38
+ const obj = new Promise((res, rej) => {
39
+ resolve = res;
40
+ reject = rej;
41
+ });
42
+ const taskEntry = {
43
+ data: input,
44
+ promise: { obj, resolve, reject },
45
+ };
46
+ this.tasks.push(taskEntry);
47
+ return taskEntry;
48
+ }
49
+ }
50
+ exports.TaskQue = TaskQue;
@@ -17,7 +17,10 @@ export interface VideoConverterInput {
17
17
  };
18
18
  }
19
19
  export declare class VideoConverterWorker {
20
- private static ffmpeg;
21
20
  static convert(input: VideoConverterInput): Promise<void>;
21
+ /**
22
+ * ffmpeg arguments in the order fluent-ffmpeg used to build them.
23
+ */
24
+ static buildArgs(input: VideoConverterInput): string[];
22
25
  private static _convert;
23
26
  }
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VideoConverterWorker = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const Logger_1 = require("../../Logger");
6
+ const node_fs_1 = require("node:fs");
7
+ const FFmpeg_1 = require("../FFmpeg");
8
+ const PrivateConfig_1 = require("../../../common/config/private/PrivateConfig");
9
+ const ExtensionDecorator_1 = require("../extension/ExtensionDecorator");
10
+ class VideoConverterWorker {
11
+ static async convert(input) {
12
+ const origPath = input.output.path;
13
+ input.output.path = origPath + '.part';
14
+ await this._convert(input);
15
+ await node_fs_1.promises.rename(input.output.path, origPath);
16
+ }
17
+ /**
18
+ * ffmpeg arguments in the order fluent-ffmpeg used to build them.
19
+ */
20
+ static buildArgs(input) {
21
+ const args = [...FFmpeg_1.FFmpeg.splitOptions(input.input.customOptions), '-i', input.videoPath, '-y'];
22
+ if (input.output.bitRate) {
23
+ args.push('-b:v', input.output.bitRate / 1024 + 'k');
24
+ }
25
+ args.push('-vcodec', input.output.codec);
26
+ if (input.output.fps) {
27
+ args.push('-r', '' + input.output.fps);
28
+ }
29
+ if (input.output.resolution) {
30
+ // keeps the aspect ratio with an even width
31
+ args.push('-filter:v', 'scale=w=trunc(oh*a/2)*2:h=' + input.output.resolution);
32
+ }
33
+ // Constant Rate Factor (CRF)
34
+ if (input.output.crf) {
35
+ args.push('-crf', '' + input.output.crf);
36
+ }
37
+ if (input.output.preset) {
38
+ args.push('-preset', PrivateConfig_1.FFmpegPresets[input.output.preset]);
39
+ }
40
+ args.push(...FFmpeg_1.FFmpeg.splitOptions(input.output.customOptions));
41
+ // force the output format, the .part extension does not tell it
42
+ args.push('-f', input.output.format, input.output.path);
43
+ return args;
44
+ }
45
+ static _convert(input) {
46
+ Logger_1.Logger.silly('[FFmpeg] transcoding video: ' + input.videoPath);
47
+ return FFmpeg_1.FFmpeg.run(this.buildArgs(input), {
48
+ onStart: (cmd) => Logger_1.Logger.silly('[FFmpeg] running:' + cmd),
49
+ onStderrLine: (line) => Logger_1.Logger.debug('[FFmpeg] ' + line)
50
+ });
51
+ }
52
+ }
53
+ exports.VideoConverterWorker = VideoConverterWorker;
54
+ tslib_1.__decorate([
55
+ (0, ExtensionDecorator_1.ExtensionDecorator)(e => e.gallery.VideoConverter.convert),
56
+ tslib_1.__metadata("design:type", Function),
57
+ tslib_1.__metadata("design:paramtypes", [Object]),
58
+ tslib_1.__metadata("design:returntype", Promise)
59
+ ], VideoConverterWorker, "convert", null);
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GPXProcessing = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const path = tslib_1.__importStar(require("node:path"));
6
+ const node_fs_1 = require("node:fs");
7
+ const xml2js = tslib_1.__importStar(require("xml2js"));
8
+ const ProjectPath_1 = require("../../../ProjectPath");
9
+ const Config_1 = require("../../../../common/config/private/Config");
10
+ const SupportedFormats_1 = require("../../../../common/SupportedFormats");
11
+ class GPXProcessing {
12
+ static { this.GPX_FLOAT_ACCURACY = 6; }
13
+ static isMetaFile(fullPath) {
14
+ const extension = path.extname(fullPath).toLowerCase();
15
+ return SupportedFormats_1.SupportedFormats.WithDots.MetaFiles.indexOf(extension) !== -1;
16
+ }
17
+ static isGPXFile(fullPath) {
18
+ const extension = path.extname(fullPath).toLowerCase();
19
+ return extension === '.gpx';
20
+ }
21
+ static generateConvertedPath(filePath) {
22
+ return path.join(ProjectPath_1.ProjectPath.TranscodedFolder, ProjectPath_1.ProjectPath.getRelativePathToImages(path.dirname(filePath)), path.basename(filePath)
23
+ + '_' + Config_1.Config.MetaFile.GPXCompressing.minDistance + 'm' +
24
+ Config_1.Config.MetaFile.GPXCompressing.minTimeDistance + 'ms' +
25
+ Config_1.Config.MetaFile.GPXCompressing.maxMiddleDeviance + 'm' +
26
+ path.extname(filePath));
27
+ }
28
+ static async isValidConvertedPath(convertedPath) {
29
+ const origFilePath = path.join(ProjectPath_1.ProjectPath.ImageFolder, path.relative(ProjectPath_1.ProjectPath.TranscodedFolder, convertedPath.substring(0, convertedPath.lastIndexOf('_'))));
30
+ try {
31
+ await node_fs_1.promises.access(origFilePath, node_fs_1.constants.R_OK);
32
+ }
33
+ catch {
34
+ return false;
35
+ }
36
+ return true;
37
+ }
38
+ static async compressedGPXExist(filePath) {
39
+ // compressed gpx path
40
+ const outPath = GPXProcessing.generateConvertedPath(filePath);
41
+ // check if file already exist
42
+ try {
43
+ await node_fs_1.promises.access(outPath, node_fs_1.constants.R_OK);
44
+ return true;
45
+ }
46
+ catch {
47
+ // ignoring errors
48
+ }
49
+ return false;
50
+ }
51
+ static async compressGPX(filePath) {
52
+ // generate compressed gpx path
53
+ const outPath = GPXProcessing.generateConvertedPath(filePath);
54
+ // check if file already exist
55
+ try {
56
+ await node_fs_1.promises.access(outPath, node_fs_1.constants.R_OK);
57
+ return outPath;
58
+ }
59
+ catch {
60
+ // ignoring errors
61
+ }
62
+ const outDir = path.dirname(outPath);
63
+ await node_fs_1.promises.mkdir(outDir, { recursive: true });
64
+ const gpxStr = await node_fs_1.promises.readFile(filePath);
65
+ const gpxObj = await (new xml2js.Parser()).parseStringPromise(gpxStr);
66
+ if (gpxObj.gpx?.trk?.[0].trkseg[0]) { // only compress paths if there is any
67
+ const distance = (entry1, entry2) => {
68
+ const lat1 = parseFloat(entry1.$.lat);
69
+ const lon1 = parseFloat(entry1.$.lon);
70
+ const lat2 = parseFloat(entry2.$.lat);
71
+ const lon2 = parseFloat(entry2.$.lon);
72
+ // credits to: https://www.movable-type.co.uk/scripts/latlong.html
73
+ const R = 6371e3; // metres
74
+ const φ1 = lat1 * Math.PI / 180; // φ, λ in radians
75
+ const φ2 = lat2 * Math.PI / 180;
76
+ const Δφ = (lat2 - lat1) * Math.PI / 180;
77
+ const Δλ = (lon2 - lon1) * Math.PI / 180;
78
+ const a = Math.sin(Δφ / 2) * Math.sin(Δφ / 2) +
79
+ Math.cos(φ1) * Math.cos(φ2) *
80
+ Math.sin(Δλ / 2) * Math.sin(Δλ / 2);
81
+ const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
82
+ const d = R * c; // in metres
83
+ return d;
84
+ };
85
+ const gpxEntryFilter = (value, i, list) => {
86
+ if (i === 0 || i >= list.length - 1) { // always keep the first and last items
87
+ return true;
88
+ }
89
+ const timeDelta = (Date.parse(list[i]?.time?.[0] ?? '') - Date.parse(list[i - 1]?.time?.[0] ?? '')); // mill sec.
90
+ const dist = distance(list[i - 1], list[i]); // meters
91
+ // if time is not available, consider it as all points are created the same time
92
+ return !((isNaN(timeDelta) || timeDelta < Config_1.Config.MetaFile.GPXCompressing.minTimeDistance) &&
93
+ dist < Config_1.Config.MetaFile.GPXCompressing.minDistance);
94
+ };
95
+ const postFilter = (i, list) => {
96
+ if (i === 0 || i >= list.length - 1) { // always keep the first and last items
97
+ return true;
98
+ }
99
+ /* if point on the same line that the next and prev point would draw, lets skip it*/
100
+ const avg = (a, b) => ((parseFloat(a) + parseFloat(b)) / 2).toFixed(this.GPX_FLOAT_ACCURACY);
101
+ const modPoint = {
102
+ $: {
103
+ lat: avg(list[i - 1].$.lat, list[i + 1].$.lat),
104
+ lon: avg(list[i - 1].$.lon, list[i + 1].$.lon)
105
+ }
106
+ };
107
+ if (list[i].time) {
108
+ modPoint.time = list[i].time;
109
+ }
110
+ const deviation = distance(modPoint, list[i]); // meters
111
+ return !(deviation < Config_1.Config.MetaFile.GPXCompressing.maxMiddleDeviance); // keep if deviation is too big
112
+ };
113
+ for (let i = 0; i < gpxObj.gpx.trk.length; ++i) {
114
+ for (let j = 0; j < gpxObj.gpx.trk[0].trkseg.length; ++j) {
115
+ const trkseg = gpxObj.gpx.trk[i].trkseg[j];
116
+ trkseg.trkpt = trkseg.trkpt.filter(gpxEntryFilter).map((v) => {
117
+ v.$.lon = parseFloat(v.$.lon).toFixed(this.GPX_FLOAT_ACCURACY);
118
+ v.$.lat = parseFloat(v.$.lat).toFixed(this.GPX_FLOAT_ACCURACY);
119
+ delete v.ele;
120
+ delete v.extensions;
121
+ return v;
122
+ });
123
+ for (let i = 0; i < trkseg.trkpt.length; ++i) {
124
+ if (!postFilter(i, trkseg.trkpt)) {
125
+ trkseg.trkpt.splice(i, 1);
126
+ --i;
127
+ }
128
+ }
129
+ }
130
+ }
131
+ }
132
+ await node_fs_1.promises.writeFile(outPath, (new xml2js.Builder({ renderOpts: { pretty: false } })).buildObject(gpxObj));
133
+ return outPath;
134
+ }
135
+ }
136
+ exports.GPXProcessing = GPXProcessing;
@@ -4,12 +4,13 @@ import { PersonEntry } from '../../database/enitites/person/PersonEntry';
4
4
  import { SVGIconConfig } from '../../../../common/config/public/ClientConfig';
5
5
  export declare class PhotoProcessing {
6
6
  private static initDone;
7
- private static taskQue;
7
+ private static taskQueInstance;
8
+ private static get taskQue();
8
9
  private static readonly CONVERTED_EXTENSION;
9
10
  static init(): void;
10
11
  static generatePersonThumbnail(person: PersonEntry): Promise<string>;
11
12
  static generateConvertedPath(mediaPath: string, size: number): string;
12
- static generatePersonThumbnailPath(mediaPath: string, faceRegion: FaceRegion, size: number): string;
13
+ static generatePersonThumbnailPath(mediaPath: string, faceRegion: FaceRegion | undefined, size: number): string;
13
14
  /**
14
15
  * Tells if the path is valid with the current config
15
16
  * @param convertedPath