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

74 lines
2.1 KiB
TypeScript
Raw Normal View History

2018-03-31 03:30:30 +08:00
import {Injectable} from '@angular/core';
import {BehaviorSubject} from 'rxjs/BehaviorSubject';
import {DatabaseType, IPrivateConfig, ReIndexingSensitivity, ThumbnailProcessingLib} from '../../../common/config/private/IPrivateConfig';
import {NetworkService} from '../model/network/network.service';
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
},
2017-07-28 05:10:16 +08:00
concurrentThumbnailGenerations: null,
2017-07-15 20:27:12 +08:00
Thumbnail: {
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
},
2018-03-31 03:30:30 +08:00
publicUrl: '',
applicationTitle: '',
2017-07-15 20:27:12 +08:00
enableCache: true,
enableOnScrollRendering: true,
enableOnScrollThumbnailPrioritising: true,
authenticationRequired: true,
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
enableThreading: true,
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
},
sessionTimeout: 0,
indexing: {
cachedFolderTimeout: 0,
folderPreviewSize: 0,
reIndexingSensitivity: ReIndexingSensitivity.medium
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
}
}