mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
fix(download): keep iOS home screen app saves in-app via the share sheet (#353)
* fix(download): keep iOS home screen app saves in-app via the share sheet * fix: apply CodeRabbit auto-fixes
This commit is contained in:
1 parent
b21c80c9e8
commit
7a3c5229df
9 files changed
+203
-48
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { fetchWrapper, fetchWrapperBlob } from './fetchWrapper'
|
||||
import { API_BASE_URL } from '@/config'
|
||||
import { saveFile } from '@/lib/download'
|
||||
import type { FileInfo, ChunkedFileInfo, PatchOperation } from '@/types/files'
|
||||
|
||||
interface FileApiUrlOptions {
|
||||
@@ -59,15 +60,8 @@ export async function downloadDirectoryAsZip(path: string, options?: DownloadOpt
|
||||
})
|
||||
|
||||
const blob = await fetchWrapperBlob(url)
|
||||
const urlObj = window.URL.createObjectURL(blob)
|
||||
const a = document.createElement('a')
|
||||
a.href = urlObj
|
||||
const dirName = path.split('/').pop() || 'download'
|
||||
a.download = `${dirName}.zip`
|
||||
document.body.appendChild(a)
|
||||
a.click()
|
||||
document.body.removeChild(a)
|
||||
window.URL.revokeObjectURL(urlObj)
|
||||
await saveFile(blob, `${dirName}.zip`)
|
||||
}
|
||||
|
||||
export async function applyFilePatches(path: string, patches: PatchOperation[]): Promise<{ success: boolean; totalLines: number }> {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { Repo } from './types'
|
||||
import { FetchError, fetchWrapper, fetchWrapperVoid, fetchWrapperBlob } from './fetchWrapper'
|
||||
import { API_BASE_URL } from '@/config'
|
||||
import { saveFile } from '@/lib/download'
|
||||
import type { DiscoverReposResponse, AssistantModeStatus, AssistantModeInitRequest } from '@opencode-manager/shared/types'
|
||||
|
||||
export interface CreateRepoOptions {
|
||||
@@ -196,14 +197,7 @@ export async function downloadRepo(id: number, repoName: string, options?: Downl
|
||||
const url = `${API_BASE_URL}/api/repos/${id}/download${params.toString() ? '?' + params.toString() : ''}`
|
||||
|
||||
const blob = await fetchWrapperBlob(url)
|
||||
const urlObj = window.URL.createObjectURL(blob)
|
||||
const a = document.createElement('a')
|
||||
a.href = urlObj
|
||||
a.download = `${repoName}.zip`
|
||||
document.body.appendChild(a)
|
||||
a.click()
|
||||
document.body.removeChild(a)
|
||||
window.URL.revokeObjectURL(urlObj)
|
||||
await saveFile(blob, `${repoName}.zip`)
|
||||
}
|
||||
|
||||
export async function updateRepoOrder(order: number[]): Promise<void> {
|
||||
|
||||
Reference in new issue
Block a user