feat: add app download
This commit is contained in:
@@ -147,6 +147,16 @@ export interface AlertSettings {
|
||||
telegram_chat_id: string
|
||||
}
|
||||
|
||||
export interface AppDownload {
|
||||
name: string
|
||||
size_bytes: number
|
||||
}
|
||||
|
||||
export interface AppDownloadsResponse {
|
||||
eligible: boolean
|
||||
items: AppDownload[]
|
||||
}
|
||||
|
||||
// --- Endpoints ---
|
||||
|
||||
export const api = {
|
||||
@@ -221,4 +231,13 @@ export const api = {
|
||||
getAlertSettings: () => request<AlertSettings>('GET', '/profile/alerts'),
|
||||
setAlertSettings: (settings: AlertSettings) =>
|
||||
request<AlertSettings>('POST', '/profile/alerts', settings),
|
||||
|
||||
listAppDownloads: () => request<AppDownloadsResponse>('GET', '/apps'),
|
||||
}
|
||||
|
||||
// URL de téléchargement direct d'une app — le cookie de session httpOnly
|
||||
// suffit à authentifier la navigation (voir auth.tokenFromRequest côté API),
|
||||
// pas besoin de fetch + blob.
|
||||
export function appDownloadUrl(name: string): string {
|
||||
return `${BASE}/api/v1/apps/${encodeURIComponent(name)}`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user