@dargmuesli/nuxt-vio 13.1.8 → 13.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -59,7 +59,7 @@ defineOgImageComponent(
59
59
  )
60
60
  useAppLayout()
61
61
  useFavicons()
62
- usePolyfills()
62
+ // usePolyfills() // hijacked ⚠️
63
63
  useSchemaOrg([
64
64
  defineWebSite({
65
65
  description: siteConfig.description,
@@ -0,0 +1,6 @@
1
+ export const useIsTesting = () => {
2
+ const cookie = useCookie(TESTING_COOKIE_NAME).value
3
+ const runtimeConfig = useRuntimeConfig()
4
+
5
+ return runtimeConfig.public.vio.isTesting || !!cookie
6
+ }
@@ -1,6 +1,7 @@
1
1
  import { POLYFILLS } from '../utils/constants'
2
2
 
3
3
  export const usePolyfills = () => {
4
+ return // hijacked ⚠️
4
5
  if (!POLYFILLS.length) return
5
6
 
6
7
  const polyfillsUrl = `https://polyfill.io/v3/polyfill.min.js?features=${POLYFILLS.join(
package/package.json CHANGED
@@ -57,7 +57,7 @@
57
57
  "stylelint-no-unsupported-browser-features": "8.0.1",
58
58
  "tailwindcss": "3.4.4",
59
59
  "unhead": "1.9.14",
60
- "vue": "3.4.30",
60
+ "vue": "3.4.31",
61
61
  "vue-router": "4.4.0"
62
62
  },
63
63
  "engines": {
@@ -87,7 +87,7 @@
87
87
  "name": "@dargmuesli/nuxt-vio",
88
88
  "peerDependencies": {
89
89
  "nuxt": "3.12.2",
90
- "vue": "3.4.30",
90
+ "vue": "3.4.31",
91
91
  "vue-router": "4.4.0"
92
92
  },
93
93
  "publishConfig": {
@@ -116,5 +116,5 @@
116
116
  "start:static": "serve .playground/.output/public --ssl-cert ./.config/certificates/ssl.crt --ssl-key ./.config/certificates/ssl.key"
117
117
  },
118
118
  "type": "module",
119
- "version": "13.1.8"
119
+ "version": "13.1.9"
120
120
  }
@@ -0,0 +1,14 @@
1
+ import type { H3Event } from 'h3'
2
+ import { TESTING_COOKIE_NAME } from '../../utils/constants'
3
+
4
+ export const isTestingServer = (event?: H3Event) => {
5
+ const isTestingByRuntimeConfig = useRuntimeConfig().public.vio.isTesting
6
+
7
+ if (isTestingByRuntimeConfig) return true
8
+
9
+ if (event) {
10
+ const isTestingByCookie = !!getCookie(event, TESTING_COOKIE_NAME)
11
+
12
+ if (isTestingByCookie) return true
13
+ }
14
+ }
@@ -14,9 +14,7 @@ export const getTimezoneServer = async (event: H3Event) => {
14
14
 
15
15
  const ip = getRequestIP(event, { xForwardedFor: true })
16
16
 
17
- console.log(`X-Real-IP: ${ip}`) // TODO: remove once traefik setup is clear
18
-
19
- if (ip && !Array.isArray(ip)) {
17
+ if (ip) {
20
18
  const timezoneByIpApi = await getTimezoneByIpApi(ip)
21
19
 
22
20
  if (timezoneByIpApi) return timezoneByIpApi
@@ -24,6 +22,8 @@ export const getTimezoneServer = async (event: H3Event) => {
24
22
  }
25
23
 
26
24
  export const getTimezoneByIpApi = async (ip: string) => {
25
+ if (isTestingServer()) return // TODO: mock
26
+
27
27
  const ipApiResult = await $fetch<{ timezone: string }>(
28
28
  `http://ip-api.com/json/${ip}`,
29
29
  ).catch(() => {})
@@ -156,6 +156,7 @@ export const POLYFILLS = [
156
156
  ]
157
157
  export const REGEX_UUID =
158
158
  /^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$/
159
+ export const TESTING_COOKIE_NAME = 'vio_is-testing'
159
160
  export const TIMEZONE_COOKIE_NAME = [COOKIE_PREFIX, 'tz'].join(COOKIE_SEPARATOR)
160
161
  export const TIMEZONE_HEADER_KEY = `X-${SITE_NAME}-Timezone`
161
162
  export const TITLE_TEMPLATE = ({