2018-03-30 15:30:30 -04:00
|
|
|
import {Injectable} from '@angular/core';
|
2018-05-22 20:27:07 -04:00
|
|
|
import {BehaviorSubject} from 'rxjs';
|
2019-02-07 10:44:51 -05:00
|
|
|
import {
|
|
|
|
DatabaseType,
|
|
|
|
IPrivateConfig,
|
|
|
|
LogLevel,
|
|
|
|
ReIndexingSensitivity,
|
|
|
|
SQLLogLevel,
|
|
|
|
ThumbnailProcessingLib
|
2019-03-03 10:30:12 +01:00
|
|
|
} from '../../../../common/config/private/IPrivateConfig';
|
|
|
|
import {NetworkService} from '../../model/network/network.service';
|
|
|
|
import {SortingMethods} from '../../../../common/entities/SortingMethods';
|
|
|
|
import {UserRoles} from '../../../../common/entities/UserDTO';
|
|
|
|
import {ClientConfig} from '../../../../common/config/public/ConfigClass';
|
2017-07-27 23:10:16 +02:00
|
|
|
|
2017-07-15 14:27:12 +02:00
|
|
|
@Injectable()
|
|
|
|
export class SettingsService {
|
|
|
|
public settings: BehaviorSubject<IPrivateConfig>;
|
|
|
|
|
|
|
|
constructor(private _networkService: NetworkService) {
|
2017-07-27 23:10:16 +02:00
|
|
|
this.settings = new BehaviorSubject<IPrivateConfig>({
|
2017-07-15 14:27:12 +02:00
|
|
|
Client: {
|
2019-07-21 13:49:32 +02:00
|
|
|
appVersion: '',
|
2017-07-15 14:27:12 +02:00
|
|
|
Search: {
|
|
|
|
enabled: true,
|
2019-01-27 14:36:42 -05:00
|
|
|
AutoComplete: {
|
|
|
|
enabled: true,
|
|
|
|
cacheTimeout: 1000 * 60 * 60,
|
|
|
|
maxItemsPerCategory: 5
|
|
|
|
},
|
2017-07-27 23:10:16 +02:00
|
|
|
instantSearchEnabled: true,
|
2017-07-29 23:39:06 +02:00
|
|
|
InstantSearchTimeout: 0,
|
2017-07-30 09:06:12 +02:00
|
|
|
searchCacheTimeout: 1000 * 60 * 60,
|
|
|
|
instantSearchCacheTimeout: 1000 * 60 * 60,
|
2017-07-15 14:27:12 +02:00
|
|
|
},
|
|
|
|
Thumbnail: {
|
2018-11-02 16:24:37 +01:00
|
|
|
concurrentThumbnailGenerations: null,
|
2017-07-15 14:27:12 +02:00
|
|
|
iconSize: 30,
|
2019-02-14 18:25:55 -05:00
|
|
|
personThumbnailSize: 200,
|
2017-07-15 14:27:12 +02:00
|
|
|
thumbnailSizes: []
|
|
|
|
},
|
|
|
|
Sharing: {
|
|
|
|
enabled: true,
|
|
|
|
passwordProtected: true
|
|
|
|
},
|
|
|
|
Map: {
|
|
|
|
enabled: true,
|
2019-07-21 11:23:08 +02:00
|
|
|
useImageMarkers: true,
|
2018-12-07 22:06:13 +01:00
|
|
|
mapProvider: ClientConfig.MapProviders.OpenStreetMap,
|
2018-12-08 11:28:56 +01:00
|
|
|
mapboxAccessToken: '',
|
2019-07-20 19:52:47 +02:00
|
|
|
customLayers: [{name: 'street', url: ''}]
|
2017-07-15 16:09:48 +02:00
|
|
|
},
|
2018-10-22 00:24:17 +02:00
|
|
|
RandomPhoto: {
|
|
|
|
enabled: true
|
|
|
|
},
|
2018-11-18 20:26:29 +01:00
|
|
|
Video: {
|
|
|
|
enabled: true
|
|
|
|
},
|
2018-11-30 17:19:37 +01:00
|
|
|
MetaFile: {
|
|
|
|
enabled: true
|
|
|
|
},
|
2018-11-02 16:24:37 +01:00
|
|
|
Other: {
|
2018-12-06 13:50:55 +01:00
|
|
|
captionFirstNaming: false,
|
2018-11-02 16:24:37 +01:00
|
|
|
enableCache: true,
|
|
|
|
enableOnScrollRendering: true,
|
|
|
|
enableOnScrollThumbnailPrioritising: true,
|
|
|
|
defaultPhotoSortingMethod: SortingMethods.ascDate,
|
|
|
|
NavBar: {
|
|
|
|
showItemCount: true
|
|
|
|
}
|
|
|
|
},
|
2019-02-04 17:46:27 -05:00
|
|
|
Faces: {
|
|
|
|
enabled: true,
|
2019-03-03 21:17:42 +01:00
|
|
|
keywordsToPersons: true,
|
|
|
|
writeAccessMinRole: UserRoles.Admin
|
2019-02-04 17:46:27 -05:00
|
|
|
},
|
2018-05-12 12:19:51 -04:00
|
|
|
urlBase: '',
|
2018-03-30 15:30:30 -04:00
|
|
|
publicUrl: '',
|
|
|
|
applicationTitle: '',
|
2017-12-24 18:42:25 -05:00
|
|
|
authenticationRequired: true,
|
2018-12-04 22:08:13 +01:00
|
|
|
unAuthenticatedUserRole: UserRoles.Admin,
|
2018-11-02 16:24:37 +01:00
|
|
|
languages: []
|
2017-07-15 16:09:48 +02:00
|
|
|
},
|
|
|
|
Server: {
|
2017-07-15 14:27:12 +02:00
|
|
|
database: {
|
|
|
|
type: DatabaseType.memory
|
|
|
|
},
|
2019-02-07 10:44:51 -05:00
|
|
|
log: {
|
|
|
|
level: LogLevel.info,
|
|
|
|
sqlLevel: SQLLogLevel.error
|
|
|
|
},
|
2017-07-15 14:27:12 +02:00
|
|
|
sharing: {
|
|
|
|
updateTimeout: 2000
|
|
|
|
},
|
2018-03-30 15:30:30 -04:00
|
|
|
imagesFolder: '',
|
2019-01-19 00:18:20 +01:00
|
|
|
port: 80,
|
|
|
|
host: '0.0.0.0',
|
2017-07-15 14:27:12 +02:00
|
|
|
thumbnail: {
|
2019-02-14 18:25:55 -05:00
|
|
|
personFaceMargin: 0.1,
|
2018-03-30 15:30:30 -04:00
|
|
|
folder: '',
|
2017-07-15 14:27:12 +02:00
|
|
|
qualityPriority: true,
|
|
|
|
processingLibrary: ThumbnailProcessingLib.sharp
|
2017-07-27 23:10:16 +02:00
|
|
|
},
|
2018-11-02 16:24:37 +01:00
|
|
|
threading: {
|
|
|
|
enable: true,
|
|
|
|
thumbnailThreads: 0
|
|
|
|
},
|
2017-07-27 23:10:16 +02:00
|
|
|
sessionTimeout: 0,
|
|
|
|
indexing: {
|
|
|
|
cachedFolderTimeout: 0,
|
|
|
|
folderPreviewSize: 0,
|
|
|
|
reIndexingSensitivity: ReIndexingSensitivity.medium
|
2018-12-04 13:52:49 +01:00
|
|
|
},
|
2019-01-19 00:18:20 +01:00
|
|
|
photoMetadataSize: 512 * 1024,
|
|
|
|
duplicates: {
|
|
|
|
listingLimit: 1000
|
2019-07-27 22:56:12 +02:00
|
|
|
},
|
|
|
|
tasks: {
|
|
|
|
scheduled: []
|
2019-01-19 00:18:20 +01:00
|
|
|
}
|
2017-07-15 14:27:12 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-07-27 23:10:16 +02:00
|
|
|
public async getSettings(): Promise<void> {
|
2018-03-30 15:30:30 -04:00
|
|
|
this.settings.next(await <Promise<IPrivateConfig>>this._networkService.getJson('/settings'));
|
2017-07-15 14:27:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|