pigallery2-extension-kit 3.1.0 → 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 (63) hide show
  1. package/README.md +3 -106
  2. package/REPOSITORY.md +1 -0
  3. package/lib/backend/exceptions/FileAlreadyExists.d.ts +4 -0
  4. package/lib/backend/middlewares/UploadMWs.d.ts +4 -0
  5. package/lib/backend/middlewares/user/OIDCAuthService.d.ts +7 -0
  6. package/lib/backend/model/ObjectManagers.d.ts +6 -2
  7. package/lib/backend/model/UploadManager.d.ts +9 -0
  8. package/lib/backend/model/database/IObjectManager.d.ts +2 -2
  9. package/lib/backend/model/database/PersonManager.d.ts +1 -1
  10. package/lib/backend/model/database/ProjectedCacheManager.d.ts +1 -0
  11. package/lib/backend/model/database/SearchManager.d.ts +1 -1
  12. package/lib/backend/model/extension/ExpressRouterWrapper.d.ts +2 -2
  13. package/lib/backend/model/extension/IExtension.d.ts +9 -2
  14. package/lib/backend/model/extension/UIExtension.d.ts +2 -2
  15. package/lib/backend/model/fileaccess/DiskManager.d.ts +2 -1
  16. package/lib/backend/routes/OIDCRouter.d.ts +7 -0
  17. package/lib/backend/routes/UploadRouter.d.ts +5 -0
  18. package/lib/common/DataStructureVersion.d.ts +1 -1
  19. package/lib/common/PG2ConfMap.d.ts +1 -0
  20. package/lib/common/QueryParams.d.ts +10 -1
  21. package/lib/common/SearchQueryParser.d.ts +11 -10
  22. package/lib/common/SearchQueryUtils.d.ts +13 -2
  23. package/lib/common/Utils.d.ts +7 -5
  24. package/lib/common/Utils.js +55 -19
  25. package/lib/common/config/private/PrivateConfig.d.ts +16 -1
  26. package/lib/common/config/private/PrivateConfig.js +161 -5
  27. package/lib/common/config/public/ClientConfig.d.ts +22 -1
  28. package/lib/common/config/public/ClientConfig.js +145 -5
  29. package/lib/common/entities/AutoCompleteItem.d.ts +3 -3
  30. package/lib/common/entities/AutoCompleteItem.js +3 -3
  31. package/lib/common/entities/Error.d.ts +2 -1
  32. package/lib/common/entities/Error.js +1 -0
  33. package/lib/common/entities/SearchQueryDTO.d.ts +24 -41
  34. package/lib/common/entities/SearchQueryDTO.js +10 -19
  35. package/lib/common/entities/SortingMethods.d.ts +8 -0
  36. package/lib/common/entities/SortingMethods.js +10 -1
  37. package/lib/frontend/app/model/network/network.service.d.ts +4 -1
  38. package/lib/frontend/app/model/page.helper.d.ts +3 -2
  39. package/lib/frontend/app/model/query.service.d.ts +1 -0
  40. package/lib/frontend/app/ui/faces/faces.component.d.ts +1 -1
  41. package/lib/frontend/app/ui/faces/faces.service.d.ts +4 -0
  42. package/lib/frontend/app/ui/faces/navigator/navigator.faces.component.d.ts +15 -0
  43. package/lib/frontend/app/ui/frame/frame.component.d.ts +5 -2
  44. package/lib/frontend/app/ui/gallery/blog/blog.service.d.ts +1 -0
  45. package/lib/frontend/app/ui/gallery/contentLoader.service.d.ts +2 -1
  46. package/lib/frontend/app/ui/gallery/gallery.component.d.ts +12 -4
  47. package/lib/frontend/app/ui/gallery/grid/grid.gallery.component.d.ts +3 -1
  48. package/lib/frontend/app/ui/gallery/lightbox/controls/controls.lightbox.gallery.component.d.ts +0 -1
  49. package/lib/frontend/app/ui/gallery/lightbox/lightbox.service.d.ts +18 -0
  50. package/lib/frontend/app/ui/gallery/lightbox/media/media.lightbox.gallery.component.d.ts +5 -2
  51. package/lib/frontend/app/ui/gallery/map/lightbox/lightbox.map.gallery.component.d.ts +18 -12
  52. package/lib/frontend/app/ui/gallery/map/map.gallery.component.d.ts +5 -1
  53. package/lib/frontend/app/ui/gallery/overlay.service.d.ts +2 -2
  54. package/lib/frontend/app/ui/gallery/photo-frame-builder/photo-frame-builder.gallery.component.d.ts +9 -0
  55. package/lib/frontend/app/ui/gallery/search/autocomplete.service.d.ts +1 -1
  56. package/lib/frontend/app/ui/gallery/search/query-enrty/query-entry.search.gallery.component.d.ts +2 -1
  57. package/lib/frontend/app/ui/gallery/search/search-query-parser.service.d.ts +0 -2
  58. package/lib/frontend/app/ui/gallery/thumbnailManager.service.d.ts +1 -1
  59. package/lib/frontend/app/ui/gallery/uploader/uploader.gallery.component.d.ts +15 -0
  60. package/lib/frontend/app/ui/gallery/uploader/uploader.service.d.ts +36 -0
  61. package/lib/frontend/app/ui/login/login.component.d.ts +3 -0
  62. package/lib/frontend/app/ui/settings/template/template.component.d.ts +1 -0
  63. 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
