mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 16:28:31 +00:00
* fix: restrict editor-written code in the builder editor and on the editor hostname * fix: simplify builder author code restrictions by hostname * refactor: remove redundant backend custom code hostname checks * refactor: unify builder HTML element rendering restrictions * refactor: clarify builder web frontend hostname terminology * fix: distinguish untrusted builder content in preview notices * refactor: remove unused backend preview security setting * docs: shorten builder code restriction changelog * fix: restrict iframe cookie access across frontend ports * refactor: share web frontend hostname matching * fix: preserve protected HTML interactions and bound iframe height --------- Co-authored-by: Jeremie Pardou <571533+jrmi@users.noreply.github.com>
69 lines
1.8 KiB
JavaScript
69 lines
1.8 KiB
JavaScript
import {
|
|
defineNuxtModule,
|
|
addPlugin,
|
|
createResolver,
|
|
extendPages,
|
|
addTemplate,
|
|
addRouteMiddleware,
|
|
} from 'nuxt/kit'
|
|
import { routes } from './routes'
|
|
import { locales } from '../../config/locales.js'
|
|
|
|
export default defineNuxtModule({
|
|
meta: {
|
|
name: '@baserow/builder',
|
|
configKey: 'builder',
|
|
},
|
|
dependsOn: ['core'],
|
|
async setup(options, nuxt) {
|
|
const { resolve } = createResolver(import.meta.url)
|
|
|
|
nuxt.options.runtimeConfig.public ||= {}
|
|
nuxt.options.runtimeConfig.public.builderPreviewUrl ??=
|
|
'http://localhost:3000'
|
|
nuxt.options.runtimeConfig.public.builderDangerousRelaxPreviewSecurity ??= false
|
|
|
|
// Add main plugin
|
|
addPlugin(resolve('./plugin.js'))
|
|
|
|
// Add global plugin
|
|
addPlugin(resolve('./plugins/global.js'))
|
|
addPlugin(resolve('./plugins/authorCode.js'))
|
|
addPlugin(resolve('./plugins/previewClientHandler.js'))
|
|
addPlugin(resolve('./plugins/publishedSiteClientHandler.js'))
|
|
addPlugin(resolve('./plugins/router.js'))
|
|
addPlugin(resolve('./plugins/realtime.js'))
|
|
|
|
addRouteMiddleware({
|
|
name: 'selectWorkspaceBuilderPage',
|
|
path: resolve('./middleware/selectWorkspaceBuilderPage.js'),
|
|
})
|
|
addRouteMiddleware({
|
|
name: 'exchangePreviewToken',
|
|
path: resolve('./middleware/exchangePreviewToken.js'),
|
|
})
|
|
addRouteMiddleware({
|
|
name: 'userSourceAuthProviderCallback',
|
|
path: resolve('./middleware/userSourceAuthProviderCallback.js'),
|
|
})
|
|
|
|
// Add routes
|
|
extendPages((pages) => {
|
|
pages.push(...routes)
|
|
})
|
|
|
|
// Register i18n translations
|
|
nuxt.hook('i18n:registerModule', (register) => {
|
|
register({
|
|
langDir: resolve('./locales'),
|
|
locales,
|
|
})
|
|
})
|
|
|
|
nuxt.hook('vite:extendConfig', (config) => {
|
|
config.server ||= {}
|
|
config.server.allowedHosts = true
|
|
})
|
|
},
|
|
})
|