Browse Source

add a public page for zabbix to ping

Olivier Massot 7 months ago
parent
commit
f6335c9b7f
3 changed files with 43 additions and 0 deletions
  1. 17 0
      layouts/blank.vue
  2. 20 0
      pages/public/ping.vue
  3. 6 0
      plugins/init.server.ts

+ 17 - 0
layouts/blank.vue

@@ -0,0 +1,17 @@
+<template>
+  <div>
+    <v-app>
+      <v-main class="main">
+        <!-- Page will be rendered here-->
+        <slot />
+      </v-main>
+    </v-app>
+  </div>
+</template>
+
+<script setup lang="ts">
+import { useLayoutStore } from '~/stores/layout'
+
+const layoutStore = useLayoutStore()
+layoutStore.name = 'blank'
+</script>

+ 20 - 0
pages/public/ping.vue

@@ -0,0 +1,20 @@
+<template>
+  <NuxtLayout name="blank">
+    <div>OK</div>
+  </NuxtLayout>
+</template>
+
+<script setup lang="ts">
+/**
+ * Disable the default layout, the page will use the layout defined with <NuxtLayout />
+ * @see https://nuxt.com/docs/guide/directory-structure/layouts#overriding-a-layout-on-a-per-page-basis
+ */
+definePageMeta({
+  name: 'public_ping_page',
+  layout: false,
+})
+</script>
+
+<style scoped lang="scss">
+
+</style>

+ 6 - 0
plugins/init.server.ts

@@ -4,6 +4,12 @@ import { useRedirect } from '~/composables/utils/useRedirect'
 import { useRefreshProfile } from '~/composables/data/useRefreshProfile'
 
 export default defineNuxtPlugin(async () => {
+
+  const route = useRoute()
+  if (route.path.match(/\/public\/.+/)) {
+    return
+  }
+
   const { redirectToLogout } = useRedirect()
 
   const bearer: CookieRef<string | null> = useCookie('BEARER') ?? null