@@ -9,4 +9,5 @@ In case of any issue, contact the extension developer.
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
  | | | | | |
@@ -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
+ }
@@ -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
+ }
@@ -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
  }
@@ -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
  */
@@ -23,6 +23,7 @@ export declare class ProjectedCacheManager implements IObjectManager {
23
23
  path: string;
24
24
  }): Promise<ProjectedDirectoryCacheEntity>;
25
25
  setAndGetCacheForAlbum(connection: Connection, session: SessionContext, album: {
26
+ name: string;
26
27
  id: number;
27
28
  searchQuery: any;
28
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;
@@ -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: {
@@ -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,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 = 40;
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,20 +13,29 @@ 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
20
  sharingKey_query: string;
18
21
  sharingKey_params: string;
19
22
  directory: string;
20
23
  knownLastModified: string;
21
24
  knownLastScanned: string;
22
- fullscreen: string;
23
25
  lightbox: {
24
26
  playback: string;
25
27
  captionAlwaysOn: string;
28
+ controllersDimmed: string;
26
29
  facesAlwaysOn: string;
27
30
  loopVideos: string;
28
31
  loopSlideshow: string;
29
32
  slideshowSpeed: string;
33
+ titles: {
34
+ topLeftTitle: string;
35
+ topLeftSubTitle: string;
36
+ bottomLeftTitle: string;
37
+ bottomLeftSubTitle: string;
38
+ };
30
39
  };
31
40
  autoPollInterval: string;
32
41
  };
@@ -13,18 +13,14 @@ export interface QueryKeywords {
13
13
  landscape: string;
14
14
  orientation: string;
15
15
  kmFrom: string;
16
- maxResolution: string;
17
- minResolution: string;
18
- maxRating: string;
19
- minRating: string;
20
- maxPersonCount: string;
21
- minPersonCount: string;
16
+ resolution: string;
17
+ rating: string;
18
+ personCount: string;
22
19
  NSomeOf: string;
23
20
  someOf: string;
24
21
  or: string;
25
22
  and: string;
26
- from: string;
27
- to: string;
23
+ date: string;
28
24
  any_text: string;
29
25
  caption: string;
30
26
  directory: string;
@@ -39,9 +35,14 @@ export declare class SearchQueryParser {
39
35
  constructor(keywords?: QueryKeywords);
40
36
  static stringifyText(text: string, matchType?: TextSearchQueryMatchTypes): string;
41
37
  static stringifyDate(time: number): string;
42
- private static parseDate;
43
38
  static humanToRegexpStr(str: string): string;
39
+ /**
40
+ * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date.
41
+ * @param text
42
+ * @private
43
+ */
44
+ private static parseDate;
44
45
  parse(str: string, implicitAND?: boolean): SearchQueryDTO;
45
46
  stringify(query: SearchQueryDTO): string;
46
- private stringifyOnEntry;
47
+ private stringifyOneEntry;
47
48
  }
@@ -4,6 +4,17 @@ export declare const SearchQueryUtils: {
4
4
  sortQuery(queryIN: SearchQueryDTO): SearchQueryDTO;
5
5
  stringifyForComparison(queryIN: SearchQueryDTO): string;
6
6
  isQueryEmpty(query: SearchQueryDTO): boolean;
7
- stripFalseNegate: (val: any) => any;
8
- validateSearchQuery(query: SearchQueryDTO, what?: string): void;
7
+ stripDefault: (val: any) => any;
8
+ validateSearchQuery: (query: SearchQueryDTO, what?: string) => void;
9
+ URLMap: Record<string, string>;
10
+ /**
11
+ * Make the SearchQuery URL friendly and shorter
12
+ * @param query
13
+ */
14
+ urlify: (query: SearchQueryDTO) => string;
15
+ /**
16
+ * Pareses the shortened urls and returns with the original SearchQueryDTO
17
+ * @param urlQuery
18
+ */
19
+ parseURLifiedQuery: (urlQuery: string) => SearchQueryDTO;
9
20
  };
@@ -34,11 +34,6 @@ export declare class Utils {
34
34
  static updateKeys(targetObject: any, sourceObject: any): void;
35
35
  static setKeys(targetObject: any, sourceObject: any): void;
36
36
  static setKeysForced(targetObject: any, sourceObject: any): void;
37
- static isValidEnumInt(EnumType: any, value: number): boolean;
38
- static enumToArray(EnumType: any): {
39
- key: number;
40
- value: string;
41
- }[];
42
37
  static findClosest(num: number, arr: number[]): number;
43
38
  static findClosestinSorted(num: number, arr: number[]): number;
44
39
  static asciiToUTF8(text: string): string;
@@ -49,6 +44,13 @@ export declare class Utils {
49
44
  static getAnyX(num: number, arr: any[], start?: number): any[][];
50
45
  static xmpExifGpsCoordinateToDecimalDegrees(text: string): number;
51
46
  static sortableFilename(filename: string): string;
47
+ static enumToArray(EnumType: any): {
48
+ key: number;
49
+ value: string;
50
+ }[];
51
+ static isValidEnumInt(EnumType: any, value: number): boolean;
52
+ static parseEnumArray<T extends Record<string, number>>(param: string | string[], enumType: T): number[];
53
+ static serializeEnumNames(values: number[], enumType: Record<number, string>): string;
52
54
  }
53
55
  export declare class LRU<V> {
54
56
  readonly size: number;
@@ -354,25 +354,6 @@ class Utils {
354
354
  }
355
355
  });
356
356
  }
357
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
358
- static isValidEnumInt(EnumType, value) {
359
- return typeof EnumType[value] === 'string';
360
- }
361
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
362
- static enumToArray(EnumType) {
363
- const arr = [];
364
- for (const enumMember in EnumType) {
365
- // eslint-disable-next-line no-prototype-builtins
366
- if (!EnumType.hasOwnProperty(enumMember)) {
367
- continue;
368
- }
369
- const key = parseInt(enumMember, 10);
370
- if (key >= 0) {
371
- arr.push({ key, value: EnumType[enumMember] });
372
- }
373
- }
374
- return arr;
375
- }
376
357
  static findClosest(num, arr) {
377
358
  let curr = arr[0];
378
359
  let diff = Math.abs(num - curr);
@@ -487,6 +468,61 @@ class Utils {
487
468
  // Fallback to the full name
488
469
  return filename;
489
470
  }
471
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
472
+ static enumToArray(EnumType) {
473
+ const arr = [];
474
+ for (const enumMember in EnumType) {
475
+ // eslint-disable-next-line no-prototype-builtins
476
+ if (!EnumType.hasOwnProperty(enumMember)) {
477
+ continue;
478
+ }
479
+ const key = parseInt(enumMember, 10);
480
+ if (key >= 0) {
481
+ arr.push({ key, value: EnumType[enumMember] });
482
+ }
483
+ }
484
+ return arr;
485
+ }
486
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
487
+ static isValidEnumInt(EnumType, value) {
488
+ return typeof EnumType[value] === 'string';
489
+ }
490
+ // Generic enum array parser: accepts comma-separated string or string[] and maps to enum numeric values
491
+ // IMPORTANT: Only string names are accepted; numeric values are ignored.
492
+ // Matching is case-insensitive. Invalid entries are ignored.
493
+ static parseEnumArray(param, enumType) {
494
+ const values = Array.isArray(param) ? param : String(param).split(',');
495
+ const out = [];
496
+ for (const raw of values) {
497
+ if (raw === undefined || raw === null || raw.trim() === '') {
498
+ continue;
499
+ }
500
+ const trimmed = raw.trim();
501
+ // try by name (case-insensitive)
502
+ const key = Object.keys(enumType).find(k => isNaN(Number(k)) && k.toLowerCase() === trimmed.toLowerCase());
503
+ if (key) {
504
+ const val = enumType[key];
505
+ if (typeof val === 'number') {
506
+ out.push(val);
507
+ }
508
+ }
509
+ }
510
+ return out;
511
+ }
512
+ // Serialize LightBoxTitleTexts values to a canonical comma-separated list of enum key names (lowercase)
513
+ static serializeEnumNames(values, enumType) {
514
+ if (!values || values.length === 0) {
515
+ return '';
516
+ }
517
+ const toName = (v) => {
518
+ const name = enumType[v];
519
+ return typeof name === 'string' ? name.toLowerCase() : '';
520
+ };
521
+ return values
522
+ .map(v => toName(v))
523
+ .filter(s => s && s.length > 0)
524
+ .join(',');
525
+ }
490
526
  }
491
527
  exports.Utils = Utils;
492
528
  class LRU {
@@ -1,6 +1,6 @@
1
1
  import 'reflect-metadata';
2
2
  import { AfterJobTrigger, JobScheduleDTO, JobTriggerType, NeverJobTrigger, PeriodicJobTrigger, ScheduledJobTrigger } from '../../entities/job/JobScheduleDTO';
3
- import { ClientConfig, ClientGPXCompressingConfig, ClientMediaConfig, ClientMetaFileConfig, ClientPhotoConfig, ClientServiceConfig, ClientSharingConfig, ClientSortingConfig, ClientUserConfig, ClientVideoConfig } from '../public/ClientConfig';
3
+ import { ClientConfig, ClientGPXCompressingConfig, ClientMediaConfig, ClientMetaFileConfig, ClientPhotoConfig, ClientServiceConfig, ClientSharingConfig, ClientSortingConfig, ClientUploadConfig, ClientUserConfig, ClientUserOIDCConfig, ClientVideoConfig } from '../public/ClientConfig';
4
4
  import { SearchQueryDTO } from '../../entities/SearchQueryDTO';
5
5
  import { UserRoles } from '../../entities/UserDTO';
6
6
  import { MediaPickDTO } from '../../entities/MediaPickDTO';
@@ -68,11 +68,23 @@ export declare class ServerDataBaseConfig {
68
68
  sqlite?: SQLiteConfig;
69
69
  mysql?: MySQLConfig;
70
70
  }
71
+ export declare class ServerUserOIDCConfig extends ClientUserOIDCConfig {
72
+ issuerUrl: string;
73
+ clientId: string;
74
+ clientSecret: string;
75
+ redirectUri: string;
76
+ scopes: string[];
77
+ usernameClaim: string;
78
+ emailClaim: string;
79
+ allowedDomains: string[];
80
+ autoCreateUser: boolean;
81
+ }
71
82
  export declare class ServerUserConfig extends ClientUserConfig {
72
83
  enforcedUsers: UserConfig[];
73
84
  allowQuery: SearchQueryDTO;
74
85
  blockQuery: SearchQueryDTO;
75
86
  suppressDefUserWarn: boolean;
87
+ oidc: ServerUserOIDCConfig;
76
88
  }
77
89
  export declare class ServerPhotoConfig extends ClientPhotoConfig {
78
90
  useLanczos3: boolean;
@@ -193,6 +205,8 @@ export declare class ServerEnvironmentConfig {
193
205
  buildCommitHash: string | undefined;
194
206
  isDocker: boolean | undefined;
195
207
  }
208
+ export declare class ServerUploadConfig extends ClientUploadConfig {
209
+ }
196
210
  export declare class ServerConfig extends ClientConfig {
197
211
  Environment: ServerEnvironmentConfig;
198
212
  Server: ServerServiceConfig;
@@ -206,5 +220,6 @@ export declare class ServerConfig extends ClientConfig {
206
220
  Duplicates: ServerDuplicatesConfig;
207
221
  Messaging: MessagingConfig;
208
222
  Extensions: ServerExtensionsConfig;
223
+ Upload: ServerUploadConfig;
209
224
  Jobs: ServerJobConfig;
210
225
  }