fix interpretation of useApi default

pull/850/head
Paul Fitzpatrick 4 months ago
parent 012b054af6
commit 35c51dd4f5
No known key found for this signature in database
GPG Key ID: 07F16BF3214888F6

@ -9,13 +9,16 @@ import { Disposable, dom, Observable, styled, UseCBOwner } from 'grainjs';
const cssBody = styled('div', `
padding: 20px;
overflow: auto;
max-width: 500px;
`);
const cssHeader = styled('div', `
padding: 20px;
`);
const cssResult = styled('div', `
max-width: 500px;
`);
/**
* A "boot" page for inspecting the state of the Grist installation.
* The page should ideally be visible even if a lot is wrong with the,
@ -98,7 +101,8 @@ export class Boot extends Disposable {
ob2.start();
const result = use(ob);
const deets = probeDetails[id];
return this.buildResult(p0, result, deets);
return cssResult(
this.buildResult(p0, result, deets));
}),
];
return cssBody(main);
@ -107,13 +111,17 @@ export class Boot extends Disposable {
public buildError() {
return dom(
'div',
'A diagnostics page is available at:',
dom('blockquote', '/boot/GRIST_BOOT_KEY'),
'GRIST_BOOT_KEY is an environment variable ',
' set before Grist starts. It should only',
' contain characters that are valid in a URL.',
' It should be a secret, since no authentication is needed',
' To visit the diagnostics page.',
dom('p',
'A diagnostics page can be made available at:',
dom('blockquote', '/boot/GRIST_BOOT_KEY'),
'GRIST_BOOT_KEY is an environment variable ',
' set before Grist starts. It should only',
' contain characters that are valid in a URL.',
' It should be a secret, since no authentication is needed',
' To visit the diagnostics page.'),
dom('p',
'You are seeing this page because either the key is not set,',
' or it is not in the URL.'),
);
}

@ -177,7 +177,7 @@ export class TopAppModelImpl extends Disposable implements TopAppModel {
this.productFlavor = getFlavor(window.gristConfig && window.gristConfig.org);
this._gristConfig = window.gristConfig;
this._widgets = new AsyncCreate<ICustomWidget[]>(async () => {
const widgets = this.options.useApi ? (await this.api.getWidgets()) : [];
const widgets = this.options.useApi === false ? [] : await this.api.getWidgets();
this.customWidgets.set(widgets);
return widgets;
});
@ -187,7 +187,7 @@ export class TopAppModelImpl extends Disposable implements TopAppModel {
this.autoDispose(subscribe(this.currentSubdomain, (use) => this.initialize()));
this.plugins = this._gristConfig?.plugins || [];
if (this.options.useApi) {
if (this.options.useApi !== false) {
this.fetchUsersAndOrgs().catch(reportError);
}
}
@ -247,7 +247,7 @@ export class TopAppModelImpl extends Disposable implements TopAppModel {
private async _doInitialize() {
this.appObs.set(null);
if (this.options.useApi === false) {
AppModelImpl.create(this.appObs, this, null, null, {error: 'zing', status: 500});
AppModelImpl.create(this.appObs, this, null, null, {error: 'no-api', status: 500});
return;
}
try {

@ -488,15 +488,14 @@ export class FlexServer implements GristServer {
const bootKey = appSettings.section('boot').flag('key').readString({
envVar: 'GRIST_BOOT_KEY'
});
if (!bootKey) { return; }
const base = `/boot/${bootKey}`;
this._probes = new BootProbes(this.app, this, base);
this.app.get('/boot(/:bootKey/?)?$', async (req, res) => {
const goodKey = req.params.bootKey === bootKey;
const goodKey = bootKey && req.params.bootKey === bootKey;
return this._sendAppPage(req, res, {
path: 'boot.html', status: 200, config: goodKey ? {
} : {
errMessage: 'wo wo',
errMessage: 'not-the-key',
}, tag: 'boot',
});
});

Loading…
Cancel
Save