2017-07-15 20:27:12 +08:00
|
|
|
import {Injectable} from "@angular/core";
|
|
|
|
import {BehaviorSubject} from "rxjs/BehaviorSubject";
|
|
|
|
import {DatabaseType, IPrivateConfig, ThumbnailProcessingLib} from "../../../common/config/private/IPrivateConfig";
|
|
|
|
import {NetworkService} from "../model/network/network.service";
|
|
|
|
@Injectable()
|
|
|
|
export class SettingsService {
|
|
|
|
public settings: BehaviorSubject<IPrivateConfig>;
|
|
|
|
|
|
|
|
constructor(private _networkService: NetworkService) {
|
|
|
|
this.settings = new BehaviorSubject<IPrivateConfig>(<any>{
|
|
|
|
Client: {
|
|
|
|
Search: {
|
|
|
|
enabled: true,
|
|
|
|
autocompleteEnabled: true,
|
|
|
|
instantSearchEnabled: true
|
|
|
|
},
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public async getSettings(): Promise<void> {
|
|
|
|
this.settings.next(await <Promise<IPrivateConfig>>this._networkService.getJson("/settings"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|