···77import {CompressedVideo} from '#/lib/media/video/compress'
88import {createVideoEndpointUrl} from '#/state/queries/video/util'
99import {useAgent, useSession} from '#/state/session'
1010+import {getServiceAuthAudFromUrl} from 'lib/strings/url-helpers'
10111112export const useUploadVideoMutation = ({
1213 onSuccess,
···3031 name: `${nanoid(12)}.mp4`, // @TODO what are we limiting this to?
3132 })
32333333- // a logged-in agent should have this set, but we'll check just in case
3434- if (!agent.pdsUrl) {
3434+ if (!currentAccount?.service) {
3535+ throw new Error('User is not logged in')
3636+ }
3737+3838+ const serviceAuthAud = getServiceAuthAudFromUrl(currentAccount.service)
3939+ if (!serviceAuthAud) {
3540 throw new Error('Agent does not have a PDS URL')
3641 }
37423843 const {data: serviceAuth} = await agent.com.atproto.server.getServiceAuth(
3944 {
4040- aud: `did:web:${agent.pdsUrl.hostname}`,
4545+ aud: serviceAuthAud,
4146 lxm: 'com.atproto.repo.uploadBlob',
4247 },
4348 )
+8-3
src/state/queries/video/video-upload.web.ts
···66import {CompressedVideo} from '#/lib/media/video/compress'
77import {createVideoEndpointUrl} from '#/state/queries/video/util'
88import {useAgent, useSession} from '#/state/session'
99+import {getServiceAuthAudFromUrl} from 'lib/strings/url-helpers'
9101011export const useUploadVideoMutation = ({
1112 onSuccess,
···2930 name: `${nanoid(12)}.mp4`, // @TODO: make sure it's always mp4'
3031 })
31323232- // a logged-in agent should have this set, but we'll check just in case
3333- if (!agent.pdsUrl) {
3333+ if (!currentAccount?.service) {
3434+ throw new Error('User is not logged in')
3535+ }
3636+3737+ const serviceAuthAud = getServiceAuthAudFromUrl(currentAccount.service)
3838+ if (!serviceAuthAud) {
3439 throw new Error('Agent does not have a PDS URL')
3540 }
36413742 const {data: serviceAuth} = await agent.com.atproto.server.getServiceAuth(
3843 {
3939- aud: `did:web:${agent.pdsUrl.hostname}`,
4444+ aud: serviceAuthAud,
4045 lxm: 'com.atproto.repo.uploadBlob',
4146 },
4247 )