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