Add ZIP download feature for repositories

- Add archive service to create ZIP files excluding gitignored files
- Add download endpoint to backend repo routes
- Add download button to repo cards with loading state
- Update README with new ZIP download feature
This commit is contained in:
Chris Scott committed 2025-12-12 20:48:38 -05:00
1 parent 725f782079
commit af9f645f30
7 files changed
+723 -10

No files matched your search

+19
View File
@@ -139,3 +139,22 @@ export async function listBranches(id: number): Promise<{ local: string[], remot
return response.json()
}
export async function downloadRepo(id: number, repoName: string): Promise<void> {
const response = await fetch(`${API_BASE_URL}/api/repos/${id}/download`)
if (!response.ok) {
const error = await response.json()
throw new Error(error.error || 'Failed to download repo')
}
const blob = await response.blob()
const url = window.URL.createObjectURL(blob)
const a = document.createElement('a')
a.href = url
a.download = `${repoName}.zip`
document.body.appendChild(a)
a.click()
document.body.removeChild(a)
window.URL.revokeObjectURL(url)
}