1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/frontend/app/settings/settings.service.ts

97 lines
2.6 KiB
TypeScript
Raw Normal View History

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';
2018-03-31 03:30:30 +08:00
import {DatabaseType, IPrivateConfig, ReIndexingSensitivity, ThumbnailProcessingLib} from '../../../common/config/private/IPrivateConfig';
import {NetworkService} from '../model/network/network.service';
2018-05-29 02:03:12 +08:00
import {SortingMethods} from '../../../common/entities/SortingMethods';
import {UserRoles} from '../../../common/entities/UserDTO';
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: {
Search: {
enabled: true,
autocompleteEnabled: true,
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-30 05:39:06 +08:00
autocompleteCacheTimeout: 1000 * 60 * 60
2017-07-15 20:27:12 +08:00
},
Thumbnail: {
concurrentThumbnailGenerations: null,
2017-07-15 20:27:12 +08:00
iconSize: 30,
thumbnailSizes: []
},
Sharing: {
enabled: true,
passwordProtected: true
},
Map: {
enabled: true,
2018-03-31 03:30:30 +08:00
googleApiKey: ''
2017-07-15 22:09:48 +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
},
Other: {
enableCache: true,
enableOnScrollRendering: true,
enableOnScrollThumbnailPrioritising: true,
defaultPhotoSortingMethod: SortingMethods.ascDate,
NavBar: {
showItemCount: true
}
},
urlBase: '',
2018-03-31 03:30:30 +08:00
publicUrl: '',
applicationTitle: '',
authenticationRequired: true,
unAuthenticatedUserRole: UserRoles.Admin,
languages: []
2017-07-15 22:09:48 +08:00
},
Server: {
2017-07-15 20:27:12 +08:00
database: {
type: DatabaseType.memory
},
sharing: {
updateTimeout: 2000
},
2018-03-31 03:30:30 +08:00
imagesFolder: '',
2017-07-15 20:27:12 +08:00
port: 80,
thumbnail: {
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
},
threading: {
enable: true,
thumbnailThreads: 0
},
2017-07-28 05:10:16 +08:00
sessionTimeout: 0,
indexing: {
cachedFolderTimeout: 0,
folderPreviewSize: 0,
reIndexingSensitivity: ReIndexingSensitivity.medium
2018-12-04 20:52:49 +08:00
},
photoMetadataSize: 512 * 1024
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
}
}