pigallery2-extension-kit 3.0.1 → 3.5.0-dev.0

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 (98) hide show
  1. package/README.md +3 -106
  2. package/REPOSITORY.md +2 -1
  3. package/lib/backend/Logger.d.ts +1 -1
  4. package/lib/backend/ProjectPath.js +1 -1
  5. package/lib/backend/exceptions/FileAlreadyExists.d.ts +4 -0
  6. package/lib/backend/middlewares/UploadMWs.d.ts +4 -0
  7. package/lib/backend/middlewares/VersionMWs.d.ts +4 -0
  8. package/lib/backend/middlewares/user/OIDCAuthService.d.ts +7 -0
  9. package/lib/backend/model/ObjectManagers.d.ts +6 -2
  10. package/lib/backend/model/UploadManager.d.ts +9 -0
  11. package/lib/backend/model/database/AlbumManager.d.ts +1 -1
  12. package/lib/backend/model/database/CoverManager.d.ts +1 -1
  13. package/lib/backend/model/database/IObjectManager.d.ts +2 -2
  14. package/lib/backend/model/database/IndexingManager.d.ts +1 -0
  15. package/lib/backend/model/database/PersonManager.d.ts +1 -1
  16. package/lib/backend/model/database/ProjectedCacheManager.d.ts +4 -0
  17. package/lib/backend/model/database/SearchManager.d.ts +1 -1
  18. package/lib/backend/model/extension/ExpressRouterWrapper.d.ts +2 -2
  19. package/lib/backend/model/extension/ExtensionRepository.d.ts +1 -0
  20. package/lib/backend/model/extension/IExtension.d.ts +9 -2
  21. package/lib/backend/model/extension/UIExtension.d.ts +2 -2
  22. package/lib/backend/model/fileaccess/DiskManager.d.ts +2 -1
  23. package/lib/backend/model/jobs/JobManager.d.ts +1 -1
  24. package/lib/backend/model/jobs/jobs/AlbumCoverFillingJob.d.ts +1 -0
  25. package/lib/backend/model/jobs/jobs/AlbumCoverResetJob.d.ts +1 -0
  26. package/lib/backend/model/jobs/jobs/AlbumResetJob.d.ts +1 -0
  27. package/lib/backend/model/jobs/jobs/FileJob.d.ts +1 -0
  28. package/lib/backend/model/jobs/jobs/GPXCompressionJob.d.ts +1 -0
  29. package/lib/backend/model/jobs/jobs/GPXCompressionResetJob.d.ts +1 -0
  30. package/lib/backend/model/jobs/jobs/GalleryResetJob.d.ts +1 -0
  31. package/lib/backend/model/jobs/jobs/IndexingJob.d.ts +1 -0
  32. package/lib/backend/model/jobs/jobs/Job.d.ts +1 -0
  33. package/lib/backend/model/jobs/jobs/JobProgress.d.ts +2 -1
  34. package/lib/backend/model/jobs/jobs/PhotoConvertingJob.d.ts +1 -0
  35. package/lib/backend/model/jobs/jobs/TempFolderCleaningJob.d.ts +1 -0
  36. package/lib/backend/model/jobs/jobs/TopPickSendJob.d.ts +1 -0
  37. package/lib/backend/model/jobs/jobs/VideoConvertingJob.d.ts +1 -0
  38. package/lib/backend/routes/OIDCRouter.d.ts +7 -0
  39. package/lib/backend/routes/UploadRouter.d.ts +5 -0
  40. package/lib/common/CustomHeaders.d.ts +1 -0
  41. package/lib/common/DataStructureVersion.d.ts +1 -1
  42. package/lib/common/PG2ConfMap.d.ts +1 -0
  43. package/lib/common/QueryParams.d.ts +19 -1
  44. package/lib/common/SearchQueryParser.d.ts +11 -10
  45. package/lib/common/SearchQueryUtils.d.ts +13 -2
  46. package/lib/common/Utils.d.ts +7 -5
  47. package/lib/common/Utils.js +55 -19
  48. package/lib/common/config/private/Config.js +1 -0
  49. package/lib/common/config/private/PrivateConfig.d.ts +16 -1
  50. package/lib/common/config/private/PrivateConfig.js +161 -5
  51. package/lib/common/config/private/PrivateConfigClass.d.ts +2 -0
  52. package/lib/common/config/private/PrivateConfigClass.js +7 -0
  53. package/lib/common/config/public/ClientConfig.d.ts +34 -6
  54. package/lib/common/config/public/ClientConfig.js +239 -31
  55. package/lib/common/entities/AutoCompleteItem.d.ts +3 -3
  56. package/lib/common/entities/AutoCompleteItem.js +3 -3
  57. package/lib/common/entities/ContentWrapper.d.ts +38 -10
  58. package/lib/common/entities/ContentWrapper.js +171 -62
  59. package/lib/common/entities/Error.d.ts +2 -1
  60. package/lib/common/entities/Error.js +1 -0
  61. package/lib/common/entities/MediaDTO.d.ts +1 -0
  62. package/lib/common/entities/MediaDTO.js +6 -1
  63. package/lib/common/entities/SearchQueryDTO.d.ts +24 -41
  64. package/lib/common/entities/SearchQueryDTO.js +10 -19
  65. package/lib/common/entities/SortingMethods.d.ts +8 -0
  66. package/lib/common/entities/SortingMethods.js +10 -1
  67. package/lib/frontend/app/model/network/network.service.d.ts +4 -1
  68. package/lib/frontend/app/model/page.helper.d.ts +3 -2
  69. package/lib/frontend/app/model/query.service.d.ts +1 -1
  70. package/lib/frontend/app/model/version.service.d.ts +5 -1
  71. package/lib/frontend/app/ui/faces/faces.component.d.ts +1 -1
  72. package/lib/frontend/app/ui/faces/faces.service.d.ts +4 -0
  73. package/lib/frontend/app/ui/faces/navigator/navigator.faces.component.d.ts +15 -0
  74. package/lib/frontend/app/ui/frame/frame.component.d.ts +7 -2
  75. package/lib/frontend/app/ui/gallery/blog/blog.service.d.ts +1 -0
  76. package/lib/frontend/app/ui/gallery/cache.gallery.service.d.ts +5 -7
  77. package/lib/frontend/app/ui/gallery/contentLoader.service.d.ts +14 -11
  78. package/lib/frontend/app/ui/gallery/gallery.component.d.ts +12 -4
  79. package/lib/frontend/app/ui/gallery/gallery.service.d.ts +13 -0
  80. package/lib/frontend/app/ui/gallery/grid/grid.gallery.component.d.ts +4 -1
  81. package/lib/frontend/app/ui/gallery/lightbox/controls/controls.lightbox.gallery.component.d.ts +13 -20
  82. package/lib/frontend/app/ui/gallery/lightbox/lightbox.gallery.component.d.ts +1 -2
  83. package/lib/frontend/app/ui/gallery/lightbox/lightbox.service.d.ts +43 -4
  84. package/lib/frontend/app/ui/gallery/lightbox/media/media.lightbox.gallery.component.d.ts +5 -2
  85. package/lib/frontend/app/ui/gallery/map/lightbox/lightbox.map.gallery.component.d.ts +18 -12
  86. package/lib/frontend/app/ui/gallery/map/map.gallery.component.d.ts +5 -1
  87. package/lib/frontend/app/ui/gallery/navigator/navigator.service.d.ts +1 -0
  88. package/lib/frontend/app/ui/gallery/overlay.service.d.ts +2 -2
  89. package/lib/frontend/app/ui/gallery/photo-frame-builder/photo-frame-builder.gallery.component.d.ts +40 -0
  90. package/lib/frontend/app/ui/gallery/search/autocomplete.service.d.ts +1 -1
  91. package/lib/frontend/app/ui/gallery/search/query-enrty/query-entry.search.gallery.component.d.ts +2 -1
  92. package/lib/frontend/app/ui/gallery/search/search-query-parser.service.d.ts +0 -2
  93. package/lib/frontend/app/ui/gallery/thumbnailManager.service.d.ts +1 -1
  94. package/lib/frontend/app/ui/gallery/uploader/uploader.gallery.component.d.ts +15 -0
  95. package/lib/frontend/app/ui/gallery/uploader/uploader.service.d.ts +36 -0
  96. package/lib/frontend/app/ui/login/login.component.d.ts +3 -0
  97. package/lib/frontend/app/ui/settings/template/template.component.d.ts +1 -0
  98. package/package.json +1 -1
