mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-26 18:31:36 +00:00
Merge pull request #19644 from overleaf/jpa-remove-window-attributes
[web] goodbye window attributes GitOrigin-RevId: b15a2cb1d96b657385c4d46dcf80e0269dbd7409
This commit is contained in:
parent
f575654201
commit
e85045255c
3 changed files with 0 additions and 37 deletions
|
@ -18,10 +18,6 @@ const {
|
|||
const {
|
||||
addOptionalCleanupHandlerAfterDrainingConnections,
|
||||
} = require('./GracefulShutdown')
|
||||
const { expressify } = require('@overleaf/promise-utils')
|
||||
const {
|
||||
loadAssignmentsInLocals,
|
||||
} = require('../Features/SplitTests/SplitTestMiddleware')
|
||||
|
||||
const IEEE_BRAND_ID = Settings.ieeeBrandId
|
||||
|
||||
|
@ -75,10 +71,6 @@ function getWebpackAssets(entrypoint, section) {
|
|||
}
|
||||
|
||||
module.exports = function (webRouter, privateApiRouter, publicApiRouter) {
|
||||
webRouter.use(
|
||||
expressify(loadAssignmentsInLocals(['remove-window-attributes']))
|
||||
)
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
// In the dev-env, delay requests until we fetched the manifest once.
|
||||
webRouter.use(function (req, res, next) {
|
||||
|
|
|
@ -46,8 +46,6 @@ import { PasswordStrengthOptions } from '../../../types/password-strength-option
|
|||
import { Subscription as ProjectDashboardSubscription } from '../../../types/project/dashboard/subscription'
|
||||
import { ThirdPartyIds } from '../../../types/third-party-ids'
|
||||
import { Publisher } from '../../../types/subscription/dashboard/publisher'
|
||||
import _ from 'lodash'
|
||||
import { isSplitTestEnabled } from '@/utils/splitTestUtils'
|
||||
|
||||
export interface Meta {
|
||||
'ol-ExposedSettings': ExposedSettings
|
||||
|
@ -248,29 +246,3 @@ export default function getMeta<T extends keyof Meta>(name: T): Meta[T] {
|
|||
window.metaAttributesCache.set(name, value)
|
||||
return value
|
||||
}
|
||||
|
||||
function convertMetaToWindowAttributes() {
|
||||
Array.from(document.querySelectorAll('meta[name^="ol-"]'))
|
||||
.map(element => (element as HTMLMetaElement).name)
|
||||
// process short labels before long ones:
|
||||
// e.g. assign 'foo' before 'foo.bar'
|
||||
.sort()
|
||||
.forEach(nameWithNamespace => {
|
||||
const label = nameWithNamespace.slice('ol-'.length)
|
||||
// @ts-ignore
|
||||
_.set(window, label, getMeta(nameWithNamespace))
|
||||
})
|
||||
}
|
||||
|
||||
// Deduplicate warning, the bootstrap-3 bundle ships its own copy of this module.
|
||||
if (!window.warnedAboutWindowAttributeRemoval) {
|
||||
window.warnedAboutWindowAttributeRemoval = true
|
||||
// Notify any extension developers about the upcoming removal of window attributes.
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
'overleaf.com: We are sunsetting window properties like "window.project_id". If you need access to any of these, please reach out to support@overleaf.com to discuss options.'
|
||||
)
|
||||
}
|
||||
if (!isSplitTestEnabled('remove-window-attributes')) {
|
||||
convertMetaToWindowAttributes()
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ declare global {
|
|||
// eslint-disable-next-line no-unused-vars
|
||||
interface Window {
|
||||
metaAttributesCache: Map<string, any>
|
||||
warnedAboutWindowAttributeRemoval?: boolean
|
||||
_ide: Record<string, unknown> & {
|
||||
$scope: Record<string, unknown> & {
|
||||
pdf?: {
|
||||
|
|
Loading…
Reference in a new issue