Skip to content

Commit

Permalink
Update dependencies (#179)
Browse files Browse the repository at this point in the history
* Downgrade next

* Revert "Downgrade next"

This reverts commit 3e463bf.

* export const runtime = 'edge'

* export const dynamic = 'force-dynamic'

* undo

* Reapply "Downgrade next"

This reverts commit 619f814.

* Move themecolor

* Downgrade next

* Latest next version

* Update many

* chore: Auto-fix lint errors

* Trigger ci

* Update dependencies (#177)

* Fix fallback img url

* remove as keyword

* use next response

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
mauriciabad and github-actions[bot] authored Feb 10, 2024
1 parent a22f5d4 commit e387ebf
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
16 changes: 14 additions & 2 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-check
import withPWAInit from '@ducanh2912/next-pwa'
import { withAxiom } from 'next-axiom'
import createNextIntlPlugin from 'next-intl/plugin'
Expand All @@ -18,6 +19,18 @@ const nextBaseConfig = {
process.env.NEXT_PUBLIC_AWS_BUCKET_REGION ?? '*'
}.amazonaws.com`,
},
{
protocol: 'https',
hostname: 'begursecret.com',
},
{
protocol: 'https',
hostname: 'begursecret-mauriciabad.vercel.app',
},
{
protocol: 'https',
hostname: 'begursecret-*-mauriciabad.vercel.app',
},
],
unoptimized: process.env.VERCEL_ENV !== 'production',
},
Expand All @@ -32,12 +45,11 @@ const withNextIntl = createNextIntlPlugin('./src/server/i18n.ts')
const withPWA = withPWAInit({
dest: 'public',
fallbacks: {
image: '/public/fallback.png',
image: '/fallback.png',
},
cacheOnFrontEndNav: true,
aggressiveFrontEndNavCaching: true,
reloadOnOnline: true,
swcMinify: true,
disable: process.env.NODE_ENV === 'development',
workboxOptions: {
disableDevLogs: true,
Expand Down
8 changes: 4 additions & 4 deletions src/app/api/upload/place-image/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ export const POST = withAxiom(async (request) => {
}

const formData = await request.formData()
const imageFile = formData.get('image') as unknown as File | null
if (!imageFile) {
const imageFile = formData.get('image')
if (!imageFile || !(imageFile instanceof File) || imageFile.size === 0) {
return NextResponse.json(null, { status: 400 })
}
const alt = formData.get('alt') as unknown as string | undefined
const alt = formData.get('alt')

const image = await procsessAndUploadToS3(imageFile, `contents/${uuidv4()}`, {
generateBlurDataURL: true,
Expand All @@ -34,7 +34,7 @@ export const POST = withAxiom(async (request) => {
.insert(images)
.values({
...image,
alt,
alt: String(alt),
})
.execute()
const imageId = Number(insertImageResult.insertId)
Expand Down
11 changes: 10 additions & 1 deletion src/app/api/upload/profile-image/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,16 @@ export const POST = withAxiom(async (request) => {
}

const formData = await request.formData()
const imageFile = formData.get('image') as unknown as File | null
const imageFile = formData.get('image')
if (
!(
imageFile === null ||
imageFile === undefined ||
(imageFile instanceof File && imageFile.size > 0)
)
) {
return NextResponse.json(null, { status: 400 })
}

const image = await proccessAndUploadOrDeleteFromS3(
imageFile,
Expand Down

0 comments on commit e387ebf

Please sign in to comment.