Skip to content

Commit 727b046

Browse files
committed
refactor: add skeleton and tweaks network request logic
1 parent a27daa1 commit 727b046

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

app/components/Package/Skeleton.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
<SkeletonBlock class="w-14 h-9 rounded" />
1616
<!-- Fund link placeholder -->
1717
<SkeletonBlock class="w-22 h-9 rounded self-baseline" />
18+
<!-- Share button placeholder -->
19+
<SkeletonBlock class="w-9 md:w-22 h-9 rounded self-baseline" />
1820
</div>
1921
</div>
2022
</header>

server/api/card/[...pkg].get.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { createError, getQuery, getRouterParam, sendRedirect } from 'h3'
22
import { assertValidPackageName } from '#shared/utils/npm'
3+
import { ACCENT_COLOR_IDS } from '#shared/utils/constants'
34

45
export default defineEventHandler(async event => {
56
const segments = getRouterParam(event, 'pkg')?.split('/') ?? []
@@ -20,7 +21,11 @@ export default defineEventHandler(async event => {
2021

2122
const query = getQuery(event)
2223
const theme = query.theme === 'light' ? 'light' : 'dark'
23-
const color = typeof query.color === 'string' ? `&color=${encodeURIComponent(query.color)}` : ''
24+
const rawColor = typeof query.color === 'string' ? query.color : null
25+
const color =
26+
rawColor && (ACCENT_COLOR_IDS as readonly string[]).includes(rawColor)
27+
? `&color=${rawColor}`
28+
: ''
2429

2530
return sendRedirect(
2631
event,

server/utils/image-proxy.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ export const TRUSTED_IMAGE_DOMAINS = [
7676
'travis-ci.org',
7777
'secure.travis-ci.org',
7878
'img.badgesize.io',
79-
'api.securityscorecards.dev',
8079
]
8180

8281
/**

0 commit comments

Comments
 (0)