(core) support ?embed=true and &style=light for a clean embed experience

Summary:
This adds query parameters useful for tailoring the Grist experience, with an eye to embedding.

Setting `style=light` removes side and top bars, as a first pass at a focused view of a single document page (this would benefit from refining).

Setting `embed=true` has no significant effect just yet other than it restricts document access to viewer at most (this can be overridden by specifying `/m/default`).

Test Plan: added tests

Reviewers: dsagal

Reviewed By: dsagal

Differential Revision: https://phab.getgrist.com/D2585
This commit is contained in:
Paul Fitzpatrick
2020-08-14 12:40:39 -04:00
parent 48ca124f23
commit 20d8124f45
10 changed files with 415 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
import {ApiError} from 'app/common/ApiError';
import {DEFAULT_HOME_SUBDOMAIN, parseSubdomain} from 'app/common/gristUrls';
import * as gutil from 'app/common/gutil';
import {DocScope, QueryResult, Scope} from 'app/gen-server/lib/HomeDBManager';
import {getUserId, RequestWithLogin} from 'app/server/lib/Authorizer';
import {RequestWithOrg} from 'app/server/lib/extractOrg';
@@ -84,7 +85,7 @@ export function allowHost(req: Request, allowedHost: string|URL) {
}
export function isParameterOn(parameter: any): boolean {
return ['1', 'on', 'true'].includes(String(parameter).toLowerCase());
return gutil.isAffirmative(parameter);
}
/**