mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
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:
1 parent
725f782079
commit
af9f645f30
7 files changed
+723
-10
No files matched your search
@@ -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)
|
||||
}
|
||||
Reference in new issue
Block a user