fix: prettier formatting and downgrade upload-artifact to v3 for Gitea
This commit is contained in:
9 files changed
+32
-23
No files matched your search
+2
-9
@@ -22,10 +22,7 @@ export function isAllowedOrigin(request: Request): boolean {
|
||||
}
|
||||
|
||||
function resolveAllowedOrigin(origin: string | null): string {
|
||||
if (
|
||||
origin !== null &&
|
||||
(origin === ALLOWED_ORIGIN || (isDev() && DEV_ORIGINS.has(origin)))
|
||||
) {
|
||||
if (origin !== null && (origin === ALLOWED_ORIGIN || (isDev() && DEV_ORIGINS.has(origin)))) {
|
||||
return origin;
|
||||
}
|
||||
return ALLOWED_ORIGIN;
|
||||
@@ -79,11 +76,7 @@ export function jsonErrorWithCors(
|
||||
},
|
||||
});
|
||||
}
|
||||
export function jsonWithCors(
|
||||
data: unknown,
|
||||
sMaxage = 3600,
|
||||
origin?: string | null,
|
||||
): NextResponse {
|
||||
export function jsonWithCors(data: unknown, sMaxage = 3600, origin?: string | null): NextResponse {
|
||||
return NextResponse.json(data, {
|
||||
headers: {
|
||||
"Cache-Control": `public, s-maxage=${sMaxage}, stale-while-revalidate=86400`,
|
||||
|
||||
@@ -69,7 +69,11 @@ export function formatReleaseDate(value: string, localeTag: string): string {
|
||||
return value;
|
||||
}
|
||||
|
||||
export function formatCount(value: number | null | undefined, localeTag: string, unit: string): string {
|
||||
export function formatCount(
|
||||
value: number | null | undefined,
|
||||
localeTag: string,
|
||||
unit: string,
|
||||
): string {
|
||||
if (value == null) {
|
||||
return "—";
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { buildLinks, mergePeople, mergePlatforms, selectScreenshots } from "@/lib/game/game-profile";
|
||||
import {
|
||||
buildLinks,
|
||||
mergePeople,
|
||||
mergePlatforms,
|
||||
selectScreenshots,
|
||||
} from "@/lib/game/game-profile";
|
||||
import type { IgdbGame } from "@/lib/game/game-profile-types";
|
||||
|
||||
describe("mergePeople", () => {
|
||||
|
||||
@@ -186,7 +186,9 @@ export function toPricePoint(p: ItadOverviewPrice["current"]): GamePricePoint |
|
||||
|
||||
export function mapItadBlock(
|
||||
itadInfo: ItadGameInfo | null,
|
||||
priceEntry: { current?: ItadOverviewPrice["current"]; lowest?: ItadOverviewPrice["current"] } | undefined,
|
||||
priceEntry:
|
||||
| { current?: ItadOverviewPrice["current"]; lowest?: ItadOverviewPrice["current"] }
|
||||
| undefined,
|
||||
): NonNullable<GameProfile["itad"]> | null {
|
||||
if (!process.env.ITAD_API_KEY || (!itadInfo && !priceEntry)) {
|
||||
return null;
|
||||
@@ -197,10 +199,7 @@ export function mapItadBlock(
|
||||
pageUrl: itadInfo?.urls?.game ?? null,
|
||||
playerCount: itadInfo?.players?.recent ?? null,
|
||||
reviews: (itadInfo?.reviews ?? [])
|
||||
.filter(
|
||||
(r): r is ItadReview & { source: string; url: string } =>
|
||||
!!r.source && !!r.url,
|
||||
)
|
||||
.filter((r): r is ItadReview & { source: string; url: string } => !!r.source && !!r.url)
|
||||
.map((r) => ({
|
||||
score: r.score ?? null,
|
||||
source: r.source,
|
||||
|
||||
@@ -25,9 +25,9 @@ describe("activityImageUrl", () => {
|
||||
});
|
||||
|
||||
it("resolves Spotify keys", () => {
|
||||
expect(activityImageUrl(activity({ assets: { large_image: "spotify:img" } }), "large")).toBe(
|
||||
"https://i.scdn.co/image/img",
|
||||
);
|
||||
expect(
|
||||
activityImageUrl(activity({ assets: { large_image: "spotify:img" } }), "large"),
|
||||
).toBe("https://i.scdn.co/image/img");
|
||||
});
|
||||
|
||||
it("resolves app assets with application id", () => {
|
||||
|
||||
Reference in new issue
Block a user