pigallery2-extension-kit 3.0.0 → 3.0.1

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.
@@ -9,6 +9,11 @@ export declare class ProjectedCacheManager implements IObjectManager {
9
9
  onNewDataVersion(changedDir?: ParentDirectoryDTO): Promise<void>;
10
10
  getAllProjections(): Promise<string[]>;
11
11
  cleanupNonExistingProjections(): Promise<void>;
12
+ getCacheForDirectory(connection: Connection, session: SessionContext, dir: {
13
+ id: number;
14
+ name: string;
15
+ path: string;
16
+ }): Promise<ProjectedDirectoryCacheEntity>;
12
17
  setAndGetCacheForDirectory(connection: Connection, session: SessionContext, dir: {
13
18
  id: number;
14
19
  name: string;
@@ -9,4 +9,5 @@ export declare class UserManager {
9
9
  deleteUser(id: number): Promise<UserEntity>;
10
10
  changeRole(id: number, newRole: UserRoles): Promise<UserEntity>;
11
11
  updateSettings(id: number, settings: UserSettingsDTO): Promise<UserEntity>;
12
+ getUnAuthenticatedUser(): UserDTO;
12
13
  }
@@ -2,6 +2,7 @@ import { PrivateConfigClass } from '../../../common/config/private/PrivateConfig
2
2
  import { ClientAlbumConfig, ClientFacesConfig, ClientMapConfig, ClientMetaFileConfig, ClientPhotoConfig, ClientRandomPhotoConfig, ClientSearchConfig, ClientSharingConfig } from '../../../common/config/public/ClientConfig';
3
3
  import { ServerAlbumCoverConfig, ServerDataBaseConfig, ServerJobConfig, ServerPhotoConfig, ServerVideoConfig } from '../../../common/config/private/PrivateConfig';
4
4
  export declare class ConfigDiagnostics {
5
+ private static adjustConfigWarn;
5
6
  static testAlbumsConfig(albumConfig: ClientAlbumConfig, original: PrivateConfigClass): void;
6
7
  static checkReadWritePermission(path: string): Promise<void>;
7
8
  static testDatabase(databaseConfig: ServerDataBaseConfig): Promise<void>;
@@ -19,6 +19,8 @@ import { DirectoryScanSettings } from '../fileaccess/DiskManager';
19
19
  import { SessionContext } from '../SessionContext';
20
20
  import { IClientMediaButtonConfig } from '../../../common/entities/extension/IClientUIConfig';
21
21
  import { MediaEntity } from '../database/enitites/MediaEntity';
22
+ import { VideoConverterInput } from '../fileaccess/VideoConverterWorker';
23
+ import { ProjectedDirectoryCacheEntity } from '../database/enitites/ProjectedDirectoryCacheEntity';
22
24
  export type IExtensionBeforeEventHandler<I extends unknown[], O> = (input: I, event: {
23
25
  stopPropagation: boolean;
24
26
  }) => Promise<I | O>;
@@ -63,6 +65,25 @@ export interface IExtensionEvents {
63
65
  * Invalidates directory covers and caches for a given directory and every parent
64
66
  */
65
67
  invalidateDirectoryCache: IExtensionEvent<[ParentDirectoryDTO], void>;
68
+ /**
69
+ * Returns the projected directory cache for a given directory
70
+ * ProjectedDirectoryCacheEntity contains information, like the number of photos, videos, etc..
71
+ */
72
+ getCacheForDirectory: IExtensionEvent<[
73
+ connection: Connection,
74
+ session: SessionContext,
75
+ dir: {
76
+ id: number;
77
+ name: string;
78
+ path: string;
79
+ }
80
+ ], ProjectedDirectoryCacheEntity>;
81
+ };
82
+ VideoConverter: {
83
+ /**
84
+ * Converts videos with ffmpeg
85
+ */
86
+ convert: IExtensionEvent<[VideoConverterInput], void>;
66
87
  };
67
88
  ImageRenderer: {
68
89
  /**
@@ -1068,7 +1068,14 @@ tslib_1.__decorate([
1068
1068
  uiResetNeeded: { db: true },
1069
1069
  priority: ClientConfig_1.ConfigPriority.advanced
1070
1070
  },
1071
- description: $localize `If multiple cover is available sorts them by these methods and selects the first one.`,
1071
+ constraint: {
1072
+ assert: (v, c) => {
1073
+ // random should stand on its own
1074
+ return !Array.isArray(v) || v.filter((s) => s.method == SortingMethods_1.SortByTypes.Random).length == 0 || v.length == 1;
1075
+ },
1076
+ assertReason: 'Albums.Cover.Sorting config error: Random should stand on its own. You can\'t combine random with other sorting methods.',
1077
+ },
1078
+ description: $localize `If multiple cover is available sorts them by these methods and selects the first one. Using random sorting does not allow to use any other sorting method.`,
1072
1079
  }),
1073
1080
  tslib_1.__metadata("design:type", Array)
1074
1081
  ], ServerAlbumCoverConfig.prototype, "Sorting", void 0);
@@ -101,6 +101,7 @@ export declare class ClientAlbumConfig {
101
101
  export declare class ClientSharingConfig {
102
102
  enabled: boolean;
103
103
  passwordRequired: boolean;
104
+ sharingKeyLength: number;
104
105
  }
105
106
  export declare class ClientRandomPhotoConfig {
106
107
  enabled: boolean;
@@ -314,6 +314,7 @@ let ClientSharingConfig = class ClientSharingConfig {
314
314
  constructor() {
315
315
  this.enabled = true;
316
316
  this.passwordRequired = false;
317
+ this.sharingKeyLength = 8;
317
318
  }
318
319
  };
319
320
  exports.ClientSharingConfig = ClientSharingConfig;
@@ -337,6 +338,17 @@ tslib_1.__decorate([
337
338
  }),
338
339
  tslib_1.__metadata("design:type", Boolean)
339
340
  ], ClientSharingConfig.prototype, "passwordRequired", void 0);
341
+ tslib_1.__decorate([
342
+ (0, common_1.ConfigProperty)({
343
+ type: 'unsignedInt', min: 8, max: 64,
344
+ tags: {
345
+ name: $localize `Sharing key length`,
346
+ priority: ConfigPriority.underTheHood
347
+ },
348
+ description: $localize `The longer the keys are, the harder they are to guess. Changing this number won't invalidate existing sharing.`,
349
+ }),
350
+ tslib_1.__metadata("design:type", Number)
351
+ ], ClientSharingConfig.prototype, "sharingKeyLength", void 0);
340
352
  exports.ClientSharingConfig = ClientSharingConfig = tslib_1.__decorate([
341
353
  (0, common_1.SubConfigClass)({ tags: { client: true }, softReadonly: true })
342
354
  ], ClientSharingConfig);
@@ -14,6 +14,7 @@ export declare enum ErrorCodes {
14
14
  SERVER_ERROR = 36,
15
15
  USER_MANAGEMENT_DISABLED = 40,
16
16
  INPUT_ERROR = 50,
17
+ PATH_ERROR = 51,
17
18
  SETTINGS_ERROR = 60,
18
19
  TASK_ERROR = 61,
19
20
  JOB_ERROR = 62,
@@ -17,6 +17,7 @@ var ErrorCodes;
17
17
  ErrorCodes[ErrorCodes["SERVER_ERROR"] = 36] = "SERVER_ERROR";
18
18
  ErrorCodes[ErrorCodes["USER_MANAGEMENT_DISABLED"] = 40] = "USER_MANAGEMENT_DISABLED";
19
19
  ErrorCodes[ErrorCodes["INPUT_ERROR"] = 50] = "INPUT_ERROR";
20
+ ErrorCodes[ErrorCodes["PATH_ERROR"] = 51] = "PATH_ERROR";
20
21
  ErrorCodes[ErrorCodes["SETTINGS_ERROR"] = 60] = "SETTINGS_ERROR";
21
22
  ErrorCodes[ErrorCodes["TASK_ERROR"] = 61] = "TASK_ERROR";
22
23
  ErrorCodes[ErrorCodes["JOB_ERROR"] = 62] = "JOB_ERROR";
@@ -1,7 +1,9 @@
1
1
  import { OnInit } from '@angular/core';
2
2
  import { ControlValueAccessor, ValidationErrors, Validator } from '@angular/forms';
3
3
  import { SortingMethod } from '../../../../../../../common/entities/SortingMethods';
4
+ import { NotificationService } from '../../../../../model/notification.service';
4
5
  export declare class SortingMethodSettingsEntryComponent implements ControlValueAccessor, Validator, OnInit {
6
+ private notificationService;
5
7
  sortingByEnum: Record<string, number | string> & {
6
8
  [k: number]: string;
7
9
  };
@@ -10,6 +12,7 @@ export declare class SortingMethodSettingsEntryComponent implements ControlValue
10
12
  key: number;
11
13
  value: string;
12
14
  }[];
15
+ constructor(notificationService: NotificationService);
13
16
  ngOnInit(): void;
14
17
  onTouched(): void;
15
18
  writeValue(obj: SortingMethod): void;
@@ -17,9 +20,9 @@ export declare class SortingMethodSettingsEntryComponent implements ControlValue
17
20
  registerOnTouched(fn: () => void): void;
18
21
  onChange(): void;
19
22
  validate(): ValidationErrors;
20
- private propagateChange;
21
- private propagateTouch;
22
23
  isBidirectional(value: number): boolean;
23
24
  setSortingBy(key: number): void;
24
25
  setSortingAscending(ascending: boolean): void;
26
+ private propagateChange;
27
+ private propagateTouch;
25
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pigallery2-extension-kit",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Interfaces for developing extensions for pigallery2",
5
5
  "author": "Patrik J. Braun",
6
6
  "homepage": "https://github.com/bpatrik/pigallery2",