@@ -7,12 +7,13 @@ import { serializeMedium } from "../../entities/medium";
77import { makeVideoScreenshot , uploadThumbnail } from "../../media" ;
88import { type Variables , scopeRequired , tokenRequired } from "../../oauth" ;
99import { media } from "../../schema" ;
10- import { disk , getAssetUrl } from "../../storage" ;
10+ import { drive } from "../../storage" ;
1111import { isUuid , uuidv7 } from "../../uuid" ;
1212
1313const app = new Hono < { Variables : Variables } > ( ) ;
1414
1515export async function postMedia ( c : Context < { Variables : Variables } > ) {
16+ const disk = drive . use ( ) ;
1617 const owner = c . get ( "token" ) . accountOwner ;
1718 if ( owner == null ) {
1819 return c . json ( { error : "This method requires an authenticated user" } , 422 ) ;
@@ -47,7 +48,7 @@ export async function postMedia(c: Context<{ Variables: Variables }>) {
4748 } catch ( error ) {
4849 return c . json ( { error : "Failed to save media file" } , 500 ) ;
4950 }
50- const url = getAssetUrl ( path , c . req . url ) ;
51+ const url = await disk . getUrl ( path ) ;
5152 const result = await db
5253 . insert ( media )
5354 . values ( {
@@ -57,7 +58,7 @@ export async function postMedia(c: Context<{ Variables: Variables }>) {
5758 width : fileMetadata . width ! ,
5859 height : fileMetadata . height ! ,
5960 description,
60- ...( await uploadThumbnail ( id , image , c . req . url ) ) ,
61+ ...( await uploadThumbnail ( id , image ) ) ,
6162 } )
6263 . returning ( ) ;
6364 if ( result . length < 1 ) {
0 commit comments