From d6e470c8a668eb475446c7049c2485109fb4c39f Mon Sep 17 00:00:00 2001 From: fflorent Date: Tue, 7 May 2024 19:44:40 +0200 Subject: [PATCH] Paul's remarks --- README.md | 6 +++--- app/common/UserAPI.ts | 6 +++--- app/common/gristUrls.ts | 2 +- app/server/lib/DocWorkerUtils.ts | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 66539273..4582729d 100644 --- a/README.md +++ b/README.md @@ -235,11 +235,11 @@ Grist can be configured in many ways. Here are the main environment variables it | Variable | Purpose | |------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| ALLOWED_WEBHOOK_DOMAINS | comma-separated list of permitted domains to use in webhooks (e.g. webhook.site,zapier.com). You can set this to `*` to allow all domains, but if doing so, we recommend using a carefully locked-down proxy (see `GRIST_HTTPS_PROXY`) if you do not entirely trust users. Otherwise services on your internal network may become vulnerable to manipulation. | +| ALLOWED_WEBHOOK_DOMAINS | comma-separated list of permitted domains to use in webhooks (e.g. webhook.site,zapier.com). You can set this to `*` to allow all domains, but if doing so, we recommend using a carefully locked-down proxy (see `GRIST_HTTPS_PROXY`) if you do not entirely trust users. Otherwise services on your internal network may become vulnerable to manipulation. | | APP_DOC_URL | doc worker url, set when starting an individual doc worker (other servers will find doc worker urls via redis) | -| APP_DOC_INTERNAL_URL | like `APP_DOC_URL` but used by the home server to reach the server using an internal domain name resolution (like in a docker environment). You may only define this value in the doc worker. Defaults to `APP_DOC_URL`. | +| APP_DOC_INTERNAL_URL | like `APP_DOC_URL` but used by the home server to reach the server using an internal domain name resolution (like in a docker environment). It only makes sense to define this value in the doc worker. Defaults to `APP_DOC_URL`. | | APP_HOME_URL | url prefix for home api (home and doc servers need this) | -| APP_HOME_INTERNAL_URL | like `APP_HOME_URL` but used by the home server to reach any home workers using an internal domain name resolution (like in a docker environment). Defaults to `APP_HOME_URL` | +| APP_HOME_INTERNAL_URL | like `APP_HOME_URL` but used by the home and the doc servers to reach any home workers using an internal domain name resolution (like in a docker environment). Defaults to `APP_HOME_URL` | | APP_STATIC_URL | url prefix for static resources | | APP_STATIC_INCLUDE_CUSTOM_CSS | set to "true" to include custom.css (from APP_STATIC_URL) in static pages | | APP_UNTRUSTED_URL | URL at which to serve/expect plugin content. | diff --git a/app/common/UserAPI.ts b/app/common/UserAPI.ts index 8d39a5eb..15bc3b61 100644 --- a/app/common/UserAPI.ts +++ b/app/common/UserAPI.ts @@ -1157,7 +1157,7 @@ export class DocAPIImpl extends BaseAPI implements DocAPI { } /** - * Reprensents information to build public doc worker url. + * Represents information to build public doc worker url. * * Structure that may contain either **exclusively**: * - a selfPrefix when no pool of doc worker exist. @@ -1191,7 +1191,7 @@ export function getUrlFromPrefix(homeUrl: string, prefix: string) { * (result of the call to /api/worker/:docId) */ export function getPublicDocWorkerUrl(homeUrl: string, docWorkerInfo: PublicDocWorkerUrlInfo) { - return docWorkerInfo.selfPrefix ? + return docWorkerInfo.selfPrefix !== null ? getUrlFromPrefix(homeUrl, docWorkerInfo.selfPrefix) : - docWorkerInfo.docWorkerUrl!; + docWorkerInfo.docWorkerUrl; } diff --git a/app/common/gristUrls.ts b/app/common/gristUrls.ts index 1f7039f0..3e49deb5 100644 --- a/app/common/gristUrls.ts +++ b/app/common/gristUrls.ts @@ -197,7 +197,7 @@ function hostMatchesUrl(host?: string, url?: string) { * @param {string?} host The host to check */ function isOwnInternalUrlHost(host?: string) { - // Note: APP_HOME_INTERNAL_URL may also defined in doc worker as well as in Home worker + // Note: APP_HOME_INTERNAL_URL may also be defined in doc worker as well as in home worker if (process.env.APP_HOME_INTERNAL_URL && hostMatchesUrl(host, process.env.APP_HOME_INTERNAL_URL)) { return true; } diff --git a/app/server/lib/DocWorkerUtils.ts b/app/server/lib/DocWorkerUtils.ts index a5bc6cf9..060cef6f 100644 --- a/app/server/lib/DocWorkerUtils.ts +++ b/app/server/lib/DocWorkerUtils.ts @@ -6,7 +6,7 @@ import log from 'app/server/lib/log'; import {adaptServerUrl} from 'app/server/lib/requestUtils'; import * as express from 'express'; import fetch, {Response as FetchResponse, RequestInit} from 'node-fetch'; -import { getAssignmentId } from './idUtils'; +import {getAssignmentId} from './idUtils'; /** * This method transforms a doc worker's public url as needed based on the request.