Skip to content

armgit / meet

Public Imported from GitHub
0

Open source video conferencing app powered by LiveKit. Built with Django and React.

✨(frontend) create utility for media download URL generation

lebaudantoine06462a55b09c
diff --git a/src/frontend/src/api/mediaUrl.ts b/src/frontend/src/api/mediaUrl.ts
new file mode 100644
index 00000000..01074131
--- /dev/null
+++ b/src/frontend/src/api/mediaUrl.ts
@@ -0,0 +1,11 @@
+export const mediaUrl = (path: string) => {
+ const origin =
+ import.meta.env.VITE_API_BASE_URL ||
+ (typeof window !== 'undefined' ? window.location.origin : '')
+
+ // Remove leading/trailing slashes from origin/path if it exists
+ const sanitizedOrigin = origin.replace(/\/$/, '')
+ const sanitizedPath = path.replace(/^\//, '')
+
+ return `${sanitizedOrigin}/media/${sanitizedPath}`
+}