From 49088e62bc66f848cd088af4a315dfc78e5fb50c Mon Sep 17 00:00:00 2001 From: Julien Nahum Date: Tue, 16 Jan 2024 11:46:03 +0100 Subject: [PATCH] Fix form show page - clean code --- client/lib/utils.js | 5 ----- client/pages/forms/[slug]/index.vue | 18 +++++++++--------- client/server/plugins/embeddable.js | 1 - 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/client/lib/utils.js b/client/lib/utils.js index e77e3ad..7d3df6f 100644 --- a/client/lib/utils.js +++ b/client/lib/utils.js @@ -77,10 +77,5 @@ export const customDomainUsed = function() { const appDomain = getDomain(config.public.appUrl) const host = getHost() - console.debug('customDomainUsed', { - 'appDomain': appDomain, - 'host': host, - 'customDomain': host !== appDomain && getDomain(host) !== appDomain - }) return host !== appDomain && getDomain(host) !== appDomain } diff --git a/client/pages/forms/[slug]/index.vue b/client/pages/forms/[slug]/index.vue index fd61539..5e6046e 100644 --- a/client/pages/forms/[slug]/index.vue +++ b/client/pages/forms/[slug]/index.vue @@ -21,7 +21,7 @@

- Unfortunately we could not find this form. It may have been deleted by it's author. + Unfortunately we could not find this form. It may have been deleted.

@@ -115,25 +115,25 @@ await loadForm(slug) useOpnSeoMeta({ title: () => { - if (form && form.value.is_pro && form.value.seo_meta.page_title) { + if (form && form.value?.is_pro && form.value.seo_meta.page_title) { return form.value.seo_meta.page_title } return form.value ? form.value.title : 'Create beautiful forms' }, - description () { - if (form && form.value.is_pro && form.value.seo_meta.page_description) { + description: () => { + if (form && form.value?.is_pro && form.value.seo_meta.page_description) { return form.value.seo_meta.page_description } - return (form && form.value.description) ? form.value.description.substring(0, 160) : null + return (form && form.value?.description) ? form.value?.description.substring(0, 160) : null }, - ogImage () { - if (form && form.value.is_pro && form.value.seo_meta.page_thumbnail) { + ogImage: () => { + if (form && form.value?.is_pro && form.value.seo_meta.page_thumbnail) { return form.value.seo_meta.page_thumbnail } - return (form && form.value.cover_picture) ? form.value.cover_picture : null + return (form && form.value?.cover_picture) ? form.value?.cover_picture : null }, robots: () => { - return (form && form.value.can_be_indexed) ? null : 'noindex, nofollow' + return (form && form.value?.can_be_indexed) ? null : 'noindex, nofollow' } }) useHead({ diff --git a/client/server/plugins/embeddable.js b/client/server/plugins/embeddable.js index a68639a..cdfe1f0 100644 --- a/client/server/plugins/embeddable.js +++ b/client/server/plugins/embeddable.js @@ -3,7 +3,6 @@ export default defineNitroPlugin(nitroApp => { const routePath = event.node?.req?.url || event.node?.req?.originalUrl // const routePath= event.context.params._ if (routePath && !routePath.startsWith('/forms/')) { - console.error('Not a form, setting X-Frame-Options', routePath) // Only allow embedding of forms response.headers['X-Frame-Options'] = 'sameorigin' }