Skip to content

Commit f53d512

Browse files
authored
Merge branch 'main' into main
2 parents 99f264a + 05483f5 commit f53d512

13 files changed

Lines changed: 102 additions & 35 deletions

File tree

.github/workflows/autofix.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ permissions:
1515
jobs:
1616
code:
1717
name: 🤖 Autofix code
18-
runs-on: ubuntu-latest
18+
runs-on: ubuntu-24.04-arm
1919

2020
steps:
2121
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

.github/workflows/ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ permissions:
2222
jobs:
2323
lint:
2424
name: 🔠 Lint project
25-
runs-on: ubuntu-latest
25+
runs-on: ubuntu-24.04-arm
2626

2727
steps:
2828
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
@@ -40,7 +40,7 @@ jobs:
4040

4141
types:
4242
name: 💪 Type check
43-
runs-on: ubuntu-latest
43+
runs-on: ubuntu-24.04-arm
4444

4545
steps:
4646
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
@@ -62,7 +62,7 @@ jobs:
6262

6363
unit:
6464
name: 🧪 Unit tests
65-
runs-on: ubuntu-latest
65+
runs-on: ubuntu-24.04-arm
6666

6767
steps:
6868
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
@@ -84,7 +84,7 @@ jobs:
8484

8585
test:
8686
name: 🧪 Component tests
87-
runs-on: ubuntu-latest
87+
runs-on: ubuntu-24.04-arm
8888

8989
steps:
9090
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
@@ -114,7 +114,7 @@ jobs:
114114

115115
browser:
116116
name: 🖥️ Browser tests
117-
runs-on: ubuntu-latest
117+
runs-on: ubuntu-24.04-arm
118118
container:
119119
image: mcr.microsoft.com/playwright:v1.58.0-noble
120120

@@ -141,7 +141,7 @@ jobs:
141141

142142
a11y:
143143
name: ♿ Accessibility audit
144-
runs-on: ubuntu-latest
144+
runs-on: ubuntu-latest # See https://github.com/GoogleChrome/lighthouse/discussions/16834
145145
strategy:
146146
matrix:
147147
mode: [dark, light]
@@ -172,7 +172,7 @@ jobs:
172172

173173
knip:
174174
name: 🧹 Unused code check
175-
runs-on: ubuntu-latest
175+
runs-on: ubuntu-24.04-arm
176176

177177
steps:
178178
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

.github/workflows/lunaria.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ permissions:
1818
jobs:
1919
lunaria-overview:
2020
name: 🌝 Generate Lunaria Overview
21-
runs-on: ubuntu-latest
21+
runs-on: ubuntu-24.04-arm
2222

2323
steps:
2424
- name: Checkout

app/composables/useI18nStatus.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function useI18nStatus() {
1515
responseType: 'json',
1616
server: false,
1717
// Cache the result to avoid refetching on navigation
18-
getCachedData: key => useNuxtApp().payload.data[key] || useNuxtApp().static.data[key],
18+
getCachedData: (key, nuxtApp) => nuxtApp.payload.data[key] ?? nuxtApp.static.data[key],
1919
})
2020

