mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
13 lines
455 B
TypeScript
13 lines
455 B
TypeScript
import { MediaBackendType } from "media-manager";
|
|
import type { Config } from "~/packages/config-manager";
|
|
|
|
export const getUrl = (name: string, config: Config) => {
|
|
if (config.media.backend === MediaBackendType.Local) {
|
|
return new URL(`/media/${name}`, config.http.base_url).toString();
|
|
}
|
|
if (config.media.backend === MediaBackendType.S3) {
|
|
return new URL(`/${name}`, config.s3.public_url).toString();
|
|
}
|
|
return "";
|
|
};
|