mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
Fix admin socket metadata handling and footer HTML rendering in admin-tools
This commit is contained in:
@@ -69,15 +69,15 @@ const AdminController = {
|
|||||||
let url
|
let url
|
||||||
const openSockets = {}
|
const openSockets = {}
|
||||||
for (url in http.globalAgent.sockets) {
|
for (url in http.globalAgent.sockets) {
|
||||||
openSockets[`http://${url}`] = http.globalAgent.sockets[url].map(
|
openSockets[`http://${url}`] = http.globalAgent.sockets[url].map(socket => {
|
||||||
socket => socket._httpMessage.path
|
return socket._httpMessage?.path || '(unknown request)'
|
||||||
)
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
for (url in https.globalAgent.sockets) {
|
for (url in https.globalAgent.sockets) {
|
||||||
openSockets[`https://${url}`] = https.globalAgent.sockets[url].map(
|
openSockets[`https://${url}`] = https.globalAgent.sockets[url].map(socket => {
|
||||||
socket => socket._httpMessage.path
|
return socket._httpMessage?.path || '(unknown request)'
|
||||||
)
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const systemMessages =
|
const systemMessages =
|
||||||
|
|||||||
@@ -16,9 +16,14 @@ function FooterItemLi({
|
|||||||
label,
|
label,
|
||||||
}: FooterItem) {
|
}: FooterItem) {
|
||||||
const textToDisplay = translatedText || text
|
const textToDisplay = translatedText || text
|
||||||
|
const hasMarkup = /<[^>]+>/.test(textToDisplay)
|
||||||
|
|
||||||
if (!href) {
|
if (!href) {
|
||||||
return <li dangerouslySetInnerHTML={{ __html: textToDisplay }} />
|
return hasMarkup ? (
|
||||||
|
<li dangerouslySetInnerHTML={{ __html: textToDisplay }} />
|
||||||
|
) : (
|
||||||
|
<li>{textToDisplay}</li>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const linkProps = {
|
const linkProps = {
|
||||||
@@ -29,7 +34,11 @@ function FooterItemLi({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<li>
|
<li>
|
||||||
<a {...linkProps}>{textToDisplay}</a>
|
{hasMarkup ? (
|
||||||
|
<a {...linkProps} dangerouslySetInnerHTML={{ __html: textToDisplay }} />
|
||||||
|
) : (
|
||||||
|
<a {...linkProps}>{textToDisplay}</a>
|
||||||
|
)}
|
||||||
</li>
|
</li>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import ThinFooter from '../../../../frontend/js/shared/components/footer/thin-footer'
|
||||||
|
|
||||||
|
describe('<ThinFooter />', function () {
|
||||||
|
it('renders raw HTML image tags in footer items without a URL', function () {
|
||||||
|
cy.mount(
|
||||||
|
<ThinFooter
|
||||||
|
showPoweredBy={false}
|
||||||
|
subdomainLang={{}}
|
||||||
|
translatedLanguages={{}}
|
||||||
|
leftItems={[{ text: '<img src="/test-logo.png" alt="Logo" />' }]}
|
||||||
|
rightItems={[]}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
|
cy.get('footer.site-footer img[alt="Logo"]').should('exist')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('renders raw HTML inside a footer link when URL is provided', function () {
|
||||||
|
cy.mount(
|
||||||
|
<ThinFooter
|
||||||
|
showPoweredBy={false}
|
||||||
|
subdomainLang={{}}
|
||||||
|
translatedLanguages={{}}
|
||||||
|
leftItems={[
|
||||||
|
{
|
||||||
|
text: '<img src="/test-logo.png" alt="Logo" />',
|
||||||
|
url: '/foo',
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
rightItems={[]}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
|
||||||
|
cy.get('footer.site-footer a[href="/foo"] img[alt="Logo"]').should('exist')
|
||||||
|
})
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user