2016-07-16 03:54:37 +08:00
|
|
|
import ko from 'ko';
|
|
|
|
|
2020-08-07 00:24:46 +08:00
|
|
|
import { settingsSaveHelperSimpleFunction } from 'Common/Utils';
|
2016-07-16 03:54:37 +08:00
|
|
|
|
2020-09-15 01:40:56 +08:00
|
|
|
import Remote from 'Remote/Admin/Fetch';
|
2016-08-24 06:17:50 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
class BrandingAdminSettings {
|
2016-07-16 05:29:42 +08:00
|
|
|
constructor() {
|
2020-09-04 18:05:17 +08:00
|
|
|
const settingsGet = rl.settings.get;
|
2016-07-16 05:29:42 +08:00
|
|
|
this.title = ko.observable(settingsGet('Title')).idleTrigger();
|
|
|
|
this.loadingDesc = ko.observable(settingsGet('LoadingDescription')).idleTrigger();
|
|
|
|
this.faviconUrl = ko.observable(settingsGet('FaviconUrl')).idleTrigger();
|
|
|
|
this.loginLogo = ko.observable(settingsGet('LoginLogo') || '').idleTrigger();
|
|
|
|
this.loginBackground = ko.observable(settingsGet('LoginBackground') || '').idleTrigger();
|
|
|
|
this.userLogo = ko.observable(settingsGet('UserLogo') || '').idleTrigger();
|
|
|
|
this.userLogoMessage = ko.observable(settingsGet('UserLogoMessage') || '').idleTrigger();
|
|
|
|
this.userIframeMessage = ko.observable(settingsGet('UserIframeMessage') || '').idleTrigger();
|
|
|
|
this.userLogoTitle = ko.observable(settingsGet('UserLogoTitle') || '').idleTrigger();
|
|
|
|
this.loginDescription = ko.observable(settingsGet('LoginDescription')).idleTrigger();
|
|
|
|
this.loginCss = ko.observable(settingsGet('LoginCss')).idleTrigger();
|
|
|
|
this.userCss = ko.observable(settingsGet('UserCss')).idleTrigger();
|
2016-07-16 03:54:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
onBuild() {
|
2020-07-23 02:28:25 +08:00
|
|
|
setTimeout(() => {
|
2019-07-05 03:19:24 +08:00
|
|
|
const f1 = settingsSaveHelperSimpleFunction(this.title.trigger, this),
|
2016-07-16 03:54:37 +08:00
|
|
|
f2 = settingsSaveHelperSimpleFunction(this.loadingDesc.trigger, this),
|
|
|
|
f3 = settingsSaveHelperSimpleFunction(this.faviconUrl.trigger, this);
|
|
|
|
|
|
|
|
this.title.subscribe((value) => {
|
|
|
|
Remote.saveAdminConfig(f1, {
|
2020-08-07 00:24:46 +08:00
|
|
|
'Title': value.trim()
|
2016-07-16 03:54:37 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
this.loadingDesc.subscribe((value) => {
|
|
|
|
Remote.saveAdminConfig(f2, {
|
2020-08-07 00:24:46 +08:00
|
|
|
'LoadingDescription': value.trim()
|
2016-07-16 03:54:37 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
this.faviconUrl.subscribe((value) => {
|
|
|
|
Remote.saveAdminConfig(f3, {
|
2020-08-07 00:24:46 +08:00
|
|
|
'FaviconUrl': value.trim()
|
2016-07-16 03:54:37 +08:00
|
|
|
});
|
|
|
|
});
|
2020-08-14 04:58:41 +08:00
|
|
|
}, 50);
|
2016-07-16 03:54:37 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
export { BrandingAdminSettings, BrandingAdminSettings as default };
|