-
Notifications
You must be signed in to change notification settings - Fork 0
fix: core api #105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: core api #105
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import { createBeaconSchema } from '#shared/services/notification' | ||
| import { type } from 'arktype' | ||
|
|
||
| export default defineEventHandler(async (event) => { | ||
| try { | ||
| const commentId = getRouterParam(event, 'commentId') | ||
| if (!commentId) { | ||
| throw createError({ | ||
| statusCode: 400, | ||
| message: 'Id is required', | ||
| }) | ||
| } | ||
|
|
||
| const body = await readBody(event) | ||
| const data = createBeaconSchema(body) | ||
| if (data instanceof type.errors) { | ||
| throw data | ||
| } | ||
|
|
||
| const { public: publicEnv } = useRuntimeConfig() | ||
|
|
||
| await $fetch(`${publicEnv.coreApiUrl}/epic/comment/id/${commentId}/beacon`, { | ||
| method: 'POST', | ||
| body: data, | ||
| }) | ||
|
|
||
| return { | ||
| ok: true, | ||
| } | ||
| } catch (error) { | ||
| throw errorResolver(error) | ||
| } | ||
|
Comment on lines
+30
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainEnsure
Run to locate its definition: If it lives under a util path, import it explicitly at the top of this file. 🏁 Script executed: #!/bin/bash
rg -nP -C2 '\b(errorResolver)\b' --type=ts --type=jsLength of output: 44144 🏁 Script executed: #!/bin/bash
head -n 20 apps/atrium-telegram/server/api/epic/comment/id/[commentId]/beacon.post.tsLength of output: 620 Import import { errorResolver } from '../../../../../utils/error'—adjust the relative path or alias to match your project’s resolver. 🤖 Prompt for AI Agents |
||
| }) | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -7,6 +7,8 @@ const ACCEPTED_IMAGE_TYPES = [ | |||||||||||||||
| 'image/png', | ||||||||||||||||
| 'image/webp', | ||||||||||||||||
| 'image/gif', | ||||||||||||||||
| 'image/avif', | ||||||||||||||||
| 'image/heif', | ||||||||||||||||
|
Comment on lines
+10
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add image/heic to accepted MIME types (iOS default). Mirror the web-app change; otherwise HEIC uploads from iOS will be rejected client-side. Apply: 'image/gif',
'image/avif',
'image/heif',
+ 'image/heic',
]📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||
| ] | ||||||||||||||||
|
|
||||||||||||||||
| const FileSchema = type('File') | ||||||||||||||||
|
|
||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,7 @@ const USER_AVATARS_DIRECTORY = 'users' | |
|
|
||
| const IMAGE_SIZES = [256, 512] | ||
| const IMAGE_FORMATS = ['jpg', 'webp'] as const | ||
| const ACCEPTED_IMAGE_FORMATS = ['jpeg', 'jpg', 'png', 'webp'] | ||
| const ACCEPTED_IMAGE_FORMATS = ['jpeg', 'jpg', 'png', 'webp', 'heif', 'avif'] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainInclude ‘heic’ and confirm runtime decode support.
Apply: -const ACCEPTED_IMAGE_FORMATS = ['jpeg', 'jpg', 'png', 'webp', 'heif', 'avif']
+const ACCEPTED_IMAGE_FORMATS = ['jpeg', 'jpg', 'png', 'webp', 'heif', 'heic', 'avif'] as constTo verify support and avoid regressions, run: And confirm environment support: 🏁 Script executed: #!/bin/bash
# Find all places that mention HEIF/AVIF and ensure consistency
rg -nC2 -i 'heif|heic|avif|ACCEPTED_IMAGE_FORMATS|ACCEPTED_IMAGE_TYPES'
# Optional: check sharp version used (lockfile)
fd lock | xargs -I{} rg -n 'sharp@' {}Length of output: 5647 🌐 Web query: 💡 Result: Short answer: You still need libvips / OS libs for full HEIF/HEIC (HEVC) support; AVIF is supported by sharp’s prebuilt binaries. sharp’s docs/state that AVIF is included in prebuilt binaries, but HEIF/HEIC using HEVC requires a globally installed libvips compiled with libheif (and codecs like libde265/x265). [1][2] Sources:
Add HEIC support and verify HEIF/HEIC decode dependencies
🤖 Prompt for AI Agents |
||
|
|
||
| export default defineEventHandler(async (event) => { | ||
| let sharpStream | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -7,6 +7,8 @@ const ACCEPTED_IMAGE_TYPES = [ | |||||||||||||||
| 'image/png', | ||||||||||||||||
| 'image/webp', | ||||||||||||||||
| 'image/gif', | ||||||||||||||||
| 'image/avif', | ||||||||||||||||
| 'image/heif', | ||||||||||||||||
|
Comment on lines
+10
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add image/heic to accepted MIME types (iOS default). Many devices (notably iOS) upload HEIC as image/heic; current schema will reject them. Apply: 'image/gif',
'image/avif',
'image/heif',
+ 'image/heic',
]📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||
| ] | ||||||||||||||||
|
|
||||||||||||||||
| const FileSchema = type('File') | ||||||||||||||||
|
|
||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Auth regression: cross-origin request sends no credentials.
Switching to coreApiUrl without Authorization or credentials will 401. Either route via a local proxy endpoint or include credentials.
Apply minimal fix:
If cookies aren’t first-party to coreApiUrl, prefer a Nuxt server proxy (e.g., POST /api/user/id/[id]/image) to avoid CORS + cookies pitfalls.
🏁 Script executed:
Length of output: 106
🏁 Script executed:
Length of output: 1197
Auth regression: include credentials or proxy for all coreApiUrl fetch calls
Two direct
$fetchcalls topublicEnv.coreApiUrllack credentials/authorization and will 401:Apply minimal fixes:
If cookies aren’t first-party to coreApiUrl, route client calls via a Nuxt server proxy endpoint to avoid CORS and cookie pitfalls.
📝 Committable suggestion
🤖 Prompt for AI Agents