sendou.ink/app/utils/urls-img.ts
Kalle baa4b43855
Some checks are pending
Tests and checks on push / run-checks-and-tests (push) Waiting to run
Updates translation progress / update-translation-progress-issue (push) Waiting to run
Docker setup for development (#2460)
2025-07-20 16:58:21 +03:00

16 lines
771 B
TypeScript

// TODO: separating this file from urls.ts is a temporary solution. The reason is that import.meta.env cannot currently be used in files that are consumed by plain Node.js
const USER_SUBMITTED_IMAGE_ROOT =
process.env.NODE_ENV === "development" &&
import.meta.env.VITE_PROD_MODE !== "true"
? "http://127.0.0.1:9000/sendou"
: "https://sendou.nyc3.cdn.digitaloceanspaces.com";
// TODO: move development images to minio and deprecate this hack
// images with https are not hosted on spaces, this is used for local development
export const conditionalUserSubmittedImage = (fileName: string) =>
fileName.includes("https") ? fileName : userSubmittedImage(fileName);
export const userSubmittedImage = (fileName: string) =>
`${USER_SUBMITTED_IMAGE_ROOT}/${fileName}`;