2121
/**

app/error.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ const props = defineProps<{
55
error: NuxtError
66
}>()
77
8-
const status = computed(() => props.error.status || 500)
8+
const status = computed(() => props.error.statusCode || 500)
99
const statusText = computed(() => {
10-
if (props.error.statusText) return props.error.statusText
10+
if (props.error.statusMessage) return props.error.statusMessage
1111
switch (status.value) {
1212
case 404:
1313
return 'Page not found'

app/pages/index.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ const handleInput = isTouchDevice()
2525
2626
useSeoMeta({
2727
title: () => $t('seo.home.title'),
28+
ogTitle: () => $t('seo.home.title'),
29+
twitterTitle: () => $t('seo.home.title'),
30+
twitterCard: 'summary_large_image',
2831
description: () => $t('seo.home.description'),
32+
ogDescription: () => $t('seo.home.description'),
33+
twitterDescription: () => $t('seo.home.description'),
2934
})
3035
3136
defineOgImageComponent('Default', {

docs/content/2.guide/1.features.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,18 +158,32 @@ Make sure to replace `TYPE` with one of the options listed below and `YOUR_PACKA
158158

159159
You can further customize your badges by appending query parameters to the badge URL.
160160

161+
##### `labelColor`
162+
163+
Overrides the default label color. You can pass a standard hex code (with or without the `#` prefix).
164+
165+
- **Default**: `#0a0a0a`
166+
- **Usage**: `?labelColor=HEX_CODE`
167+
168+
##### `label`
169+
170+
Overrides the default label text. You can pass any string to customize the label displayed on the badge.
171+
172+
- **Default**: Depends on the badge type (e.g., "version", "downloads/mo").
173+
- **Usage**: `?label=YOUR_LABEL`
174+
161175
##### `color`
162176

163177
Overrides the default strategy color. You can pass a standard hex code (with or without the `#` prefix).
164178

165179
- **Default**: Depends on the badge type (e.g., version is blue, downloads are orange).
166180
- **Usage**: `?color=HEX_CODE`
167181

168-
| Example | URL |
169-
| :------------- | :------------------------------------ |
170-
| **Hot Pink** | `.../badge/version/nuxt?color=ff69b4` |
171-
| **Pure Black** | `.../badge/version/nuxt?color=000000` |
172-
| **Brand Blue** | `.../badge/version/nuxt?color=3b82f6` |
182+
| Example | URL |
183+
| :------------- | :------------------------------------- |
184+
| **Hot Pink** | `.../badge/version/nuxt?colorB=ff69b4` |
185+
| **Pure Black** | `.../badge/version/nuxt?colorB=000000` |
186+
| **Brand Blue** | `.../badge/version/nuxt?colorB=3b82f6` |
173187

174188
##### `name`
175189

public/robots.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ Allow: /$
44
Allow: /about$
55
Allow: /search$
66
Allow: /settings$
7+
Allow: /__og-image__/*
78
Disallow: /

server/api/registry/badge/[type]/[...pkg].get.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ const NPMS_API = 'https://api.npms.io/v2/package'
1414
const QUERY_SCHEMA = v.object({
1515
color: v.optional(v.string()),
1616
name: v.optional(v.string()),
17+
labelColor: v.optional(v.string()),
18+
label: v.optional(v.string()),
1719
})
1820

1921
const COLORS = {
@@ -263,7 +265,9 @@ export default defineCachedEventHandler(
263265

264266
const queryParams = v.safeParse(QUERY_SCHEMA, query)
265267
const userColor = queryParams.success ? queryParams.output.color : undefined
268+
const labelColor = queryParams.success ? queryParams.output.labelColor : undefined
266269
const showName = queryParams.success && queryParams.output.name === 'true'
270+
const userLabel = queryParams.success ? queryParams.output.label : undefined
267271

268272
const badgeTypeResult = v.safeParse(BadgeTypeSchema, typeParam)
269273
const strategyKey = badgeTypeResult.success ? badgeTypeResult.output : 'version'
@@ -274,12 +278,15 @@ export default defineCachedEventHandler(
274278
const pkgData = await fetchNpmPackage(packageName)
275279
const strategyResult = await strategy(pkgData, requestedVersion)
276280

277-
const finalLabel = showName ? packageName : strategyResult.label
281+
const finalLabel = userLabel ? userLabel : showName ? packageName : strategyResult.label
278282
const finalValue = strategyResult.value
279283

280284
const rawColor = userColor ?? strategyResult.color
281285
const finalColor = rawColor?.startsWith('#') ? rawColor : `#${rawColor}`
282286

287+
const rawLabelColor = labelColor ?? '#0a0a0a'
288+
const finalLabelColor = rawLabelColor?.startsWith('#') ? rawLabelColor : `#${rawLabelColor}`
289+
283290
const leftWidth = measureTextWidth(finalLabel)
284291
const rightWidth = measureTextWidth(finalValue)
285292
const totalWidth = leftWidth + rightWidth
@@ -291,7 +298,7 @@ export default defineCachedEventHandler(
291298
<rect width="${totalWidth}" height="${height}" rx="3" fill="#fff"/>
292299
</clipPath>
293300
<g clip-path="url(#r)">
294-
<rect width="${leftWidth}" height="${height}" fill="#0a0a0a"/>
301+
<rect width="${leftWidth}" height="${height}" fill="${finalLabelColor}"/>
295302
<rect x="${leftWidth}" width="${rightWidth}" height="${height}" fill="${finalColor}"/>
296303
</g>
297304
<g text-anchor="middle" font-family="'Geist', system-ui, -apple-system, sans-serif" font-size="11">

server/api/social/like.delete.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ export default eventHandlerWithOAuthSession(async (event, oAuthSession) => {
3131
})
3232
const result = await likesUtil.unlikeAPackageAndReturnLikes(body.packageName, loggedInUsersDid)
3333
return result
34+
} else {
35+
// Always unlike in the cache if this endpoint is called. May be a mismatch
36+
await likesUtil.setUnlikeInCache(body.packageName, loggedInUsersDid)
3437
}
3538

3639
console.warn(

0 commit comments

Comments
 (0)