1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2025-01-14 14:43:17 +08:00
pigallery2/frontend/app/ui/settings/settings.service.ts

131 lines
3.5 KiB
TypeScript
Raw Normal View History

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';
import {
DatabaseType,
IPrivateConfig,
LogLevel,
ReIndexingSensitivity,
SQLLogLevel,
ThumbnailProcessingLib
} 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: {
appVersion: '',
2017-07-15 14:27:12 +02:00
Search: {
enabled: true,
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: {
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,
mapProvider: ClientConfig.MapProviders.OpenStreetMap,
2018-12-08 11:28:56 +01:00
mapboxAccessToken: '',
customLayers: [{name: 'street', url: ''}]
2017-07-15 16:09:48 +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
},
Other: {
captionFirstNaming: false,
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
},
urlBase: '',
2018-03-30 15:30:30 -04:00
publicUrl: '',
applicationTitle: '',
authenticationRequired: true,
unAuthenticatedUserRole: UserRoles.Admin,
languages: []
2017-07-15 16:09:48 +02:00
},
Server: {
2017-07-15 14:27:12 +02:00
database: {
type: DatabaseType.memory
},
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
},
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
}
}