* video uploads! * use video upload lexicons * add missing postgate * remove references to prerelease package * fix scrubber showing a "0" * Delete types.ts * rm logs * rm upload header --------- Co-authored-by: Samuel Newman <10959775+mozzius@users.noreply.github.com>
26 lines
569 B
TypeScript
26 lines
569 B
TypeScript
import {useMemo} from 'react'
|
|
import {AtpAgent} from '@atproto/api'
|
|
|
|
const UPLOAD_ENDPOINT = process.env.EXPO_PUBLIC_VIDEO_ROOT_ENDPOINT ?? ''
|
|
|
|
export const createVideoEndpointUrl = (
|
|
route: string,
|
|
params?: Record<string, string>,
|
|
) => {
|
|
const url = new URL(`${UPLOAD_ENDPOINT}`)
|
|
url.pathname = route
|
|
if (params) {
|
|
for (const key in params) {
|
|
url.searchParams.set(key, params[key])
|
|
}
|
|
}
|
|
return url.href
|
|
}
|
|
|
|
export function useVideoAgent() {
|
|
return useMemo(() => {
|
|
return new AtpAgent({
|
|
service: UPLOAD_ENDPOINT,
|
|
})
|
|
}, [])
|
|
}
|