package/README.md CHANGED
@@ -1,108 +1,5 @@
1
- # pigallery2 Extension
1
+ # PiGallery2 Extension
2
2
 
3
- See feature issue for more information: [#743](https://github.com/bpatrik/pigallery2/issues/743).
3
+ This folder contains the core of the extension system.
4
4
 
5
- See sample extension at https://github.com/bpatrik/pigallery2-sample-extension.
6
-
7
- # Extension Usage
8
-
9
- Extension folder can be set through config. For the docker-ised version,
10
- they live under the `config/extension` folder in their own subdirectory.
11
-
12
- # Extension development
13
-
14
- ## Minimal setup
15
-
16
- You need at least a `server.js` in your extension folder that exports a `init(ext) {}` function.
17
-
18
- ## Recommended setup
19
-
20
- ```
21
- <path to the extension fodler>/myextension/package.js <- this is optional. You can add extra npm packages here
22
- <path to the extension fodler>/myextension/server.js <- this is needed
23
- ```
24
-
25
- Where `<path to the extension fodler>` is what you set in the config and `myextension` is the name of your extension.
26
- Note: you do not need to add your `node_modules` folder. The app will call `npm install` when initializing your extension.
27
-
28
- ## Extension environment
29
-
30
- The app runs the extension the following way:
31
-
32
- - It reads all extensions in `<path to the extension fodler>/**` folder
33
- - Checks if `package.js` is present. If yes installs the packages
34
- - Checks if `server.js` is present. If yes, calls the `init` function.
35
-
36
- ### Init and cleanup lifecycle
37
-
38
- There is also a `cleanUp` function that you can implement in your extension.
39
- The app can call your `init` and `cleanUp` functions any time.
40
- Always calls the `init` first then `cleanUp` later.
41
- Main use-case: `init` is called on app startup. `cleanUp` and `init` called later when there is a new config change.
42
-
43
- ## Extension interface
44
-
45
- The app calls the `init` and `cleanUp` function with a `IExtensionObject` object.
46
- See https://github.com/bpatrik/pigallery2/blob/master/src/backend/model/extension/IExtension.ts for details.
47
-
48
- `IExtensionObject` exposes lifecycle events, configs, RestAPis with some limitation.
49
- Changes made during the these public apis you do not need to clean up in the `cleanUp` function.
50
- App also exposes private `_app` object to provide access to low level API. Any changes made here needs clean up.
51
-
52
- ## server.js
53
-
54
- See sample server.js at https://github.com/bpatrik/pigallery2-sample-extension.
55
-
56
- It is recommended to do the development in `ts`, so creating a `server.ts`.
57
- Note: You need to manually transpile your `server.ts` file to `server.js` as the app does not do that for you.
58
- This doc assumes you do the development in `ts`.
59
-
60
- ### server.ts
61
-
62
- You can import package from both the main app package.json and from your extension package.json.
63
- To import packages from the main app, you import as usual.
64
- For packages from the extension, you always need to write relative path. i.e.: prefix with `./node_modules`
65
-
66
- ```ts
67
- // Including dev-kit interfaces. It is not necessary, only helps development with types.
68
- // You need to prefix them with ./node_modules
69
- import { IExtensionObject } from "./node_modules/pigallery2-extension-kit";
70
-
71
- // Including prod extension packages. You need to prefix them with ./node_modules
72
- // lodash does not have types
73
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
74
- // @ts-ignore
75
- import * as _ from "./node_modules/lodash";
76
-
77
- // Importing packages that are available in the main app (listed in the packages.json in pigallery2)
78
- import { Column, Entity, Index, PrimaryGeneratedColumn } from "typeorm";
79
- ```
80
-
81
- #### pigallery2 extension dev-kit
82
-
83
- It is recommended to use the `pigallery2-extension-kit` node package.
84
- `npm install pigallery2-extension-kit --save` to your extension.
85
-
86
- `pigallery2-extension-kit` contains the type definitions and enums for the app.
87
- This node package is basically includes the all definitions of the app and exports the `IExtensionObject` that the `init` function receives.
88
-
89
- You can then `import {IExtensionObject} from './node_modules/pigallery2-extension-kit';`
90
-
91
- See https://github.com/bpatrik/pigallery2/blob/master/src/backend/model/extension/IExtension.ts to understand what contains `IExtensionObject`.
92
-
93
- NOTE: this is not needed to create an extension it only helps your IDE and your development. These type definitions are removed when you compile `ts` to `js`.
94
-
95
- #### `init` function
96
-
97
- You need to implement the `init` function for a working extension:
98
-
99
- ```ts
100
- export const init = async (extension: IExtensionObject<void>): Promise<void> => {};
101
- ```
102
-
103
- #### pigallery2 lifecycle `events`
104
-
105
- Tha app exposes multiple interfaces for the extensions to interact with the main app. `events` are one of the main interfaces.
106
- Here are their flow:
107
-
108
- ![events_lifecycle](events.png)
5
+ For extension development and usage, please see the [documentation](https://bpatrik.github.io/pigallery2/development/extensions/).
package/REPOSITORY.md CHANGED
@@ -8,5 +8,6 @@ In case of any issue, contact the extension developer.
8
8
  |:----------------:|:-------------------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------:|---|
9
9
  | Sample extension | [pigallery2-sample-extension](https://github.com/bpatrik/pigallery2-sample-extension) | [REAMDE.md](https://raw.githubusercontent.com/bpatrik/pigallery2-sample-extension/main/README.md) | [main.zip](https://github.com/bpatrik/pigallery2-sample-extension/archive/refs/heads/main.zip) | |
10
10
  | DigiKam Connector for Pigallery2 | [pigallery2-extension-digikam-connector](https://github.com/mblythe86/pigallery2-extension-digikam-connector) | [README.md](https://raw.githubusercontent.com/mblythe86/pigallery2-extension-digikam-connector/main/README.md) | [main.zip](https://github.com/mblythe86/pigallery2-extension-digikam-connector/archive/refs/heads/main.zip) | |
11
- | | | | | |
11
+ | Grid Rating Overlay | [pigallery2-grid-rating-extension](https://github.com/Berschi/pigallery2-grid-rating-extension) | [README.md](https://raw.githubusercontent.com/Berschi/pigallery2-grid-rating-extension/refs/heads/main/README.md) | [main.zip](https://github.com/Berschi/pigallery2-grid-rating-extension/archive/refs/heads/main.zip) | |
12
+ | Trash | [pigallery2-trash-extension](https://github.com/pepa65/pigallery2-trash-extension) | [README.md](https://raw.githubusercontent.com/pepa65/pigallery2-trash-extension/refs/heads/main/README.md) | [main.zip](https://github.com/pepa65/pigallery2-trash-extension/archive/refs/heads/main.zip) | |
12
13
  | | | | | |
@@ -17,6 +17,6 @@ export declare class Logger {
17
17
  static info(...args: LoggerArgs[]): void;
18
18
  static warn(...args: LoggerArgs[]): void;
19
19
  static error(...args: LoggerArgs[]): void;
20
- private static log;
21
20
  static logLevelForError(e: ErrorCodes): LoggerFunction;
21
+ private static log;
22
22
  }
@@ -26,7 +26,7 @@ class ProjectPathClass {
26
26
  this.FacesFolder = path.join(this.TempFolder, 'f');
27
27
  this.DBFolder = this.getAbsolutePath(this.cfg.Database.dbFolder);
28
28
  this.ExtensionFolder = this.getAbsolutePath(this.cfg.Extensions.folder);
29
- // create thumbnail folder if not exist
29
+ // create the thumbnail folder if it does not exist
30
30
  if (!fs.existsSync(this.TempFolder)) {
31
31
  fs.mkdirSync(this.TempFolder);
32
32
  }
@@ -0,0 +1,4 @@
1
+ export declare class FileAlreadyExists extends Error {
2
+ filename: string;
3
+ constructor(message: string, filename: string);
4
+ }
@@ -0,0 +1,4 @@
1
+ import { NextFunction, Request, Response } from 'express';
2
+ export declare class UploadMWs {
3
+ static upload(req: Request, res: Response, next: NextFunction): Promise<void>;
4
+ }
@@ -1,5 +1,9 @@
1
1
  import { NextFunction, Request, Response } from 'express';
2
2
  export declare class VersionMWs {
3
+ /**
4
+ * This version data is mainly used to trigger page reload on the client side
5
+ */
6
+ static injectAppVersion(req: Request, res: Response, next: NextFunction): Promise<void>;
3
7
  /**
4
8
  * This version data is mainly used on the client side to invalidate the cache
5
9
  */
@@ -0,0 +1,7 @@
1
+ import { Request, Response } from 'express';
2
+ export declare class OIDCAuthService {
3
+ private static clientPromise;
4
+ static login(req: Request, res: Response): Promise<void>;
5
+ static callback(req: Request, res: Response): Promise<void>;
6
+ private static getClient;
7
+ }
@@ -1,6 +1,6 @@
1
1
  import { LocationManager } from './database/LocationManager';
2
2
  import { JobManager } from './jobs/JobManager';
3
- import { ParentDirectoryDTO } from '../../common/entities/DirectoryDTO';
3
+ import { DirectoryPathDTO } from '../../common/entities/DirectoryDTO';
4
4
  import { GalleryManager } from './database/GalleryManager';
5
5
  import { UserManager } from './database/UserManager';
6
6
  import { IndexingManager } from './database/IndexingManager';
@@ -13,6 +13,7 @@ import { SharingManager } from './database/SharingManager';
13
13
  import { ExtensionManager } from './extension/ExtensionManager';
14
14
  import { ProjectedCacheManager } from './database/ProjectedCacheManager';
15
15
  import { SessionManager } from './database/SessionManager';
16
+ import { UploadManager } from './UploadManager';
16
17
  export declare class ObjectManagers {
17
18
  private static instance;
18
19
  private readonly managers;
@@ -29,6 +30,7 @@ export declare class ObjectManagers {
29
30
  private albumManager;
30
31
  private extensionManager;
31
32
  private projectedCacheManager;
33
+ private uploadManager;
32
34
  private sessionManager;
33
35
  private initDone;
34
36
  constructor();
@@ -37,7 +39,7 @@ export declare class ObjectManagers {
37
39
  static isReady(): boolean;
38
40
  init(): Promise<void>;
39
41
  private initManagers;
40
- onDataChange(changedDir?: ParentDirectoryDTO): Promise<void>;
42
+ onDataChange(changedDir?: DirectoryPathDTO): Promise<void>;
41
43
  get VersionManager(): VersionManager;
42
44
  set VersionManager(value: VersionManager);
43
45
  get LocationManager(): LocationManager;
@@ -58,6 +60,8 @@ export declare class ObjectManagers {
58
60
  set SearchManager(value: SearchManager);
59
61
  get SharingManager(): SharingManager;
60
62
  set SharingManager(value: SharingManager);
63
+ get UploadManager(): UploadManager;
64
+ set UploadManager(value: UploadManager);
61
65
  get JobManager(): JobManager;
62
66
  set JobManager(value: JobManager);
63
67
  get ExtensionManager(): ExtensionManager;
@@ -0,0 +1,9 @@
1
+ export interface UploadError {
2
+ filename: string;
3
+ error: string;
4
+ }
5
+ export declare class UploadManager {
6
+ saveFiles(directory: string, files: Express.Multer.File[]): Promise<UploadError[]>;
7
+ saveFile(directory: string, file: Express.Multer.File): Promise<void>;
8
+ private isSupportedExtension;
9
+ }
@@ -6,8 +6,8 @@ export declare class AlbumManager extends ProjectionAwareManager<AlbumBaseEntity
6
6
  addIfNotExistSavedSearch(name: string, searchQuery: SearchQueryDTO, lockedAlbum: boolean): Promise<void>;
7
7
  addSavedSearch(name: string, searchQuery: SearchQueryDTO, lockedAlbum?: boolean): Promise<void>;
8
8
  deleteAlbum(id: number): Promise<void>;
9
+ deleteAll(): Promise<void>;
9
10
  protected loadEntities(session: SessionContext): Promise<AlbumBaseEntity[]>;
10
11
  protected invalidateDBCache(): Promise<void>;
11
- deleteAll(): Promise<void>;
12
12
  private updateAlbums;
13
13
  }
@@ -10,7 +10,7 @@ export declare class CoverManager {
10
10
  getCoverForAlbum(session: SessionContext, album: {
11
11
  searchQuery: SearchQueryDTO;
12
12
  }): Promise<CoverPhotoDTOWithID>;
13
- getPartialDirsWithoutCovers(): Promise<{
13
+ getPartialDirsWithoutCovers(projectionKeys?: string[]): Promise<{
14
14
  id: number;
15
15
  name: string;
16
16
  path: string;
@@ -1,6 +1,6 @@
1
- import { ParentDirectoryDTO } from '../../../common/entities/DirectoryDTO';
1
+ import { DirectoryPathDTO } from '../../../common/entities/DirectoryDTO';
2
2
  export interface IObjectManager {
3
- onNewDataVersion?: (changedDir?: ParentDirectoryDTO) => Promise<void>;
3
+ onNewDataVersion?: (changedDir?: DirectoryPathDTO) => Promise<void>;
4
4
  cleanUp?: () => Promise<void>;
5
5
  init?: () => Promise<void>;
6
6
  }
@@ -29,6 +29,7 @@ export declare class IndexingManager {
29
29
  name: string;
30
30
  mediaId: number;
31
31
  }[]): Promise<void>;
32
+ private checkSavingReady;
32
33
  private saveChunk;
33
34
  private insertChunk;
34
35
  }
@@ -4,7 +4,7 @@ import { ParentDirectoryDTO } from '../../../common/entities/DirectoryDTO';
4
4
  import { SessionContext } from '../SessionContext';
5
5
  import { ProjectionAwareManager } from './ProjectionAwareManager';
6
6
  export declare class PersonManager extends ProjectionAwareManager<PersonEntry> {
7
- updatePerson(name: string, partialPerson: PersonDTO): Promise<PersonEntry>;
7
+ updatePerson(name: string, partialPerson: PersonDTO): Promise<void>;
8
8
  /**
9
9
  * Used for statistic
10
10
  */
@@ -7,6 +7,9 @@ import { SessionContext } from '../SessionContext';
7
7
  export declare class ProjectedCacheManager implements IObjectManager {
8
8
  init(): Promise<void>;
9
9
  onNewDataVersion(changedDir?: ParentDirectoryDTO): Promise<void>;
10
+ /**
11
+ * Includes all possible projection keys, including the default one and sharing keys too.
12
+ */
10
13
  getAllProjections(): Promise<string[]>;
11
14
  cleanupNonExistingProjections(): Promise<void>;
12
15
  getCacheForDirectory(connection: Connection, session: SessionContext, dir: {
@@ -20,6 +23,7 @@ export declare class ProjectedCacheManager implements IObjectManager {
20
23
  path: string;
21
24
  }): Promise<ProjectedDirectoryCacheEntity>;
22
25
  setAndGetCacheForAlbum(connection: Connection, session: SessionContext, album: {
26
+ name: string;
23
27
  id: number;
24
28
  searchQuery: any;
25
29
  }): Promise<ProjectedAlbumCacheEntity>;
@@ -10,7 +10,7 @@ export declare class SearchManager {
10
10
  private queryIdBase;
11
11
  static setSorting<T>(query: SelectQueryBuilder<T>, sortings: SortingMethod[]): SelectQueryBuilder<T>;
12
12
  private static autoCompleteItemsUnique;
13
- autocomplete(session: SessionContext, text: string, type: SearchQueryTypes): Promise<AutoCompleteItem[]>;
13
+ autocomplete(session: SessionContext, value: string, type: SearchQueryTypes): Promise<AutoCompleteItem[]>;
14
14
  search(session: SessionContext, queryIN: SearchQueryDTO): Promise<SearchResultDTO>;
15
15
  getNMedia(session: SessionContext, query: SearchQueryDTO, sortings: SortingMethod[], take: number, photoOnly?: boolean): Promise<PhotoEntity[]>;
16
16
  getCount(session: SessionContext, query: SearchQueryDTO): Promise<number>;
@@ -2,7 +2,7 @@ import * as express from 'express';
2
2
  import { NextFunction, Request, Response } from 'express';
3
3
  import { UserDTO, UserRoles } from '../../../common/entities/UserDTO';
4
4
  import { ParamsDictionary } from 'express-serve-static-core';
5
- import { IExtensionRESTApi, IExtensionRESTRoute } from './IExtension';
5
+ import { IExtensionRESTApi, IExtensionRESTRoute, IMediaRequestBody } from './IExtension';
6
6
  import { ILogger } from '../../Logger';
7
7
  import { MediaEntity } from '../database/enitites/MediaEntity';
8
8
  import { Repository } from 'typeorm';
@@ -23,7 +23,7 @@ export declare class ExpressRouteWrapper implements IExtensionRESTRoute {
23
23
  private readonly func;
24
24
  private readonly extLogger;
25
25
  constructor(router: express.Router, name: string, func: 'get' | 'use' | 'put' | 'post' | 'delete', extLogger: ILogger);
26
- mediaJsonResponse(paths: string[], minRole: UserRoles, invalidateDirectory: boolean, cb: (params: ParamsDictionary, body: any, user: UserDTO, media: MediaEntity, repository: Repository<MediaEntity>) => Promise<unknown> | unknown): string;
26
+ mediaJsonResponse(paths: string[], minRole: UserRoles, invalidateDirectory: boolean, cb: (params: ParamsDictionary, body: IMediaRequestBody, user: UserDTO, media: MediaEntity, repository: Repository<MediaEntity>) => Promise<unknown> | unknown): string;
27
27
  jsonResponse(paths: string[], minRole: UserRoles, cb: (params?: ParamsDictionary, body?: any, user?: UserDTO) => Promise<unknown> | unknown): string;
28
28
  rawMiddleware(paths: string[], minRole: UserRoles, mw: (req: Request, res: Response, next: NextFunction) => void | Promise<void>): string;
29
29
  private getAuthMWs;
@@ -5,5 +5,6 @@ export declare class ExtensionRepository {
5
5
  private UPDATE_FREQUENCY_MS;
6
6
  getExtensionList(): Promise<ExtensionListItem[]>;
7
7
  private getUrlFromMDLink;
8
+ repoMD(text: string): ExtensionListItem[];
8
9
  fetchList(): Promise<ExtensionListItem[]>;
9
10
  }
@@ -122,6 +122,13 @@ export interface IExtensionApp {
122
122
  objectManagers: ObjectManagers;
123
123
  config: PrivateConfigClass;
124
124
  }
125
+ export interface IMediaRequestBody {
126
+ data: {
127
+ fields?: Record<string, any>;
128
+ customFields?: Record<string, any>;
129
+ };
130
+ media: string;
131
+ }
125
132
  export interface IExtensionRESTRoute {
126
133
  /**
127
134
  * Looks for req.body.media for the media path and calls the callback with that media entry.
@@ -133,7 +140,7 @@ export interface IExtensionRESTRoute {
133
140
  * @param cb function callback
134
141
  * @return newly added REST api path
135
142
  */
136
- mediaJsonResponse(paths: string[], minRole: UserRoles, invalidateDirectory: boolean, cb: (params: ParamsDictionary, body: any, user: UserDTO, media: MediaEntity, repository: Repository<MediaEntity>) => Promise<unknown> | unknown): string;
143
+ mediaJsonResponse(paths: string[], minRole: UserRoles, invalidateDirectory: boolean, cb: (params: ParamsDictionary, body: IMediaRequestBody, user: UserDTO, media: MediaEntity, repository: Repository<MediaEntity>) => Promise<unknown> | unknown): string;
137
144
  /**
138
145
  * Sends a pigallery2 standard JSON object with payload or error message back to the client.
139
146
  * @param paths RESTapi path, relative to the extension base endpoint
@@ -245,7 +252,7 @@ export interface IUIExtension<C> {
245
252
  * @param buttonConfig
246
253
  * @param serverSB If not set the button will be a fake button (i.e.: only show up not clickable)
247
254
  */
248
- addMediaButton(buttonConfig: IClientMediaButtonConfig, serverSB?: (params: ParamsDictionary, body: any, user: UserDTO, media: MediaEntity, repository: Repository<MediaEntity>) => Promise<void>): void;
255
+ addMediaButton(buttonConfig: IClientMediaButtonConfig, serverSB?: (params: ParamsDictionary, body: IMediaRequestBody, user: UserDTO, media: MediaEntity, repository: Repository<MediaEntity>) => Promise<void>): void;
249
256
  }
250
257
  export interface IExtensionConfigInit<C> {
251
258
  /**
@@ -3,11 +3,11 @@ import { IClientMediaButtonConfig } from '../../../common/entities/extension/ICl
3
3
  import { UserDTO } from '../../../common/entities/UserDTO';
4
4
  import { ParamsDictionary } from 'express-serve-static-core';
5
5
  import { MediaEntity } from '../database/enitites/MediaEntity';
6
- import { IUIExtension } from './IExtension';
6
+ import { IMediaRequestBody, IUIExtension } from './IExtension';
7
7
  import { Repository } from 'typeorm';
8
8
  export declare class UIExtension<C> implements IUIExtension<C> {
9
9
  private extensionObject;
10
10
  buttonConfigs: IClientMediaButtonConfig[];
11
11
  constructor(extensionObject: ExtensionObject<C>);
12
- addMediaButton(buttonConfig: IClientMediaButtonConfig, serverSB: (params: ParamsDictionary, body: any, user: UserDTO, media: MediaEntity, repository: Repository<MediaEntity>) => Promise<void>): void;
12
+ addMediaButton(buttonConfig: IClientMediaButtonConfig, serverSB: (params: ParamsDictionary, body: IMediaRequestBody, user: UserDTO, media: MediaEntity, repository: Repository<MediaEntity>) => Promise<void>): void;
13
13
  }
@@ -1,8 +1,9 @@
1
1
  import { Stats } from 'fs';
2
- import { ParentDirectoryDTO } from '../../../common/entities/DirectoryDTO';
2
+ import { DirectoryPathDTO, ParentDirectoryDTO } from '../../../common/entities/DirectoryDTO';
3
3
  import { FileDTO } from '../../../common/entities/FileDTO';
4
4
  export declare class DiskManager {
5
5
  static calcLastModified(stat: Stats): number;
6
+ static getDTOFromPath(relativeDirectoryName: string): DirectoryPathDTO;
6
7
  static normalizeDirPath(dirPath: string): string;
7
8
  static pathFromRelativeDirName(relativeDirectoryName: string): string;
8
9
  static pathFromParent(parent: {
@@ -11,9 +11,9 @@ export declare class JobManager implements IJobListener, IObjectManager {
11
11
  timer: NodeJS.Timeout;
12
12
  }[];
13
13
  protected progressManager: JobProgressManager;
14
- init(): Promise<void>;
15
14
  protected get JobRunning(): boolean;
16
15
  protected get JobNoParallelRunning(): boolean;
16
+ init(): Promise<void>;
17
17
  getProgresses(): {
18
18
  [id: string]: OnTimerJobProgressDTO;
19
19
  };
@@ -10,6 +10,7 @@ export declare class AlbumCoverFillingJob extends Job {
10
10
  }[];
11
11
  status: 'Persons' | 'Albums' | 'Directory';
12
12
  private availableSessions;
13
+ get LOG_TAG(): string;
13
14
  get Supported(): boolean;
14
15
  protected init(): Promise<void>;
15
16
  protected step(): Promise<boolean>;
@@ -4,6 +4,7 @@ export declare class AlbumCoverRestJob extends Job {
4
4
  readonly Name: string;
5
5
  readonly ConfigTemplate: DynamicConfig[];
6
6
  protected readonly IsInstant = true;
7
+ get LOG_TAG(): string;
7
8
  get Supported(): boolean;
8
9
  protected init(): Promise<void>;
9
10
  protected step(): Promise<boolean>;
@@ -4,6 +4,7 @@ export declare class AlbumRestJob extends Job {
4
4
  readonly Name: string;
5
5
  readonly ConfigTemplate: DynamicConfig[];
6
6
  protected readonly IsInstant = true;
7
+ get LOG_TAG(): string;
7
8
  get Supported(): boolean;
8
9
  protected init(): Promise<void>;
9
10
  protected step(): Promise<boolean>;
@@ -20,6 +20,7 @@ export declare abstract class FileJob<S extends {
20
20
  initiated: boolean;
21
21
  };
22
22
  protected constructor(scanFilter: DirectoryScanSettings);
23
+ get LOG_TAG(): string;
23
24
  protected init(): Promise<void>;
24
25
  protected filterMediaFiles(files: FileDTO[]): Promise<FileDTO[]>;
25
26
  protected filterMetaFiles(files: FileDTO[]): Promise<FileDTO[]>;
@@ -3,6 +3,7 @@ import { FileDTO } from '../../../../common/entities/FileDTO';
3
3
  export declare class GPXCompressionJob extends FileJob {
4
4
  readonly Name: string;
5
5
  constructor();
6
+ get LOG_TAG(): string;
6
7
  protected filterMetaFiles(files: FileDTO[]): Promise<FileDTO[]>;
7
8
  get Supported(): boolean;
8
9
  protected shouldProcess(fPath: string): Promise<boolean>;
@@ -5,4 +5,5 @@ import { TempFolderCleaningJob } from './TempFolderCleaningJob';
5
5
  export declare class GPXCompressionResetJob extends TempFolderCleaningJob {
6
6
  readonly Name: string;
7
7
  protected isValidFile(filePath: string): Promise<boolean>;
8
+ get LOG_TAG(): string;
8
9
  }
@@ -4,6 +4,7 @@ export declare class GalleryRestJob extends Job {
4
4
  readonly Name: string;
5
5
  readonly ConfigTemplate: DynamicConfig[];
6
6
  protected readonly IsInstant = true;
7
+ get LOG_TAG(): string;
7
8
  get Supported(): boolean;
8
9
  protected init(): Promise<void>;
9
10
  protected step(): Promise<boolean>;
@@ -8,6 +8,7 @@ export declare class IndexingJob<S extends {
8
8
  readonly Name: string;
9
9
  directoriesToIndex: string[];
10
10
  readonly ConfigTemplate: DynamicConfig[];
11
+ get LOG_TAG(): string;
11
12
  get Supported(): boolean;
12
13
  protected init(): Promise<void>;
13
14
  protected step(): Promise<boolean>;
@@ -12,6 +12,7 @@ export declare abstract class Job<T extends Record<string, unknown> = Record<str
12
12
  private jobListener;
13
13
  private soloRun;
14
14
  set JobListener(value: IJobListener);
15
+ get LOG_TAG(): string;
15
16
  abstract get Supported(): boolean;
16
17
  abstract get Name(): string;
17
18
  abstract get ConfigTemplate(): DynamicConfig[];
@@ -2,12 +2,13 @@ import { JobProgressDTO, JobProgressLogDTO, JobProgressStates } from '../../../.
2
2
  export declare class JobProgress {
3
3
  readonly jobName: string;
4
4
  readonly HashName: string;
5
+ readonly LOG_TAG: string;
5
6
  private steps;
6
7
  private state;
7
8
  private time;
8
9
  private logCounter;
9
10
  private logs;
10
- constructor(jobName: string, HashName: string);
11
+ constructor(jobName: string, HashName: string, LOG_TAG: string);
11
12
  set OnChange(val: (progress: JobProgress) => void);
12
13
  get Skipped(): number;
13
14
  set Skipped(value: number);
@@ -7,6 +7,7 @@ export declare class PhotoConvertingJob extends FileJob<{
7
7
  }> {
8
8
  readonly Name: string;
9
9
  constructor();
10
+ get LOG_TAG(): string;
10
11
  get Supported(): boolean;
11
12
  start(config: {
12
13
  sizes?: number[];
@@ -7,6 +7,7 @@ export declare class TempFolderCleaningJob extends Job {
7
7
  directoryQueue: string[];
8
8
  private tempRootCleaned;
9
9
  protected init(): Promise<void>;
10
+ get LOG_TAG(): string;
10
11
  protected isValidFile(filePath: string): Promise<boolean>;
11
12
  protected isValidDirectory(filePath: string): Promise<boolean>;
12
13
  protected readDir(dirPath: string): Promise<string[]>;
@@ -14,6 +14,7 @@ export declare class TopPickSendJob extends Job<{
14
14
  private status;
15
15
  private mediaList;
16
16
  constructor();
17
+ get LOG_TAG(): string;
17
18
  protected init(): Promise<void>;
18
19
  protected step(): Promise<boolean>;
19
20
  private stepListing;
@@ -2,6 +2,7 @@ import { FileJob } from './FileJob';
2
2
  export declare class VideoConvertingJob extends FileJob {
3
3
  readonly Name: string;
4
4
  constructor();
5
+ get LOG_TAG(): string;
5
6
  get Supported(): boolean;
6
7
  protected shouldProcess(mPath: string): Promise<boolean>;
7
8
  protected processFile(mPath: string): Promise<void>;
@@ -0,0 +1,7 @@
1
+ import { Express } from 'express';
2
+ export declare class OIDCRouter {
3
+ private static BASE;
4
+ static route(app: Express): void;
5
+ private static addLogin;
6
+ private static addCallback;
7
+ }
@@ -0,0 +1,5 @@
1
+ import * as express from 'express';
2
+ export declare class UploadRouter {
3
+ static route(app: express.Express): void;
4
+ private static addUpload;
5
+ }
@@ -1,3 +1,4 @@
1
1
  export declare class CustomHeaders {
2
2
  static dataVersion: string;
3
+ static appVersion: string;
3
4
  }
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * This version indicates that the sql/entities/*Entity.ts files got changed and the db needs to be recreated
3
3
  */
4
- export declare const DataStructureVersion = 39;
4
+ export declare const DataStructureVersion = 41;
@@ -5,6 +5,7 @@ import { SortingMethod } from './entities/SortingMethods';
5
5
  */
6
6
  export declare const PG2ConfMap: {
7
7
  sorting: Record<string, SortingMethod>;
8
+ upload: Record<string, boolean>;
8
9
  };
9
10
  /**
10
11
  * These files are processed on the server side,
@@ -13,12 +13,30 @@ export declare const QueryParams: {
13
13
  type: string;
14
14
  query: string;
15
15
  };
16
+ map: {
17
+ show: string;
18
+ };
16
19
  photo: string;
17
- playback: string;
18
20
  sharingKey_query: string;
19
21
  sharingKey_params: string;
20
22
  directory: string;
21
23
  knownLastModified: string;
22
24
  knownLastScanned: string;
25
+ lightbox: {
26
+ playback: string;
27
+ captionAlwaysOn: string;
28
+ controllersDimmed: string;
29
+ facesAlwaysOn: string;
30
+ loopVideos: string;
31
+ loopSlideshow: string;
32
+ slideshowSpeed: string;
33
+ titles: {
34
+ topLeftTitle: string;
35
+ topLeftSubTitle: string;
36
+ bottomLeftTitle: string;
37
+ bottomLeftSubTitle: string;
38
+ };
39
+ };
40
+ autoPollInterval: string;
23
41
  };
24
42
  };