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:
@@ -31,6 +31,11 @@ export interface ICustomWidget {
|
||||
*/
|
||||
renderAfterReady?: boolean;
|
||||
|
||||
/**
|
||||
* If set to false, do not offer to user in UI.
|
||||
*/
|
||||
published?: boolean;
|
||||
|
||||
/**
|
||||
* If the widget came from a plugin, we track that here.
|
||||
*/
|
||||
|
||||
@@ -167,6 +167,12 @@ export interface OrgUrlInfo {
|
||||
orgInPath?: string; // If /o/{orgInPath} should be used to access the requested org.
|
||||
}
|
||||
|
||||
function isDocInternalUrl(host: string) {
|
||||
if (!process.env.APP_DOC_INTERNAL_URL) { return false; }
|
||||
const internalUrl = new URL('/', process.env.APP_DOC_INTERNAL_URL);
|
||||
return internalUrl.host === host;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given host (optionally with port), baseDomain, and pluginUrl, determine whether to interpret host
|
||||
* as a custom domain, a native domain, or a plugin domain.
|
||||
@@ -184,8 +190,10 @@ export function getHostType(host: string, options: {
|
||||
|
||||
const hostname = host.split(":")[0];
|
||||
if (!options.baseDomain) { return 'native'; }
|
||||
if (hostname !== 'localhost' && !hostname.endsWith(options.baseDomain)) { return 'custom'; }
|
||||
return 'native';
|
||||
if (hostname === 'localhost' || isDocInternalUrl(host) || hostname.endsWith(options.baseDomain)) {
|
||||
return 'native';
|
||||
}
|
||||
return 'custom';
|
||||
}
|
||||
|
||||
export function getOrgUrlInfo(newOrg: string, currentHost: string, options: OrgUrlOptions): OrgUrlInfo {
|
||||
|
||||
Reference in New Issue
Block a user