chore(server) refactor serveFile and downloadFile endpoint (#978)

This commit is contained in:
Alex 2022-11-16 00:11:16 -06:00 committed by GitHub
parent 1db255fd3e
commit e799f35dd2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 116 additions and 175 deletions

View file

@ -1,10 +1,8 @@
const _basePath = '/api';
export function getFileUrl(aid: string, did: string, isThumb?: boolean, isWeb?: boolean) {
const urlObj = new URL(`${window.location.origin}${_basePath}/asset/file`);
export function getFileUrl(assetId: string, isThumb?: boolean, isWeb?: boolean) {
const urlObj = new URL(`${window.location.origin}${_basePath}/asset/file/${assetId}`);
urlObj.searchParams.append('aid', aid);
urlObj.searchParams.append('did', did);
if (isThumb !== undefined && isThumb !== null)
urlObj.searchParams.append('isThumb', `${isThumb}`);
if (isWeb !== undefined && isWeb !== null) urlObj.searchParams.append('isWeb', `${isWeb}`);