From f9d7148b6c659c4dc18774f0db7ce5ca3985d478 Mon Sep 17 00:00:00 2001 From: yu-i-i Date: Wed, 9 Apr 2025 23:50:50 +0200 Subject: [PATCH] Enable From External URL feature --- README.md | 19 +++++++++++++++---- develop/docker-compose.yml | 2 +- docker-compose.yml | 2 +- server-ce/test/docker-compose.yml | 2 +- .../web/app/src/Features/Helpers/UrlHelper.js | 8 -------- .../app/src/Features/LinkedFiles/UrlAgent.mjs | 1 - .../web/app/src/infrastructure/Features.js | 5 +---- 7 files changed, 19 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 9ae4d5b376..c698c64a1a 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ The present "extended" version of Overleaf CE includes: - Real-time track changes and comments - Autocomplete of reference keys - Symbol Palette +- "From External URL" feature ## Enterprise @@ -108,7 +109,7 @@ file during compilation. This is required for packages like `minted`. For this p ``` OVERLEAF_APP_NAME="Our Overleaf Instance" -ENABLED_LINKED_FILE_TYPES=project_file,project_output_file +ENABLED_LINKED_FILE_TYPES=project_file,project_output_file,url # Enables Thumbnail generation using ImageMagick ENABLE_CONVERSIONS=true @@ -158,6 +159,16 @@ TEX_COMPILER_EXTRA_FLAGS=-shell-escape ``` +## "From External URL" feature + +To enable the ["From External URL"](https://www.overleaf.com/learn/how-to/How_to_upload_a_file_using_an_external_URL) feature the variable +`ENABLED_LINKED_FILE_TYPES` must include `url` type: +``` +ENABLED_LINKED_FILE_TYPES=project_file,project_output_file,url +``` +This will extend both the *Add Files* menu and the *Insert Figure* dropdown in the toolbar: the *Add Files* menu allows you to add a +file to your project using its URL, while the *Insert Figure* dropdown lets you insert an image into your document directly from its URL. + ## Authentication Methods The following authentication methods are supported: local authentication, LDAP authentication, SAML authentication, @@ -325,7 +336,7 @@ The above example results in loading into the contacts of the current LDAP user ``` OVERLEAF_APP_NAME="Our Overleaf Instance" -ENABLED_LINKED_FILE_TYPES=project_file,project_output_file +ENABLED_LINKED_FILE_TYPES=project_file,project_output_file,url # Enables Thumbnail generation using ImageMagick ENABLE_CONVERSIONS=true @@ -662,7 +673,7 @@ and set as appropriate in your IdP configuration, or send the metadata file to t ``` OVERLEAF_APP_NAME="Our Overleaf Instance" -ENABLED_LINKED_FILE_TYPES=project_file,project_output_file +ENABLED_LINKED_FILE_TYPES=project_file,project_output_file,url # Enables Thumbnail generation using ImageMagick ENABLE_CONVERSIONS=true @@ -818,7 +829,7 @@ The redirect URL for your OpenID Provider is `https://my-overleaf-instance.com/o ``` OVERLEAF_APP_NAME="Our Overleaf Instance" -ENABLED_LINKED_FILE_TYPES=project_file,project_output_file +ENABLED_LINKED_FILE_TYPES=project_file,project_output_file,url # Enables Thumbnail generation using ImageMagick ENABLE_CONVERSIONS=true diff --git a/develop/docker-compose.yml b/develop/docker-compose.yml index 1593901b0b..93fde1e9b3 100644 --- a/develop/docker-compose.yml +++ b/develop/docker-compose.yml @@ -147,7 +147,7 @@ services: - dev.env environment: - APP_NAME=Overleaf Community Edition - - ENABLED_LINKED_FILE_TYPES=project_file,project_output_file + - ENABLED_LINKED_FILE_TYPES=project_file,project_output_file,url - EMAIL_CONFIRMATION_DISABLED=true - NODE_ENV=development - OVERLEAF_ALLOW_PUBLIC_ACCESS=true diff --git a/docker-compose.yml b/docker-compose.yml index 08d6db6fe7..2beba88d85 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -32,7 +32,7 @@ services: OVERLEAF_REDIS_HOST: redis REDIS_HOST: redis - ENABLED_LINKED_FILE_TYPES: 'project_file,project_output_file' + ENABLED_LINKED_FILE_TYPES: 'project_file,project_output_file,url' # Enables Thumbnail generation using ImageMagick ENABLE_CONVERSIONS: 'true' diff --git a/server-ce/test/docker-compose.yml b/server-ce/test/docker-compose.yml index 43f494a084..501979d63a 100644 --- a/server-ce/test/docker-compose.yml +++ b/server-ce/test/docker-compose.yml @@ -20,7 +20,7 @@ services: OVERLEAF_EMAIL_SMTP_HOST: 'mailtrap' OVERLEAF_EMAIL_SMTP_PORT: '25' OVERLEAF_EMAIL_SMTP_IGNORE_TLS: 'true' - ENABLED_LINKED_FILE_TYPES: 'project_file,project_output_file' + ENABLED_LINKED_FILE_TYPES: 'project_file,project_output_file,url' ENABLE_CONVERSIONS: 'true' EMAIL_CONFIRMATION_DISABLED: 'true' healthcheck: diff --git a/services/web/app/src/Features/Helpers/UrlHelper.js b/services/web/app/src/Features/Helpers/UrlHelper.js index cf686636b8..1c70e792f0 100644 --- a/services/web/app/src/Features/Helpers/UrlHelper.js +++ b/services/web/app/src/Features/Helpers/UrlHelper.js @@ -32,14 +32,6 @@ module.exports = { getCanonicalURL, getSafeRedirectPath, getSafeAdminDomainRedirect, - wrapUrlWithProxy(url) { - // TODO: Consider what to do for Community and Enterprise edition? - if (!Settings.apis.linkedUrlProxy.url) { - throw new Error('no linked url proxy configured') - } - return `${Settings.apis.linkedUrlProxy.url}?url=${encodeURIComponent(url)}` - }, - prependHttpIfNeeded(url) { if (!url.match('://')) { url = `http://${url}` diff --git a/services/web/app/src/Features/LinkedFiles/UrlAgent.mjs b/services/web/app/src/Features/LinkedFiles/UrlAgent.mjs index 12785d7c04..3c75034b34 100644 --- a/services/web/app/src/Features/LinkedFiles/UrlAgent.mjs +++ b/services/web/app/src/Features/LinkedFiles/UrlAgent.mjs @@ -72,7 +72,6 @@ function _getUrl(projectId, data, currentUserId) { if (!urlValidator.isWebUri(url)) { throw new InvalidUrlError(`invalid url: ${url}`) } - url = UrlHelper.wrapUrlWithProxy(url) return url } diff --git a/services/web/app/src/infrastructure/Features.js b/services/web/app/src/infrastructure/Features.js index aaf51103b9..e16f2ae0b0 100644 --- a/services/web/app/src/infrastructure/Features.js +++ b/services/web/app/src/infrastructure/Features.js @@ -12,8 +12,6 @@ const trackChangesModuleAvailable = /** * @typedef {Object} Settings * @property {Object | undefined} apis - * @property {Object | undefined} apis.linkedUrlProxy - * @property {string | undefined} apis.linkedUrlProxy.url * @property {Object | undefined} apis.references * @property {string | undefined} apis.references.url * @property {boolean | undefined} enableGithubSync @@ -85,8 +83,7 @@ const Features = { ) case 'link-url': return Boolean( - _.get(Settings, ['apis', 'linkedUrlProxy', 'url']) && - Settings.enabledLinkedFileTypes.includes('url') + Settings.enabledLinkedFileTypes.includes('url') ) case 'project-history-blobs': return Boolean(Settings.enableProjectHistoryBlobs)