mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-04-24 23:19:39 -05:00
16 lines
771 B
TypeScript
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}`;
|