Files
shumai/packages/webui/api/share-download.ts
T
Yiling-J e32445684f feat(share): record and display share activity (#549)
* feat(share): record and display share activity

* style(share): remove activity entry borders

* docs(share): explain share link activity
2026-11-25 12:23:11 +08:00

16 lines
525 B
TypeScript

import { client } from './client'
export function requestShareDownload(
shareId: string,
fileId: string,
key: string,
purpose?: 'download' | 'prepare' | 'clipboard',
) {
const password = localStorage.getItem(`share_pwd_${shareId}`)
const postDownload = client.api.shares[':shareId'].files[':fileId']['download-url'].$post
const input = { param: { shareId, fileId }, json: { key, purpose } }
return password
? postDownload(input, { headers: { 'x-share-password': password } })
: postDownload(input)
}