Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: moldypenguins/nuxt-gsuite
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.1.3
Choose a base ref
...
head repository: moldypenguins/nuxt-gsuite
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.1.4
Choose a head ref
  • 4 commits
  • 10 files changed
  • 1 contributor

Commits on Jul 6, 2024

  1. updates

    moldypenguins committed Jul 6, 2024
    Copy the full SHA
    773559d View commit details
  2. chore(release): v0.1.3

    moldypenguins committed Jul 6, 2024
    Copy the full SHA
    e6327fc View commit details
  3. updates

    moldypenguins committed Jul 6, 2024
    Copy the full SHA
    c9a1b9c View commit details
  4. chore(release): v0.1.4

    moldypenguins committed Jul 6, 2024
    Copy the full SHA
    42cf5b5 View commit details
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
# Changelog


## v0.1.4

[compare changes](https://github.com/moldypenguins/nuxt-gsuite/compare/v0.1.3...v0.1.4)

### 🏡 Chore

- **release:** V0.1.3 ([e6327fc](https://github.com/moldypenguins/nuxt-gsuite/commit/e6327fc))

### ❤️ Contributors

- Craig Roberts ([@moldypenguins](http://github.com/moldypenguins))

## v0.1.3

[compare changes](https://github.com/moldypenguins/nuxt-gsuite/compare/v0.1.3...v0.1.3)

## v0.1.3

[compare changes](https://github.com/moldypenguins/nuxt-gsuite/compare/v0.1.2...v0.1.3)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "nuxt-gsuite",
"type": "module",
"version": "0.1.3",
"version": "0.1.4",
"description": "Nuxt 3 Google Module",
"author": "Craig Roberts <craig.roberts@crdevel.com> (https://crdevel.com)",
"license": "MIT",
2 changes: 1 addition & 1 deletion playground/.output/nitro.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"date": "2024-07-06T18:13:24.549Z",
"date": "2024-07-06T18:39:16.510Z",
"preset": "node-server",
"framework": {
"name": "nuxt",
2 changes: 1 addition & 1 deletion playground/.output/public/_nuxt/builds/latest.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"id":"292d48f5-a1a3-449e-9846-880116a142d2","timestamp":1720289589196}
{"id":"bc5a8608-22bf-4b69-aa0c-1df0c99cd47b","timestamp":1720291145313}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"id":"bc5a8608-22bf-4b69-aa0c-1df0c99cd47b","timestamp":1720291145313,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
36 changes: 13 additions & 23 deletions playground/.output/server/chunks/runtime.mjs
Original file line number Diff line number Diff line change
@@ -3933,7 +3933,7 @@ const appConfig = defuFn(inlineAppConfig);
const _inlineRuntimeConfig = {
"app": {
"baseURL": "/",
"buildId": "292d48f5-a1a3-449e-9846-880116a142d2",
"buildId": "bc5a8608-22bf-4b69-aa0c-1df0c99cd47b",
"buildAssetsDir": "/_nuxt/",
"cdnURL": ""
},
@@ -5225,51 +5225,51 @@ const assets = {
"/_nuxt/DTJR8xyR.js": {
"type": "text/javascript; charset=utf-8",
"etag": "\"ab3-Hw66/AuMN7HMNh9DcWfIMGZKWNs\"",
"mtime": "2024-07-06T18:13:15.167Z",
"mtime": "2024-07-06T18:39:09.442Z",
"size": 2739,
"path": "../public/_nuxt/DTJR8xyR.js"
},
"/_nuxt/error-404.CPoJt-Mw.css": {
"type": "text/css; charset=utf-8",
"etag": "\"de4-HoYY+VULRLxo9INpsMyVuP/BSaU\"",
"mtime": "2024-07-06T18:13:15.167Z",
"mtime": "2024-07-06T18:39:09.442Z",
"size": 3556,
"path": "../public/_nuxt/error-404.CPoJt-Mw.css"
},
"/_nuxt/error-500.CRm5MgNe.css": {
"type": "text/css; charset=utf-8",
"etag": "\"75c-aZv8f9SzIABfsNN4kJWna4Zm66U\"",
"mtime": "2024-07-06T18:13:15.163Z",
"mtime": "2024-07-06T18:39:09.442Z",
"size": 1884,
"path": "../public/_nuxt/error-500.CRm5MgNe.css"
},
"/_nuxt/q-QPnIUX.js": {
"type": "text/javascript; charset=utf-8",
"etag": "\"1cb4b-LfjiVsggRq6ZnMvHUjnTaQO27mw\"",
"mtime": "2024-07-06T18:13:15.167Z",
"mtime": "2024-07-06T18:39:09.446Z",
"size": 117579,
"path": "../public/_nuxt/q-QPnIUX.js"
},
"/_nuxt/tr5hBR7C.js": {
"type": "text/javascript; charset=utf-8",
"etag": "\"200e-BFrr+q4DJEzbhPzMloMYcz7GmTk\"",
"mtime": "2024-07-06T18:13:15.167Z",
"mtime": "2024-07-06T18:39:09.445Z",
"size": 8206,
"path": "../public/_nuxt/tr5hBR7C.js"
},
"/_nuxt/builds/latest.json": {
"type": "application/json",
"etag": "\"47-ua3aHiLcf4MppjA4T6nIMNs8Adk\"",
"mtime": "2024-07-06T18:13:16.186Z",
"etag": "\"47-GXLwlM+ez1qiC1kTpOGrYeDFH54\"",
"mtime": "2024-07-06T18:39:10.219Z",
"size": 71,
"path": "../public/_nuxt/builds/latest.json"
},
"/_nuxt/builds/meta/292d48f5-a1a3-449e-9846-880116a142d2.json": {
"/_nuxt/builds/meta/bc5a8608-22bf-4b69-aa0c-1df0c99cd47b.json": {
"type": "application/json",
"etag": "\"8b-poaS9IuwCsVzAuJSsAA8rOcdxSA\"",
"mtime": "2024-07-06T18:13:16.187Z",
"etag": "\"8b-0HdWIVig2zpYI10FaXgmY7jkMwY\"",
"mtime": "2024-07-06T18:39:10.219Z",
"size": 139,
"path": "../public/_nuxt/builds/meta/292d48f5-a1a3-449e-9846-880116a142d2.json"
"path": "../public/_nuxt/builds/meta/bc5a8608-22bf-4b69-aa0c-1df0c99cd47b.json"
}
};

@@ -5469,21 +5469,11 @@ const _f4b49z = eventHandler((event) => {
const _69Te4e = defineEventHandler(async (event) => {
const { recaptcha } = useRuntimeConfig().gsuite;
const token = getRouterParam(event, "token");
const verification = await $fetch(`https://www.google.com/recaptcha/api/siteverify`, {
return await $fetch(`https://www.google.com/recaptcha/api/siteverify`, {
method: "POST",
headers: { "Content-Type": "application/x-www-form-urlencoded" },
body: `secret=${recaptcha.secretKey}&response=${token}`
});
if (verification.success === false) {
if (verification["error-codes"] && verification["error-codes"].length > 0) {
return { valid: false, errors: verification["error-codes"] };
} else {
return { valid: false, errors: ["Unknown Error."] };
}
} else if (verification.success === true && verification.score && verification.score < recaptcha.minScore) {
return { valid: false, errors: ["Suspected Bot."] };
}
return { valid: true };
});

const _lazy_ICNCMO = () => import('./routes/renderer.mjs').then(function (n) { return n.r; });
2 changes: 1 addition & 1 deletion playground/.output/server/package.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"name":"nuxt-gsuite-prod","version":"0.1.1","type":"module","private":true,"dependencies":{"@babel/parser":"7.24.7","@unhead/dom":"1.9.15","@unhead/shared":"1.9.15","@unhead/ssr":"1.9.15","@vue/compiler-core":"3.4.31","@vue/compiler-dom":"3.4.31","@vue/compiler-ssr":"3.4.31","@vue/reactivity":"3.4.31","@vue/runtime-core":"3.4.31","@vue/runtime-dom":"3.4.31","@vue/server-renderer":"3.4.31","@vue/shared":"3.4.31","devalue":"5.0.0","entities":"4.5.0","estree-walker":"2.0.2","hookable":"5.5.3","source-map-js":"1.2.0","ufo":"1.5.3","unhead":"1.9.15","vue":"3.4.31","vue-bundle-renderer":"2.1.0"}}
{"name":"nuxt-gsuite-prod","version":"0.1.2","type":"module","private":true,"dependencies":{"@babel/parser":"7.24.7","@unhead/dom":"1.9.15","@unhead/shared":"1.9.15","@unhead/ssr":"1.9.15","@vue/compiler-core":"3.4.31","@vue/compiler-dom":"3.4.31","@vue/compiler-ssr":"3.4.31","@vue/reactivity":"3.4.31","@vue/runtime-core":"3.4.31","@vue/runtime-dom":"3.4.31","@vue/server-renderer":"3.4.31","@vue/shared":"3.4.31","devalue":"5.0.0","entities":"4.5.0","estree-walker":"2.0.2","hookable":"5.5.3","source-map-js":"1.2.0","ufo":"1.5.3","unhead":"1.9.15","vue":"3.4.31","vue-bundle-renderer":"2.1.0"}}
4 changes: 2 additions & 2 deletions src/module.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import process from 'node:process'
import { addImports, addPlugin, addServerHandler, createResolver, defineNuxtModule, logger } from '@nuxt/kit'
import defu from 'defu'
import type { NuxtGSuiteOptions } from './types'
import type { NuxtGSuiteOptions, RecaptchaResponse } from './types'

export * from './types'
export { type RecaptchaResponse }

declare module '#app' {
const grecaptcha: any
17 changes: 2 additions & 15 deletions src/runtime/server/routes/recaptcha/[token].get.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,13 @@
import type { RecaptchaResponse } from '../../../../types'
import { defineEventHandler, getRouterParam, useRuntimeConfig } from '#imports'

export default defineEventHandler(async (event) => {
const { recaptcha } = useRuntimeConfig().gsuite
const token = getRouterParam(event, 'token')

const verification = await $fetch<RecaptchaResponse>(`https://www.google.com/recaptcha/api/siteverify`, {
return await $fetch<RecaptchaResponse>(`https://www.google.com/recaptcha/api/siteverify`, {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `secret=${recaptcha.secretKey}&response=${token}`,
})

if (verification.success === false) {
if (verification['error-codes'] && verification['error-codes'].length > 0) {
return { valid: false, errors: verification['error-codes'] }
}
else {
return { valid: false, errors: ['Unknown Error.'] }
}
}
else if (verification.success === true && verification.score && verification.score < recaptcha.minScore) {
return { valid: false, errors: ['Suspected Bot.'] }
}

return { valid: true }
})