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';
|
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: {
|
2018-11-02 23:24:37 +08:00
|
|
|
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
|
|
|
},
|
2018-10-22 06:24:17 +08:00
|
|
|
RandomPhoto: {
|
|
|
|
enabled: true
|
|
|
|
},
|
2018-11-19 03:26:29 +08:00
|
|
|
Video: {
|
|
|
|
enabled: true
|
|
|
|
},
|
2018-11-02 23:24:37 +08:00
|
|
|
Other: {
|
|
|
|
enableCache: true,
|
|
|
|
enableOnScrollRendering: true,
|
|
|
|
enableOnScrollThumbnailPrioritising: true,
|
|
|
|
defaultPhotoSortingMethod: SortingMethods.ascDate,
|
|
|
|
NavBar: {
|
|
|
|
showItemCount: true
|
|
|
|
}
|
|
|
|
},
|
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-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
|
|
|
|
},
|
|
|
|
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
|
|
|
},
|
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,
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|