mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
523 B
20 lines
523 B
7 months ago
|
export default defineNuxtRouteMiddleware(async (to) => {
|
||
|
// avoid non-embeddable paths within an iframe
|
||
|
if (self !== top) {
|
||
|
// allow for shared base
|
||
|
const embeddablePaths = ['/base/']
|
||
|
const embedRegex = new RegExp(`^(${embeddablePaths.join('|')})`)
|
||
|
if (embedRegex.test(to.path)) {
|
||
|
return
|
||
|
}
|
||
|
|
||
|
// allow for shared views
|
||
|
if (to.meta?.layout === 'shared-view') {
|
||
|
return
|
||
|
}
|
||
|
|
||
|
// throw for all other pages
|
||
|
throw createError({ statusCode: 403, message: 'Not allowed' })
|
||
|
}
|
||
|
})
|