mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
reconcile boot and admin pages further (#963)
This adds some remaining parts of the boot page to the admin panel, and then removes the boot page.
This commit is contained in:
@@ -61,6 +61,18 @@ export class BaseAPI {
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
...options.headers
|
||||
};
|
||||
// If we are in the client, and have a boot key query parameter,
|
||||
// pass it on as a header to make it available for authentication.
|
||||
// This is a fallback mechanism if auth is broken to access the
|
||||
// admin panel.
|
||||
// TODO: should this be more selective?
|
||||
if (typeof window !== 'undefined' && window.location &&
|
||||
window.location.pathname.endsWith('/admin')) {
|
||||
const bootKey = new URLSearchParams(window.location.search).get('boot-key');
|
||||
if (bootKey) {
|
||||
this._headers['X-Boot-Key'] = bootKey;
|
||||
}
|
||||
}
|
||||
this._extraParameters = options.extraParameters;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,14 +7,18 @@ export type BootProbeIds =
|
||||
'host-header' |
|
||||
'sandboxing' |
|
||||
'system-user' |
|
||||
'authentication'
|
||||
'authentication' |
|
||||
'websockets'
|
||||
;
|
||||
|
||||
export interface BootProbeResult {
|
||||
verdict?: string;
|
||||
success?: boolean;
|
||||
done?: boolean;
|
||||
severity?: 'fault' | 'warning' | 'hmm';
|
||||
// Result of check.
|
||||
// "success" is a positive outcome.
|
||||
// "none" means no fault detected (but that the test is not exhaustive
|
||||
// enough to claim "success").
|
||||
// "fault" is a bad error, "warning" a ... warning, "hmm" almost a debug message.
|
||||
status: 'success' | 'fault' | 'warning' | 'hmm' | 'none';
|
||||
details?: Record<string, any>;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {BaseAPI, IOptions} from 'app/common/BaseAPI';
|
||||
import {BootProbeInfo, BootProbeResult} from 'app/common/BootProbe';
|
||||
import {InstallPrefs} from 'app/common/Install';
|
||||
import {TelemetryLevel} from 'app/common/Telemetry';
|
||||
import {addCurrentOrgToPath} from 'app/common/urlUtils';
|
||||
@@ -56,6 +57,8 @@ export interface InstallAPI {
|
||||
* Returns information about latest version of Grist
|
||||
*/
|
||||
checkUpdates(): Promise<LatestVersion>;
|
||||
getChecks(): Promise<{probes: BootProbeInfo[]}>;
|
||||
runCheck(id: string): Promise<BootProbeResult>;
|
||||
}
|
||||
|
||||
export class InstallAPIImpl extends BaseAPI implements InstallAPI {
|
||||
@@ -78,6 +81,14 @@ export class InstallAPIImpl extends BaseAPI implements InstallAPI {
|
||||
return this.requestJson(`${this._url}/api/install/updates`, {method: 'GET'});
|
||||
}
|
||||
|
||||
public getChecks(): Promise<{probes: BootProbeInfo[]}> {
|
||||
return this.requestJson(`${this._url}/api/probes`, {method: 'GET'});
|
||||
}
|
||||
|
||||
public runCheck(id: string): Promise<BootProbeResult> {
|
||||
return this.requestJson(`${this._url}/api/probes/${id}`, {method: 'GET'});
|
||||
}
|
||||
|
||||
private get _url(): string {
|
||||
return addCurrentOrgToPath(this._homeUrl);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user