Merge branch 'main' into vue-3

This commit is contained in:
Forms Dev
2023-12-07 16:04:55 +05:30
42 changed files with 1371 additions and 188 deletions

View File

@@ -0,0 +1,16 @@
export default async (to, from, next) => {
if (!window.config.custom_domains_enabled) {
next()
}
const isCustomDomain = getDomain(window.location.href) !== getDomain(window.config.app_url)
if (isCustomDomain && !['forms.show_public'].includes(to.name)) {
// If route isn't a public form, redirect
window.location.href = 'https://opnform.com/?utm_source=failed_custom_domain_redirect'
} else {
next()
}
}
function getDomain (url) {
return (new URL(url)).hostname
}