feat: add app download
ci-api / test (push) Successful in 27m41s
ci-web / test (push) Successful in 14m6s

This commit is contained in:
Xor290
2026-08-09 15:35:29 +02:00
parent 0609ca30d0
commit d8794358c5
13 changed files with 520 additions and 24 deletions
+19
View File
@@ -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)}`
}