Просмотр исходного кода

[web] change status page URL to HTTPS everywhere (#26587)

* [web] change status page URL to HTTPS everywhere

Also open all links to the status page or admin email in a new tab.

* [server-ce] explicit protocol matching

Co-authored-by: Brian Gough <brian.gough@overleaf.com>

---------

Co-authored-by: Brian Gough <brian.gough@overleaf.com>
GitOrigin-RevId: d7d12eef4efc737c5d70fc969c862acae9faf14c
Jakob Ackermann 1 год назад
Родитель
Сommit
73ae6f480f

+ 4 - 1
server-ce/config/settings.js

@@ -184,7 +184,10 @@ const settings = {
   siteUrl: (siteUrl = process.env.OVERLEAF_SITE_URL || 'http://localhost'),
 
   // Status page URL as displayed on the maintenance/500 pages.
-  statusPageUrl: process.env.OVERLEAF_STATUS_PAGE_URL,
+  statusPageUrl: process.env.OVERLEAF_STATUS_PAGE_URL ?
+    // Add https:// protocol prefix if not set (Allow plain-text http:// for Server Pro/CE).
+    (process.env.OVERLEAF_STATUS_PAGE_URL.startsWith('http://') || process.env.OVERLEAF_STATUS_PAGE_URL.startsWith('https://')) ? process.env.OVERLEAF_STATUS_PAGE_URL : `https://${process.env.OVERLEAF_STATUS_PAGE_URL}`
+    : undefined,
 
   // The name this is used to describe your Overleaf Community Edition Installation
   appName: process.env.OVERLEAF_APP_NAME || 'Overleaf Community Edition',

+ 1 - 1
services/web/app/src/Features/Errors/HttpErrorHandler.js

@@ -146,7 +146,7 @@ module.exports = HttpErrorHandler = {
     }
     let message = `${Settings.appName} is currently down for maintenance.`
     if (Settings.statusPageUrl) {
-      message += ` Please check https://${Settings.statusPageUrl} for updates.`
+      message += ` Please check ${Settings.statusPageUrl} for updates.`
     }
     switch (req.accepts(['html', 'json'])) {
       case 'html':

+ 1 - 1
services/web/app/views/general/400.pug

@@ -22,7 +22,7 @@ block body
 							| Please go back and try again.
 							| If the problem persists, please contact us at
 							|
-							a(href='mailto:' + settings.adminEmail) #{settings.adminEmail}
+							a(href='mailto:' + settings.adminEmail target='_blank') #{settings.adminEmail}
 							| .
 						p.error-actions
 							a.error-btn(href='javascript:history.back()') Back

+ 13 - 7
services/web/app/views/general/500.pug

@@ -10,14 +10,20 @@ block body
 				.error-container.full-height
 					.error-details
 						p.error-status Something went wrong, sorry.
-						p.error-description Our staff are probably looking into this, but if it continues, please check our status page at
+						if settings.statusPageUrl
+							p.error-description Our staff are probably looking into this, but if it continues, please check our status page at
+								|
+								|
+								a(href=settings.statusPageUrl target='_blank') #{new URL(settings.statusPageUrl).hostname}
+								|
+								| or contact us at
+								|
+								a(href='mailto:' + settings.adminEmail target='_blank') #{settings.adminEmail}
+								| .
+						else
+							| If the problem persists, please contact us at
 							|
-							|
-							a(href='http://' + settings.statusPageUrl) #{settings.statusPageUrl}
-							|
-							| or contact us at
-							|
-							a(href='mailto:' + settings.adminEmail) #{settings.adminEmail}
+							a(href='mailto:' + settings.adminEmail target='_blank') #{settings.adminEmail}
 							| .
 						p.error-actions
 							a.error-btn(href='/') Home

+ 1 - 1
services/web/app/views/general/closed.pug

@@ -10,7 +10,7 @@ block content
 					p
 						if settings.statusPageUrl
 							| #{settings.appName} is currently down for maintenance.
-							| Please check our #[a(href='https://' + settings.statusPageUrl) status page]
+							| Please check our #[a(href=settings.statusPageUrl target='_blank') status page]
 							| for updates.
 						else
 							| #{settings.appName} is currently down for maintenance.

+ 3 - 3
services/web/app/views/general/unsupported-browser.pug

@@ -15,7 +15,7 @@ block body
 							br
 							| If you think you're seeing this message in error,
 							|
-							a(href='mailto:' + settings.adminEmail) please let us know
+							a(href='mailto:' + settings.adminEmail target='_blank') please let us know
 							| .
 
 						if fromURL
@@ -33,7 +33,7 @@ block body
 						p
 							| Support for beta or developer-preview browser versions cannot be guaranteed. Please
 							|
-							a(href='mailto:' + settings.adminEmail) get in touch
+							a(href='mailto:' + settings.adminEmail target='_blank') get in touch
 							|
 							| if you encounter any issues while using the service with beta or developer-preview releases of supported browsers.
 						p
@@ -41,5 +41,5 @@ block body
 						p
 							| If you cannot upgrade to one of the supported browsers,
 							|
-							a(href='mailto:' + settings.adminEmail) please let us know
+							a(href='mailto:' + settings.adminEmail target='_blank') please let us know
 							| .

+ 1 - 1
services/web/test/acceptance/config/settings.test.defaults.js

@@ -24,7 +24,7 @@ module.exports = {
     ? JSON.parse(process.env.ADMIN_DOMAINS)
     : ['example.com'],
 
-  statusPageUrl: 'status.example.com',
+  statusPageUrl: 'https://status.example.com',
   cdn: {
     web: {
       host: 'cdn.example.com',