@dargmuesli/nuxt-vio 13.1.8 → 13.1.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -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/nuxt.config.ts CHANGED
@@ -235,6 +235,7 @@ export default defineNuxtConfig(
235
235
  ssg: {
236
236
  hashStyles: true,
237
237
  },
238
+ strict: true,
238
239
  },
239
240
  seo: {
240
241
  splash: false,
package/package.json CHANGED
@@ -22,7 +22,7 @@
22
22
  "@vuelidate/validators": "2.0.4",
23
23
  "clipboardy": "4.0.0",
24
24
  "dayjs": "2.0.0-alpha.4",
25
- "eslint": "9.5.0",
25
+ "eslint": "9.6.0",
26
26
  "eslint-config-prettier": "9.1.0",
27
27
  "eslint-plugin-compat": "5.0.0",
28
28
  "eslint-plugin-prettier": "5.1.3",
@@ -30,8 +30,8 @@
30
30
  "globals": "15.6.0",
31
31
  "jose": "5.6.2",
32
32
  "nuxt-gtag": "2.0.6",
33
- "nuxt-security": "1.4.3",
34
- "sweetalert2": "11.12.0",
33
+ "nuxt-security": "2.0.0-rc.9",
34
+ "sweetalert2": "11.12.1",
35
35
  "vue-tsc": "2.0.22"
36
36
  },
37
37
  "devDependencies": {
@@ -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.10"
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 = ({