diff --git a/.env.example b/.env.example index 725a7e94e..d955f107d 100644 --- a/.env.example +++ b/.env.example @@ -93,6 +93,7 @@ DATABASE_NAME=baserow # BASEROW_DISABLE_PUBLIC_URL_CHECK= # DOWNLOAD_FILE_VIA_XHR= +# BASEROW_DISABLE_GOOGLE_DOCS_FILE_PREVIEW= # BASEROW_PLUGIN_GIT_REPOS= # BASEROW_PLUGIN_URLS= diff --git a/changelog.md b/changelog.md index 72ed6d9cd..6a13a3ab0 100644 --- a/changelog.md +++ b/changelog.md @@ -23,6 +23,7 @@ For example: * Fixed bug with 404 middleware returning different 404 error messages based on the endpoint. * Made it possible to import data into an existing table. [#342](https://gitlab.com/bramw/baserow/-/issues/342) * Tables can now be duplicated. [#961](https://gitlab.com/bramw/baserow/-/issues/961) +* Introduced environment variable to disable Google docs file preview. [#1074](https://gitlab.com/bramw/baserow/-/issues/1074) ### Bug Fixes diff --git a/docker-compose.local-build.yml b/docker-compose.local-build.yml index 0028bfd3a..2e6f3bd9b 100644 --- a/docker-compose.local-build.yml +++ b/docker-compose.local-build.yml @@ -153,6 +153,7 @@ services: BASEROW_DISABLE_PUBLIC_URL_CHECK: INITIAL_TABLE_DATA_LIMIT: DOWNLOAD_FILE_VIA_XHR: + BASEROW_DISABLE_GOOGLE_DOCS_FILE_PREVIEW: HOURS_UNTIL_TRASH_PERMANENTLY_DELETED: DISABLE_ANONYMOUS_PUBLIC_VIEW_WS_CONNECTIONS: FEATURE_FLAGS: diff --git a/docker-compose.no-caddy.yml b/docker-compose.no-caddy.yml index 00525ab3b..8d926e18f 100644 --- a/docker-compose.no-caddy.yml +++ b/docker-compose.no-caddy.yml @@ -143,6 +143,7 @@ services: BASEROW_DISABLE_PUBLIC_URL_CHECK: INITIAL_TABLE_DATA_LIMIT: DOWNLOAD_FILE_VIA_XHR: + BASEROW_DISABLE_GOOGLE_DOCS_FILE_PREVIEW: HOURS_UNTIL_TRASH_PERMANENTLY_DELETED: DISABLE_ANONYMOUS_PUBLIC_VIEW_WS_CONNECTIONS: FEATURE_FLAGS: diff --git a/docker-compose.yml b/docker-compose.yml index cab713d31..46d4948d3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -164,6 +164,7 @@ services: BASEROW_DISABLE_PUBLIC_URL_CHECK: INITIAL_TABLE_DATA_LIMIT: DOWNLOAD_FILE_VIA_XHR: + BASEROW_DISABLE_GOOGLE_DOCS_FILE_PREVIEW: HOURS_UNTIL_TRASH_PERMANENTLY_DELETED: DISABLE_ANONYMOUS_PUBLIC_VIEW_WS_CONNECTIONS: FEATURE_FLAGS: diff --git a/docs/installation/configuration.md b/docs/installation/configuration.md index bb5a2cd51..85d5e9bf6 100644 --- a/docs/installation/configuration.md +++ b/docs/installation/configuration.md @@ -143,6 +143,7 @@ The installation methods referred to in the variable descriptions are: | DOWNLOAD\_FILE\_VIA\_XHR | Set to \`1\` to force download links to download files via XHR query to bypass \`Content-Disposition: inline\` that can't be overridden in another way. If your files are stored under another origin, you also must add CORS headers to your server. | 0 | | BASEROW\_DISABLE\_PUBLIC\_URL\_CHECK | When opening the Baserow login page a check is run to ensure the PUBLIC\_BACKEND\_URL/BASEROW\_PUBLIC\_URL variables are set correctly and your browser can correctly connect to the backend. If misconfigured an error is shown. If you wish to disable this check and warning set this to any non empty value. | | | ADDITIONAL\_MODULES | **Internal** A list of file paths to Nuxt module.js files to load as additional Nuxt modules into Baserow on startup. | | +| BASEROW\_DISABLE\_GOOGLE\_DOCS\_FILE\_PREVIEW | Set to \`true\` or \`1\` to disable Google docs file preview. | | ### `baserow/baserow` Image only Configuration diff --git a/docs/technical/introduction.md b/docs/technical/introduction.md index 493257320..c50410b88 100644 --- a/docs/technical/introduction.md +++ b/docs/technical/introduction.md @@ -94,10 +94,12 @@ are accepted. download files via XHR query to bypass `Content-Disposition: inline` that can't be overridden in another way. If your files are stored under another origin, you also must add CORS headers to your server. +* `BASEROW_DISABLE_GOOGLE_DOCS_FILE_PREVIEW` (default ``): Set to `true` or `1` to + disable Google docs file preview in the web-frontend. * `PUBLIC_BACKEND_URL` (default `http://localhost:8000`): The publicly accessible URL of - the backend. For the development environment this is `http://localhost:8000`, but if - you change the port to 9000 it will be `http://localhost:9000`. You should be able to - lookup this url with your browser. + the backend. For the development environment this is `http://localhost:8000`, but if + you change the port to 9000 it will be `http://localhost:9000`. You should be able to + lookup this url with your browser. * `PRIVATE_BACKEND_URL` (default `http://backend:8000`): Not only the browser, but also the web-frontend server should be able to make HTTP requests to the backend. It might not have access to the `PUBLIC_BACKEND_URL` or there could be a more direct route, diff --git a/web-frontend/modules/core/module.js b/web-frontend/modules/core/module.js index eaa3fa19a..0e17358ca 100644 --- a/web-frontend/modules/core/module.js +++ b/web-frontend/modules/core/module.js @@ -93,6 +93,10 @@ export default function CoreModule(options) { key: 'FEATURE_FLAGS', default: '', }, + { + key: 'BASEROW_DISABLE_GOOGLE_DOCS_FILE_PREVIEW', + default: '', + }, ], }, ]) diff --git a/web-frontend/modules/database/filePreviewTypes.js b/web-frontend/modules/database/filePreviewTypes.js index c02b2d89c..aee05d9d7 100644 --- a/web-frontend/modules/database/filePreviewTypes.js +++ b/web-frontend/modules/database/filePreviewTypes.js @@ -125,6 +125,10 @@ export class GoogleDocFilePreview extends FilePreviewType { } isCompatible(mimeType, fileName) { + if (this.app.$env.BASEROW_DISABLE_GOOGLE_DOCS_FILE_PREVIEW) { + return false + } + const conds = [ 'application/pdf',