about summary refs log tree commit diff
path: root/src/state/queries/video/util.ts
diff options
context:
space:
mode:
authorSamuel Newman <mozzius@protonmail.com>2024-09-07 19:27:32 +0100
committerGitHub <noreply@github.com>2024-09-07 19:27:32 +0100
commit45a719b256173f98b20457cc80b4288e84f1c33f (patch)
treec377172ddaae5469ba6fb54457687f590339ed8e /src/state/queries/video/util.ts
parentb7d78fe59b73294ac13baa51a6a7cd94698cb205 (diff)
downloadvoidsky-45a719b256173f98b20457cc80b4288e84f1c33f.tar.zst
[Video] Check upload limits before uploading (#5153)
* DRY up video service auth code

* throw error if over upload limits

* use token

* xmark on toast

* errors with nice translatable error messages

* Update src/state/queries/video/video.ts

---------

Co-authored-by: Hailey <me@haileyok.com>
Diffstat (limited to 'src/state/queries/video/util.ts')
-rw-r--r--src/state/queries/video/util.ts8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/state/queries/video/util.ts b/src/state/queries/video/util.ts
index e019848a1..7ea38d8dc 100644
--- a/src/state/queries/video/util.ts
+++ b/src/state/queries/video/util.ts
@@ -1,15 +1,13 @@
 import {useMemo} from 'react'
 import {AtpAgent} from '@atproto/api'
 
-import {SupportedMimeTypes} from '#/lib/constants'
-
-const UPLOAD_ENDPOINT = 'https://video.bsky.app/'
+import {SupportedMimeTypes, VIDEO_SERVICE} from '#/lib/constants'
 
 export const createVideoEndpointUrl = (
   route: string,
   params?: Record<string, string>,
 ) => {
-  const url = new URL(`${UPLOAD_ENDPOINT}`)
+  const url = new URL(VIDEO_SERVICE)
   url.pathname = route
   if (params) {
     for (const key in params) {
@@ -22,7 +20,7 @@ export const createVideoEndpointUrl = (
 export function useVideoAgent() {
   return useMemo(() => {
     return new AtpAgent({
-      service: UPLOAD_ENDPOINT,
+      service: VIDEO_SERVICE,
     })
   }, [])
 }