atproto explorer
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix export repo filename

Juliet 20573ddc 9101545c

+27 -3
+27 -3
src/views/repo.tsx
··· 47 47 48 48 const [repo] = createResource(fetchRepo); 49 49 50 + const downloadRepo = async () => { 51 + try { 52 + const response = await fetch( 53 + `${pds}/xrpc/com.atproto.sync.getRepo?did=${did}`, 54 + ); 55 + if (!response.ok) { 56 + throw new Error(`HTTP error status: ${response.status}`); 57 + } 58 + 59 + const blob = await response.blob(); 60 + const url = window.URL.createObjectURL(blob); 61 + const a = document.createElement("a"); 62 + a.href = url; 63 + a.download = `${did}-${new Date().toISOString()}.car`; 64 + document.body.appendChild(a); 65 + a.click(); 66 + 67 + window.URL.revokeObjectURL(url); 68 + document.body.removeChild(a); 69 + } catch (error) { 70 + console.error("Download failed:", error); 71 + } 72 + }; 73 + 50 74 return ( 51 75 <Show when={repo()}> 52 76 <div class="mt-3 flex w-[21rem] flex-col gap-2 break-words"> ··· 142 166 <div class="i-tabler-external-link ml-0.5 text-xs" /> 143 167 </a> 144 168 </Show> 145 - <a 146 - href={`${pds}/xrpc/com.atproto.sync.getRepo?did=${did}`} 169 + <button 170 + onclick={() => downloadRepo()} 147 171 class="text-lightblue-500 flex w-fit items-center hover:underline" 148 172 > 149 173 Export repo 150 - </a> 174 + </button> 151 175 <Show when={backlinks()}> 152 176 {(backlinks) => ( 153 177 <div class="mt-2 border-t border-neutral-500 pt-2">