mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) updates from grist-core
This commit is contained in:
@@ -192,12 +192,6 @@ export class MergedServer {
|
||||
this.flexServer.checkOptionCombinations();
|
||||
this.flexServer.summary();
|
||||
this.flexServer.ready();
|
||||
|
||||
// Some tests have their timing perturbed by having this earlier
|
||||
// TODO: update those tests.
|
||||
if (this.hasComponent("docs")) {
|
||||
await this.flexServer.checkSandbox();
|
||||
}
|
||||
} catch(e) {
|
||||
await this.flexServer.close();
|
||||
throw e;
|
||||
|
||||
@@ -265,7 +265,7 @@ const _sandboxingProbe: Probe = {
|
||||
id: 'sandboxing',
|
||||
name: 'Is document sandboxing effective',
|
||||
apply: async (server, req) => {
|
||||
const details = server.getSandboxInfo();
|
||||
const details = await server.getSandboxInfo();
|
||||
return {
|
||||
status: (details?.configured && details?.functional) ? 'success' : 'fault',
|
||||
details,
|
||||
|
||||
@@ -1397,8 +1397,9 @@ export class FlexServer implements GristServer {
|
||||
}
|
||||
}
|
||||
|
||||
public async checkSandbox() {
|
||||
if (this._check('sandbox', 'doc')) { return; }
|
||||
public async getSandboxInfo(): Promise<SandboxInfo> {
|
||||
if (this._sandboxInfo) { return this._sandboxInfo; }
|
||||
|
||||
const flavor = process.env.GRIST_SANDBOX_FLAVOR || 'unknown';
|
||||
const info = this._sandboxInfo = {
|
||||
flavor,
|
||||
@@ -1408,6 +1409,8 @@ export class FlexServer implements GristServer {
|
||||
sandboxed: false,
|
||||
lastSuccessfulStep: 'none',
|
||||
} as SandboxInfo;
|
||||
// Only meaningful on instances that handle documents.
|
||||
if (!this._docManager) { return info; }
|
||||
try {
|
||||
const sandbox = createSandbox({
|
||||
server: this,
|
||||
@@ -1432,10 +1435,7 @@ export class FlexServer implements GristServer {
|
||||
} catch (e) {
|
||||
info.error = String(e);
|
||||
}
|
||||
}
|
||||
|
||||
public getSandboxInfo(): SandboxInfo|undefined {
|
||||
return this._sandboxInfo;
|
||||
return info;
|
||||
}
|
||||
|
||||
public getInfo(key: string): any {
|
||||
|
||||
@@ -70,7 +70,7 @@ export interface GristServer {
|
||||
servesPlugins(): boolean;
|
||||
getBundledWidgets(): ICustomWidget[];
|
||||
getBootKey(): string|undefined;
|
||||
getSandboxInfo(): SandboxInfo|undefined;
|
||||
getSandboxInfo(): Promise<SandboxInfo>;
|
||||
getInfo(key: string): any;
|
||||
getJobs(): GristJobs;
|
||||
}
|
||||
@@ -165,7 +165,7 @@ export function createDummyGristServer(): GristServer {
|
||||
getPlugins() { return []; },
|
||||
getBundledWidgets() { return []; },
|
||||
getBootKey() { return undefined; },
|
||||
getSandboxInfo() { return undefined; },
|
||||
getSandboxInfo() { throw new Error('no sandbox'); },
|
||||
getInfo(key: string) { return undefined; },
|
||||
getJobs(): GristJobs { throw new Error('no job system'); },
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user