Self hosted domain redirect (#756)

* Integration pages from Notion

* Self hosted domain redirect

* Refactor root-redirect middleware and update 404 page layout

- Simplified the `root-redirect.js` middleware by removing the specific route checks, allowing for a more general redirect based on the `self_hosted` feature flag.
- Updated the 404 error page in `[...all].vue` by removing the unnecessary `NuxtLayout` wrapper and replacing `NuxtLink` with a custom `UButton` for navigation, enhancing the overall layout and user experience.

These changes aim to streamline the redirect logic and improve the presentation of the 404 error page.

* Refactor feature flag handling and update middleware

- Updated the condition in `Navbar.vue` to correctly evaluate the feature flags for rendering the AI form builder link.
- Removed the `feature-flags.global.js` middleware as it was no longer needed, streamlining the middleware structure.
- Enhanced the `root-redirect.js` middleware to utilize `h3`'s `sendRedirect` for server-side redirection, improving the redirect logic.
- Modified the `ai-form-builder.vue` page to include the new `root-redirect` middleware, ensuring proper redirection based on feature flags.

These changes aim to improve the handling of feature flags and redirection logic, enhancing the overall application flow.

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
Chirag Chhatrala
2025-05-20 18:21:44 +05:30
committed by GitHub
parent cc2b0e989d
commit b2b04d7f2a
11 changed files with 100 additions and 35 deletions

39
client/pages/[...all].vue Normal file
View File

@@ -0,0 +1,39 @@
<template>
<div>
<div class="flex mt-6">
<div class="w-full md:w-2/3 md:mx-auto md:max-w-md">
<img
alt="Nice plant as we have nothing else to show!"
src="/img/icons/plant.png"
class="w-56 mb-5"
>
<h1 class="mb-6 font-semibold text-3xl text-gray-900">
Page not found (404)
</h1>
<div class="links">
<UButton
:to="{ name: 'index' }"
class="hover:underline"
>
Go Home
</UButton>
</div>
</div>
</div>
</div>
</template>
<script setup>
definePageMeta({
middleware: ['root-redirect']
})
useOpnSeoMeta({
title: "404 - Page not found",
})
const event = useRequestEvent()
setResponseStatus(event, 404, 'Page Not Found')
</script>

View File

@@ -629,7 +629,7 @@
<script setup>
const authStore = useAuthStore()
definePageMeta({
middleware: ["self-hosted",]
middleware: ['root-redirect','self-hosted']
})
useOpnSeoMeta({
title: "Free AI form builder",

View File

@@ -323,6 +323,9 @@ export default {
defineRouteRules({
swr: 3600,
})
definePageMeta({
middleware: ['root-redirect']
})
return {
authenticated: computed(() => authStore.check),

View File

@@ -85,7 +85,7 @@ defineRouteRules({
})
definePageMeta({
stickyNavbar: true,
middleware: ["self-hosted"]
middleware: ['root-redirect','self-hosted']
})
useOpnSeoMeta({

View File

@@ -174,7 +174,7 @@ defineRouteRules({
})
definePageMeta({
stickyNavbar: true,
middleware: ["self-hosted"]
middleware: ['root-redirect','self-hosted']
})
const crisp = useCrisp()