Merge pull request #62 from aaronpo97/security-fixes

fix and upgrade: bump next js to v14, remove public mapbox token
This commit is contained in:
Aaron Po
2023-11-24 00:09:38 -05:00
committed by GitHub
6 changed files with 131 additions and 112 deletions

View File

@@ -168,11 +168,8 @@ SPARKPOST_SENDER_ADDRESS=" > .env
migrations to detect schema drift. migrations to detect schema drift.
- You can create a free account [here](https://neon.tech). - You can create a free account [here](https://neon.tech).
- Consult the [docs](https://neon.tech/docs/guides/prisma) for more information. - Consult the [docs](https://neon.tech/docs/guides/prisma) for more information.
- `MAPBOX_ACCESS_TOKEN` and `NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN` are the access tokens for - `MAPBOX_ACCESS_TOKEN` is the access token for your Mapbox account.
your Mapbox account.
- You can create a free account [here](https://account.mapbox.com/auth/signup/). - You can create a free account [here](https://account.mapbox.com/auth/signup/).
- You will need to create two access tokens, one for the server-side and one for the
client-side.
- `NODE_ENV` is the environment in which the application is running. - `NODE_ENV` is the environment in which the application is running.
- You can set this to `development` or `production`. - You can set this to `development` or `production`.
- `SPARKPOST_API_KEY` is the API key for your SparkPost account. - `SPARKPOST_API_KEY` is the API key for your SparkPost account.

190
package-lock.json generated
View File

@@ -31,7 +31,7 @@
"mapbox-gl": "^2.15.0", "mapbox-gl": "^2.15.0",
"multer": "^1.4.5-lts.1", "multer": "^1.4.5-lts.1",
"multer-storage-cloudinary": "^4.0.0", "multer-storage-cloudinary": "^4.0.0",
"next": "^13.5.4", "next": "^14.0.0",
"next-connect": "^1.0.0-next.3", "next-connect": "^1.0.0-next.3",
"passport": "^0.6.0", "passport": "^0.6.0",
"passport-local": "^1.0.0", "passport-local": "^1.0.0",
@@ -51,7 +51,7 @@
"zod": "^3.21.4" "zod": "^3.21.4"
}, },
"devDependencies": { "devDependencies": {
"@faker-js/faker": "^8.0.2", "@faker-js/faker": "^8.3.1",
"@types/cookie": "^0.5.1", "@types/cookie": "^0.5.1",
"@types/jsonwebtoken": "^9.0.2", "@types/jsonwebtoken": "^9.0.2",
"@types/lodash": "^4.14.195", "@types/lodash": "^4.14.195",
@@ -697,9 +697,9 @@
} }
}, },
"node_modules/@faker-js/faker": { "node_modules/@faker-js/faker": {
"version": "8.1.0", "version": "8.3.1",
"resolved": "https://registry.npmjs.org/@faker-js/faker/-/faker-8.1.0.tgz", "resolved": "https://registry.npmjs.org/@faker-js/faker/-/faker-8.3.1.tgz",
"integrity": "sha512-38DT60rumHfBYynif3lmtxMqMqmsOQIxQgEuPZxCk2yUYN0eqWpTACgxi0VpidvsJB8CRxCpvP7B3anK85FjtQ==", "integrity": "sha512-FdgpFxY6V6rLZE9mmIBb9hM0xpfvQOSNOLnzolzKwsE1DH+gC7lEKV1p1IbR0lAYyvYd5a4u3qWJzowUkw1bIw==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@@ -1245,9 +1245,9 @@
} }
}, },
"node_modules/@next/env": { "node_modules/@next/env": {
"version": "13.5.6", "version": "14.0.0",
"resolved": "https://registry.npmjs.org/@next/env/-/env-13.5.6.tgz", "resolved": "https://registry.npmjs.org/@next/env/-/env-14.0.0.tgz",
"integrity": "sha512-Yac/bV5sBGkkEXmAX5FWPS9Mmo2rthrOPRQQNfycJPkjUAUclomCPH7QFVCDQ4Mp2k2K1SSM6m0zrxYrOwtFQw==" "integrity": "sha512-cIKhxkfVELB6hFjYsbtEeTus2mwrTC+JissfZYM0n+8Fv+g8ucUfOlm3VEDtwtwydZ0Nuauv3bl0qF82nnCAqA=="
}, },
"node_modules/@next/eslint-plugin-next": { "node_modules/@next/eslint-plugin-next": {
"version": "13.5.4", "version": "13.5.4",
@@ -1259,9 +1259,9 @@
} }
}, },
"node_modules/@next/swc-darwin-arm64": { "node_modules/@next/swc-darwin-arm64": {
"version": "13.5.6", "version": "14.0.0",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.5.6.tgz", "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.0.0.tgz",
"integrity": "sha512-5nvXMzKtZfvcu4BhtV0KH1oGv4XEW+B+jOfmBdpFI3C7FrB/MfujRpWYSBBO64+qbW8pkZiSyQv9eiwnn5VIQA==", "integrity": "sha512-HQKi159jCz4SRsPesVCiNN6tPSAFUkOuSkpJsqYTIlbHLKr1mD6be/J0TvWV6fwJekj81bZV9V/Tgx3C2HO9lA==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -1274,9 +1274,9 @@
} }
}, },
"node_modules/@next/swc-darwin-x64": { "node_modules/@next/swc-darwin-x64": {
"version": "13.5.6", "version": "14.0.0",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.5.6.tgz", "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.0.0.tgz",
"integrity": "sha512-6cgBfxg98oOCSr4BckWjLLgiVwlL3vlLj8hXg2b+nDgm4bC/qVXXLfpLB9FHdoDu4057hzywbxKvmYGmi7yUzA==", "integrity": "sha512-4YyQLMSaCgX/kgC1jjF3s3xSoBnwHuDhnF6WA1DWNEYRsbOOPWjcYhv8TKhRe2ApdOam+VfQSffC4ZD+X4u1Cg==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -1289,9 +1289,9 @@
} }
}, },
"node_modules/@next/swc-linux-arm64-gnu": { "node_modules/@next/swc-linux-arm64-gnu": {
"version": "13.5.6", "version": "14.0.0",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.5.6.tgz", "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.0.0.tgz",
"integrity": "sha512-txagBbj1e1w47YQjcKgSU4rRVQ7uF29YpnlHV5xuVUsgCUf2FmyfJ3CPjZUvpIeXCJAoMCFAoGnbtX86BK7+sg==", "integrity": "sha512-io7fMkJ28Glj7SH8yvnlD6naIhRDnDxeE55CmpQkj3+uaA2Hko6WGY2pT5SzpQLTnGGnviK85cy8EJ2qsETj/g==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -1304,9 +1304,9 @@
} }
}, },
"node_modules/@next/swc-linux-arm64-musl": { "node_modules/@next/swc-linux-arm64-musl": {
"version": "13.5.6", "version": "14.0.0",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.5.6.tgz", "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.0.0.tgz",
"integrity": "sha512-cGd+H8amifT86ZldVJtAKDxUqeFyLWW+v2NlBULnLAdWsiuuN8TuhVBt8ZNpCqcAuoruoSWynvMWixTFcroq+Q==", "integrity": "sha512-nC2h0l1Jt8LEzyQeSs/BKpXAMe0mnHIMykYALWaeddTqCv5UEN8nGO3BG8JAqW/Y8iutqJsaMe2A9itS0d/r8w==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -1319,9 +1319,9 @@
} }
}, },
"node_modules/@next/swc-linux-x64-gnu": { "node_modules/@next/swc-linux-x64-gnu": {
"version": "13.5.6", "version": "14.0.0",
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.5.6.tgz", "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.0.0.tgz",
"integrity": "sha512-Mc2b4xiIWKXIhBy2NBTwOxGD3nHLmq4keFk+d4/WL5fMsB8XdJRdtUlL87SqVCTSaf1BRuQQf1HvXZcy+rq3Nw==", "integrity": "sha512-Wf+WjXibJQ7hHXOdNOmSMW5bxeJHVf46Pwb3eLSD2L76NrytQlif9NH7JpHuFlYKCQGfKfgSYYre5rIfmnSwQw==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -1334,9 +1334,9 @@
} }
}, },
"node_modules/@next/swc-linux-x64-musl": { "node_modules/@next/swc-linux-x64-musl": {
"version": "13.5.6", "version": "14.0.0",
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.5.6.tgz", "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.0.0.tgz",
"integrity": "sha512-CFHvP9Qz98NruJiUnCe61O6GveKKHpJLloXbDSWRhqhkJdZD2zU5hG+gtVJR//tyW897izuHpM6Gtf6+sNgJPQ==", "integrity": "sha512-WTZb2G7B+CTsdigcJVkRxfcAIQj7Lf0ipPNRJ3vlSadU8f0CFGv/ST+sJwF5eSwIe6dxKoX0DG6OljDBaad+rg==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -1349,9 +1349,9 @@
} }
}, },
"node_modules/@next/swc-win32-arm64-msvc": { "node_modules/@next/swc-win32-arm64-msvc": {
"version": "13.5.6", "version": "14.0.0",
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.5.6.tgz", "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.0.0.tgz",
"integrity": "sha512-aFv1ejfkbS7PUa1qVPwzDHjQWQtknzAZWGTKYIAaS4NMtBlk3VyA6AYn593pqNanlicewqyl2jUhQAaFV/qXsg==", "integrity": "sha512-7R8/x6oQODmNpnWVW00rlWX90sIlwluJwcvMT6GXNIBOvEf01t3fBg0AGURNKdTJg2xNuP7TyLchCL7Lh2DTiw==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -1364,9 +1364,9 @@
} }
}, },
"node_modules/@next/swc-win32-ia32-msvc": { "node_modules/@next/swc-win32-ia32-msvc": {
"version": "13.5.6", "version": "14.0.0",
"resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.5.6.tgz", "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.0.0.tgz",
"integrity": "sha512-XqqpHgEIlBHvzwG8sp/JXMFkLAfGLqkbVsyN+/Ih1mR8INb6YCc2x/Mbwi6hsAgUnqQztz8cvEbHJUbSl7RHDg==", "integrity": "sha512-RLK1nELvhCnxaWPF07jGU4x3tjbyx2319q43loZELqF0+iJtKutZ+Lk8SVmf/KiJkYBc7Cragadz7hb3uQvz4g==",
"cpu": [ "cpu": [
"ia32" "ia32"
], ],
@@ -1379,9 +1379,9 @@
} }
}, },
"node_modules/@next/swc-win32-x64-msvc": { "node_modules/@next/swc-win32-x64-msvc": {
"version": "13.5.6", "version": "14.0.0",
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.5.6.tgz", "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.0.0.tgz",
"integrity": "sha512-Cqfe1YmOS7k+5mGu92nl5ULkzpKuxJrP3+4AEuPmrpFZ3BHxTY3TnHmU1On3bFmFFs6FbTcdF58CCUProGpIGQ==", "integrity": "sha512-g6hLf1SUko+hnnaywQQZzzb3BRecQsoKkF3o/C+F+dOA4w/noVAJngUVkfwF0+2/8FzNznM7ofM6TGZO9svn7w==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -7514,11 +7514,11 @@
"dev": true "dev": true
}, },
"node_modules/next": { "node_modules/next": {
"version": "13.5.6", "version": "14.0.0",
"resolved": "https://registry.npmjs.org/next/-/next-13.5.6.tgz", "resolved": "https://registry.npmjs.org/next/-/next-14.0.0.tgz",
"integrity": "sha512-Y2wTcTbO4WwEsVb4A8VSnOsG1I9ok+h74q0ZdxkwM3EODqrs4pasq7O0iUxbcS9VtWMicG7f3+HAj0r1+NtKSw==", "integrity": "sha512-J0jHKBJpB9zd4+c153sair0sz44mbaCHxggs8ryVXSFBuBqJ8XdE9/ozoV85xGh2VnSjahwntBZZgsihL9QznA==",
"dependencies": { "dependencies": {
"@next/env": "13.5.6", "@next/env": "14.0.0",
"@swc/helpers": "0.5.2", "@swc/helpers": "0.5.2",
"busboy": "1.6.0", "busboy": "1.6.0",
"caniuse-lite": "^1.0.30001406", "caniuse-lite": "^1.0.30001406",
@@ -7530,18 +7530,18 @@
"next": "dist/bin/next" "next": "dist/bin/next"
}, },
"engines": { "engines": {
"node": ">=16.14.0" "node": ">=18.17.0"
}, },
"optionalDependencies": { "optionalDependencies": {
"@next/swc-darwin-arm64": "13.5.6", "@next/swc-darwin-arm64": "14.0.0",
"@next/swc-darwin-x64": "13.5.6", "@next/swc-darwin-x64": "14.0.0",
"@next/swc-linux-arm64-gnu": "13.5.6", "@next/swc-linux-arm64-gnu": "14.0.0",
"@next/swc-linux-arm64-musl": "13.5.6", "@next/swc-linux-arm64-musl": "14.0.0",
"@next/swc-linux-x64-gnu": "13.5.6", "@next/swc-linux-x64-gnu": "14.0.0",
"@next/swc-linux-x64-musl": "13.5.6", "@next/swc-linux-x64-musl": "14.0.0",
"@next/swc-win32-arm64-msvc": "13.5.6", "@next/swc-win32-arm64-msvc": "14.0.0",
"@next/swc-win32-ia32-msvc": "13.5.6", "@next/swc-win32-ia32-msvc": "14.0.0",
"@next/swc-win32-x64-msvc": "13.5.6" "@next/swc-win32-x64-msvc": "14.0.0"
}, },
"peerDependencies": { "peerDependencies": {
"@opentelemetry/api": "^1.1.0", "@opentelemetry/api": "^1.1.0",
@@ -11126,9 +11126,9 @@
"dev": true "dev": true
}, },
"@faker-js/faker": { "@faker-js/faker": {
"version": "8.1.0", "version": "8.3.1",
"resolved": "https://registry.npmjs.org/@faker-js/faker/-/faker-8.1.0.tgz", "resolved": "https://registry.npmjs.org/@faker-js/faker/-/faker-8.3.1.tgz",
"integrity": "sha512-38DT60rumHfBYynif3lmtxMqMqmsOQIxQgEuPZxCk2yUYN0eqWpTACgxi0VpidvsJB8CRxCpvP7B3anK85FjtQ==", "integrity": "sha512-FdgpFxY6V6rLZE9mmIBb9hM0xpfvQOSNOLnzolzKwsE1DH+gC7lEKV1p1IbR0lAYyvYd5a4u3qWJzowUkw1bIw==",
"dev": true "dev": true
}, },
"@floating-ui/core": { "@floating-ui/core": {
@@ -11552,9 +11552,9 @@
} }
}, },
"@next/env": { "@next/env": {
"version": "13.5.6", "version": "14.0.0",
"resolved": "https://registry.npmjs.org/@next/env/-/env-13.5.6.tgz", "resolved": "https://registry.npmjs.org/@next/env/-/env-14.0.0.tgz",
"integrity": "sha512-Yac/bV5sBGkkEXmAX5FWPS9Mmo2rthrOPRQQNfycJPkjUAUclomCPH7QFVCDQ4Mp2k2K1SSM6m0zrxYrOwtFQw==" "integrity": "sha512-cIKhxkfVELB6hFjYsbtEeTus2mwrTC+JissfZYM0n+8Fv+g8ucUfOlm3VEDtwtwydZ0Nuauv3bl0qF82nnCAqA=="
}, },
"@next/eslint-plugin-next": { "@next/eslint-plugin-next": {
"version": "13.5.4", "version": "13.5.4",
@@ -11566,57 +11566,57 @@
} }
}, },
"@next/swc-darwin-arm64": { "@next/swc-darwin-arm64": {
"version": "13.5.6", "version": "14.0.0",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.5.6.tgz", "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.0.0.tgz",
"integrity": "sha512-5nvXMzKtZfvcu4BhtV0KH1oGv4XEW+B+jOfmBdpFI3C7FrB/MfujRpWYSBBO64+qbW8pkZiSyQv9eiwnn5VIQA==", "integrity": "sha512-HQKi159jCz4SRsPesVCiNN6tPSAFUkOuSkpJsqYTIlbHLKr1mD6be/J0TvWV6fwJekj81bZV9V/Tgx3C2HO9lA==",
"optional": true "optional": true
}, },
"@next/swc-darwin-x64": { "@next/swc-darwin-x64": {
"version": "13.5.6", "version": "14.0.0",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.5.6.tgz", "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.0.0.tgz",
"integrity": "sha512-6cgBfxg98oOCSr4BckWjLLgiVwlL3vlLj8hXg2b+nDgm4bC/qVXXLfpLB9FHdoDu4057hzywbxKvmYGmi7yUzA==", "integrity": "sha512-4YyQLMSaCgX/kgC1jjF3s3xSoBnwHuDhnF6WA1DWNEYRsbOOPWjcYhv8TKhRe2ApdOam+VfQSffC4ZD+X4u1Cg==",
"optional": true "optional": true
}, },
"@next/swc-linux-arm64-gnu": { "@next/swc-linux-arm64-gnu": {
"version": "13.5.6", "version": "14.0.0",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.5.6.tgz", "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.0.0.tgz",
"integrity": "sha512-txagBbj1e1w47YQjcKgSU4rRVQ7uF29YpnlHV5xuVUsgCUf2FmyfJ3CPjZUvpIeXCJAoMCFAoGnbtX86BK7+sg==", "integrity": "sha512-io7fMkJ28Glj7SH8yvnlD6naIhRDnDxeE55CmpQkj3+uaA2Hko6WGY2pT5SzpQLTnGGnviK85cy8EJ2qsETj/g==",
"optional": true "optional": true
}, },
"@next/swc-linux-arm64-musl": { "@next/swc-linux-arm64-musl": {
"version": "13.5.6", "version": "14.0.0",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.5.6.tgz", "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.0.0.tgz",
"integrity": "sha512-cGd+H8amifT86ZldVJtAKDxUqeFyLWW+v2NlBULnLAdWsiuuN8TuhVBt8ZNpCqcAuoruoSWynvMWixTFcroq+Q==", "integrity": "sha512-nC2h0l1Jt8LEzyQeSs/BKpXAMe0mnHIMykYALWaeddTqCv5UEN8nGO3BG8JAqW/Y8iutqJsaMe2A9itS0d/r8w==",
"optional": true "optional": true
}, },
"@next/swc-linux-x64-gnu": { "@next/swc-linux-x64-gnu": {
"version": "13.5.6", "version": "14.0.0",
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.5.6.tgz", "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.0.0.tgz",
"integrity": "sha512-Mc2b4xiIWKXIhBy2NBTwOxGD3nHLmq4keFk+d4/WL5fMsB8XdJRdtUlL87SqVCTSaf1BRuQQf1HvXZcy+rq3Nw==", "integrity": "sha512-Wf+WjXibJQ7hHXOdNOmSMW5bxeJHVf46Pwb3eLSD2L76NrytQlif9NH7JpHuFlYKCQGfKfgSYYre5rIfmnSwQw==",
"optional": true "optional": true
}, },
"@next/swc-linux-x64-musl": { "@next/swc-linux-x64-musl": {
"version": "13.5.6", "version": "14.0.0",
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.5.6.tgz", "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.0.0.tgz",
"integrity": "sha512-CFHvP9Qz98NruJiUnCe61O6GveKKHpJLloXbDSWRhqhkJdZD2zU5hG+gtVJR//tyW897izuHpM6Gtf6+sNgJPQ==", "integrity": "sha512-WTZb2G7B+CTsdigcJVkRxfcAIQj7Lf0ipPNRJ3vlSadU8f0CFGv/ST+sJwF5eSwIe6dxKoX0DG6OljDBaad+rg==",
"optional": true "optional": true
}, },
"@next/swc-win32-arm64-msvc": { "@next/swc-win32-arm64-msvc": {
"version": "13.5.6", "version": "14.0.0",
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.5.6.tgz", "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.0.0.tgz",
"integrity": "sha512-aFv1ejfkbS7PUa1qVPwzDHjQWQtknzAZWGTKYIAaS4NMtBlk3VyA6AYn593pqNanlicewqyl2jUhQAaFV/qXsg==", "integrity": "sha512-7R8/x6oQODmNpnWVW00rlWX90sIlwluJwcvMT6GXNIBOvEf01t3fBg0AGURNKdTJg2xNuP7TyLchCL7Lh2DTiw==",
"optional": true "optional": true
}, },
"@next/swc-win32-ia32-msvc": { "@next/swc-win32-ia32-msvc": {
"version": "13.5.6", "version": "14.0.0",
"resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.5.6.tgz", "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.0.0.tgz",
"integrity": "sha512-XqqpHgEIlBHvzwG8sp/JXMFkLAfGLqkbVsyN+/Ih1mR8INb6YCc2x/Mbwi6hsAgUnqQztz8cvEbHJUbSl7RHDg==", "integrity": "sha512-RLK1nELvhCnxaWPF07jGU4x3tjbyx2319q43loZELqF0+iJtKutZ+Lk8SVmf/KiJkYBc7Cragadz7hb3uQvz4g==",
"optional": true "optional": true
}, },
"@next/swc-win32-x64-msvc": { "@next/swc-win32-x64-msvc": {
"version": "13.5.6", "version": "14.0.0",
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.5.6.tgz", "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.0.0.tgz",
"integrity": "sha512-Cqfe1YmOS7k+5mGu92nl5ULkzpKuxJrP3+4AEuPmrpFZ3BHxTY3TnHmU1On3bFmFFs6FbTcdF58CCUProGpIGQ==", "integrity": "sha512-g6hLf1SUko+hnnaywQQZzzb3BRecQsoKkF3o/C+F+dOA4w/noVAJngUVkfwF0+2/8FzNznM7ofM6TGZO9svn7w==",
"optional": true "optional": true
}, },
"@nodelib/fs.scandir": { "@nodelib/fs.scandir": {
@@ -16082,20 +16082,20 @@
"dev": true "dev": true
}, },
"next": { "next": {
"version": "13.5.6", "version": "14.0.0",
"resolved": "https://registry.npmjs.org/next/-/next-13.5.6.tgz", "resolved": "https://registry.npmjs.org/next/-/next-14.0.0.tgz",
"integrity": "sha512-Y2wTcTbO4WwEsVb4A8VSnOsG1I9ok+h74q0ZdxkwM3EODqrs4pasq7O0iUxbcS9VtWMicG7f3+HAj0r1+NtKSw==", "integrity": "sha512-J0jHKBJpB9zd4+c153sair0sz44mbaCHxggs8ryVXSFBuBqJ8XdE9/ozoV85xGh2VnSjahwntBZZgsihL9QznA==",
"requires": { "requires": {
"@next/env": "13.5.6", "@next/env": "14.0.0",
"@next/swc-darwin-arm64": "13.5.6", "@next/swc-darwin-arm64": "14.0.0",
"@next/swc-darwin-x64": "13.5.6", "@next/swc-darwin-x64": "14.0.0",
"@next/swc-linux-arm64-gnu": "13.5.6", "@next/swc-linux-arm64-gnu": "14.0.0",
"@next/swc-linux-arm64-musl": "13.5.6", "@next/swc-linux-arm64-musl": "14.0.0",
"@next/swc-linux-x64-gnu": "13.5.6", "@next/swc-linux-x64-gnu": "14.0.0",
"@next/swc-linux-x64-musl": "13.5.6", "@next/swc-linux-x64-musl": "14.0.0",
"@next/swc-win32-arm64-msvc": "13.5.6", "@next/swc-win32-arm64-msvc": "14.0.0",
"@next/swc-win32-ia32-msvc": "13.5.6", "@next/swc-win32-ia32-msvc": "14.0.0",
"@next/swc-win32-x64-msvc": "13.5.6", "@next/swc-win32-x64-msvc": "14.0.0",
"@swc/helpers": "0.5.2", "@swc/helpers": "0.5.2",
"busboy": "1.6.0", "busboy": "1.6.0",
"caniuse-lite": "^1.0.30001406", "caniuse-lite": "^1.0.30001406",

View File

@@ -36,7 +36,7 @@
"mapbox-gl": "^2.15.0", "mapbox-gl": "^2.15.0",
"multer": "^1.4.5-lts.1", "multer": "^1.4.5-lts.1",
"multer-storage-cloudinary": "^4.0.0", "multer-storage-cloudinary": "^4.0.0",
"next": "^13.5.4", "next": "^14.0.0",
"next-connect": "^1.0.0-next.3", "next-connect": "^1.0.0-next.3",
"passport": "^0.6.0", "passport": "^0.6.0",
"passport-local": "^1.0.0", "passport-local": "^1.0.0",
@@ -56,7 +56,7 @@
"zod": "^3.21.4" "zod": "^3.21.4"
}, },
"devDependencies": { "devDependencies": {
"@faker-js/faker": "^8.0.2", "@faker-js/faker": "^8.3.1",
"@types/cookie": "^0.5.1", "@types/cookie": "^0.5.1",
"@types/jsonwebtoken": "^9.0.2", "@types/jsonwebtoken": "^9.0.2",
"@types/lodash": "^4.14.195", "@types/lodash": "^4.14.195",

View File

@@ -7,12 +7,15 @@ import LocationMarker from '../ui/LocationMarker';
import ControlPanel from '../ui/maps/ControlPanel'; import ControlPanel from '../ui/maps/ControlPanel';
interface BreweryMapProps { interface BreweryMapProps {
latitude: number; coordinates: { latitude: number; longitude: number };
longitude: number; token: string;
} }
type MapStyles = Record<'light' | 'dark', `mapbox://styles/mapbox/${string}`>; type MapStyles = Record<'light' | 'dark', `mapbox://styles/mapbox/${string}`>;
const BreweryPostMap: FC<BreweryMapProps> = ({ latitude, longitude }) => { const BreweryPostMap: FC<BreweryMapProps> = ({
coordinates: { latitude, longitude },
token,
}) => {
const isDesktop = useMediaQuery('(min-width: 1024px)'); const isDesktop = useMediaQuery('(min-width: 1024px)');
const windowIsDefined = typeof window !== 'undefined'; const windowIsDefined = typeof window !== 'undefined';
@@ -43,7 +46,7 @@ const BreweryPostMap: FC<BreweryMapProps> = ({ latitude, longitude }) => {
initialViewState={{ latitude, longitude, zoom: 17 }} initialViewState={{ latitude, longitude, zoom: 17 }}
style={{ width: '100%', height: isDesktop ? 480 : 240 }} style={{ width: '100%', height: isDesktop ? 480 : 240 }}
mapStyle={mapStyles[theme]} mapStyle={mapStyles[theme]}
mapboxAccessToken={process.env.NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN as string} mapboxAccessToken={token}
scrollZoom scrollZoom
> >
<ControlPanel /> <ControlPanel />

View File

@@ -11,6 +11,7 @@ import useMediaQuery from '@/hooks/utilities/useMediaQuery';
import { Tab } from '@headlessui/react'; import { Tab } from '@headlessui/react';
import dynamic from 'next/dynamic'; import dynamic from 'next/dynamic';
import { MAPBOX_ACCESS_TOKEN } from '@/config/env';
const [BreweryInfoHeader, BreweryBeersSection, BreweryCommentsSection, BreweryPostMap] = [ const [BreweryInfoHeader, BreweryBeersSection, BreweryCommentsSection, BreweryPostMap] = [
dynamic(() => import('@/components/BreweryById/BreweryInfoHeader')), dynamic(() => import('@/components/BreweryById/BreweryInfoHeader')),
@@ -21,9 +22,10 @@ const [BreweryInfoHeader, BreweryBeersSection, BreweryCommentsSection, BreweryPo
interface BreweryPageProps { interface BreweryPageProps {
breweryPost: z.infer<typeof BreweryPostQueryResult>; breweryPost: z.infer<typeof BreweryPostQueryResult>;
mapboxToken: string;
} }
const BreweryByIdPage: NextPage<BreweryPageProps> = ({ breweryPost }) => { const BreweryByIdPage: NextPage<BreweryPageProps> = ({ breweryPost, mapboxToken }) => {
const [longitude, latitude] = breweryPost.location.coordinates; const [longitude, latitude] = breweryPost.location.coordinates;
const isDesktop = useMediaQuery('(min-width: 1024px)'); const isDesktop = useMediaQuery('(min-width: 1024px)');
return ( return (
@@ -67,13 +69,19 @@ const BreweryByIdPage: NextPage<BreweryPageProps> = ({ breweryPost }) => {
<BreweryCommentsSection breweryPost={breweryPost} /> <BreweryCommentsSection breweryPost={breweryPost} />
</div> </div>
<div className="w-[40%] space-y-3"> <div className="w-[40%] space-y-3">
<BreweryPostMap latitude={latitude} longitude={longitude} /> <BreweryPostMap
coordinates={{ latitude, longitude }}
token={mapboxToken}
/>
<BreweryBeersSection breweryPost={breweryPost} /> <BreweryBeersSection breweryPost={breweryPost} />
</div> </div>
</div> </div>
) : ( ) : (
<> <>
<BreweryPostMap latitude={latitude} longitude={longitude} /> <BreweryPostMap
coordinates={{ latitude, longitude }}
token={mapboxToken}
/>
<Tab.Group> <Tab.Group>
<Tab.List className="tabs tabs-boxed items-center justify-center rounded-2xl"> <Tab.List className="tabs tabs-boxed items-center justify-center rounded-2xl">
<Tab className="tab tab-md w-1/2 uppercase ui-selected:tab-active"> <Tab className="tab tab-md w-1/2 uppercase ui-selected:tab-active">
@@ -105,9 +113,11 @@ export const getServerSideProps: GetServerSideProps<BreweryPageProps> = async (
context, context,
) => { ) => {
const breweryPost = await getBreweryPostById(context.params!.id! as string); const breweryPost = await getBreweryPostById(context.params!.id! as string);
const mapboxToken = MAPBOX_ACCESS_TOKEN;
return !breweryPost return !breweryPost
? { notFound: true } ? { notFound: true }
: { props: { breweryPost: JSON.parse(JSON.stringify(breweryPost)) } }; : { props: { breweryPost: JSON.parse(JSON.stringify(breweryPost)), mapboxToken } };
}; };
export default BreweryByIdPage; export default BreweryByIdPage;

View File

@@ -1,4 +1,4 @@
import { NextPage } from 'next'; import { GetServerSideProps, NextPage } from 'next';
import { useEffect, useMemo, useState } from 'react'; import { useEffect, useMemo, useState } from 'react';
import Map, { Marker, Popup } from 'react-map-gl'; import Map, { Marker, Popup } from 'react-map-gl';
import 'mapbox-gl/dist/mapbox-gl.css'; import 'mapbox-gl/dist/mapbox-gl.css';
@@ -11,10 +11,15 @@ import BreweryPostMapQueryResult from '@/services/BreweryPost/schema/BreweryPost
import { z } from 'zod'; import { z } from 'zod';
import useBreweryMapPagePosts from '@/hooks/data-fetching/brewery-posts/useBreweryMapPagePosts'; import useBreweryMapPagePosts from '@/hooks/data-fetching/brewery-posts/useBreweryMapPagePosts';
import ControlPanel from '@/components/ui/maps/ControlPanel'; import ControlPanel from '@/components/ui/maps/ControlPanel';
import { MAPBOX_ACCESS_TOKEN } from '@/config/env';
type MapStyles = Record<'light' | 'dark', `mapbox://styles/mapbox/${string}`>; type MapStyles = Record<'light' | 'dark', `mapbox://styles/mapbox/${string}`>;
const BreweryMapPage: NextPage = () => { interface BreweryMapPageProps {
token: string;
}
const BreweryMapPage: NextPage<BreweryMapPageProps> = ({ token }) => {
const [popupInfo, setPopupInfo] = useState<z.infer< const [popupInfo, setPopupInfo] = useState<z.infer<
typeof BreweryPostMapQueryResult typeof BreweryPostMapQueryResult
> | null>(null); > | null>(null);
@@ -84,7 +89,7 @@ const BreweryMapPage: NextPage = () => {
initialViewState={{ zoom: 3, latitude: 48.3544, longitude: -99.9981 }} initialViewState={{ zoom: 3, latitude: 48.3544, longitude: -99.9981 }}
style={{ width: '100%', height: '100%' }} style={{ width: '100%', height: '100%' }}
mapStyle={mapStyles[theme]} mapStyle={mapStyles[theme]}
mapboxAccessToken={process.env.NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN} mapboxAccessToken={token}
scrollZoom scrollZoom
> >
<ControlPanel /> <ControlPanel />
@@ -121,3 +126,7 @@ const BreweryMapPage: NextPage = () => {
}; };
export default BreweryMapPage; export default BreweryMapPage;
export const getServerSideProps: GetServerSideProps<BreweryMapPageProps> = async () => ({
props: { token: MAPBOX_ACCESS_TOKEN },
});