2021-12-03 19:32:21 +08:00
|
|
|
import 'External/ko';
|
2015-11-19 01:32:29 +08:00
|
|
|
|
2021-03-10 18:44:48 +08:00
|
|
|
import { Settings, SettingsGet } from 'Common/Globals';
|
2022-10-04 16:04:41 +08:00
|
|
|
import { ThemeStore } from 'Stores/Theme';
|
2015-11-19 01:32:29 +08:00
|
|
|
|
2020-09-15 01:40:56 +08:00
|
|
|
import Remote from 'Remote/Admin/Fetch';
|
2015-11-19 01:32:29 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
import { SettingsAdminScreen } from 'Screen/Admin/Settings';
|
|
|
|
import { LoginAdminScreen } from 'Screen/Admin/Login';
|
2016-07-07 07:11:13 +08:00
|
|
|
|
2020-09-17 05:19:34 +08:00
|
|
|
import { startScreens } from 'Knoin/Knoin';
|
2019-07-05 03:19:24 +08:00
|
|
|
import { AbstractApp } from 'App/Abstract';
|
2015-11-19 01:32:29 +08:00
|
|
|
|
2022-03-31 23:39:53 +08:00
|
|
|
export class AdminApp extends AbstractApp {
|
2016-07-16 05:29:42 +08:00
|
|
|
constructor() {
|
2015-11-19 01:32:29 +08:00
|
|
|
super(Remote);
|
2021-03-16 21:15:05 +08:00
|
|
|
this.weakPassword = ko.observable(false);
|
2015-11-19 01:32:29 +08:00
|
|
|
}
|
|
|
|
|
2022-03-31 23:39:53 +08:00
|
|
|
refresh() {
|
2022-10-04 16:04:41 +08:00
|
|
|
ThemeStore.populate();
|
2022-03-31 23:39:53 +08:00
|
|
|
this.start();
|
|
|
|
}
|
|
|
|
|
2021-11-01 18:24:11 +08:00
|
|
|
start() {
|
2021-12-28 21:49:21 +08:00
|
|
|
if (!Settings.app('adminAllowed')) {
|
2020-09-17 02:35:29 +08:00
|
|
|
rl.route.root();
|
|
|
|
setTimeout(() => location.href = '/', 1);
|
2021-03-16 21:15:05 +08:00
|
|
|
} else if (SettingsGet('Auth')) {
|
|
|
|
this.weakPassword(!!SettingsGet('WeakPassword'));
|
|
|
|
startScreens([SettingsAdminScreen]);
|
2019-07-05 03:19:24 +08:00
|
|
|
} else {
|
2021-03-16 21:15:05 +08:00
|
|
|
startScreens([LoginAdminScreen]);
|
2015-11-19 01:32:29 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|