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

78 lines
2.0 KiB
TypeScript
Raw Normal View History

2017-07-15 20:27:12 +08:00
import {Injectable} from "@angular/core";
import {BehaviorSubject} from "rxjs/BehaviorSubject";
2017-07-28 05:10:16 +08:00
import {
DatabaseType,
IPrivateConfig,
ReIndexingSensitivity,
ThumbnailProcessingLib
} from "../../../common/config/private/IPrivateConfig";
2017-07-15 20:27:12 +08:00
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,
googleApiKey: ""
2017-07-15 22:09:48 +08:00
},
publicUrl: "",
2017-07-15 20:27:12 +08:00
applicationTitle: "",
enableCache: true,
enableOnScrollRendering: true,
enableOnScrollThumbnailPrioritising: true,
authenticationRequired: true
2017-07-15 22:09:48 +08:00
},
Server: {
2017-07-15 20:27:12 +08:00
database: {
type: DatabaseType.memory
},
sharing: {
updateTimeout: 2000
},
2017-07-15 22:09:48 +08:00
imagesFolder: "",
2017-07-15 20:27:12 +08:00
enableThreading: true,
port: 80,
thumbnail: {
folder: "",
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> {
2017-07-15 20:27:12 +08:00
this.settings.next(await <Promise<IPrivateConfig>>this._networkService.getJson("/settings"));
}
}