pull down to refresh
0 sats \ 0 replies \ @PlebTag OP 2h \ parent \ on: Rebuilding Github - but on Nostr nostr
https://github.com/arbadacarbaYK/gittr/blob/main/docs/FILE_FETCHING_INSIGHTS.md#file-opening-flow---correct-strategy-order if you're looking for a more detailed description this might give you some clue as its complicated and can either live within events on ngit servers or link to external sources. Thats the difference import vs. create repo enacts.
User clicks on a file
↓
Strategy 1: Check if file content is embedded in repoData.files array
├─ If found with content → Use embedded content ✅
└─ If not found → Continue to Strategy 2
↓
Strategy 2: Try git-nostr-bridge API
├─ Resolve ownerPubkey:
│ ├─ Check repoData.ownerPubkey
│ ├─ Check localStorage for matching repo
│ ├─ Decode npub from params.entity
│ └─ Fallback to resolveEntityToPubkey utility
├─ Success → Use content from git-nostr-bridge ✅
├─ 404 (not cloned) → Check if GRASP server
│ ├─ If GRASP → Trigger clone → Poll (max 10 attempts, 2s delay) ✅
│ └─ If not GRASP → Continue to Strategy 3
└─ Error → Continue to Strategy 3
↓
Strategy 3: Try external git servers via API proxy
├─ GitHub → /api/git/file-content?sourceUrl=...&path=...&branch=...
├─ GitLab → /api/git/file-content?sourceUrl=...&path=...&branch=...
├─ Codeberg → /api/git/file-content?sourceUrl=...&path=...&branch=...
└─ GRASP → /api/git/file-content?sourceUrl=...&path=...&branch=...
↓
Handle binary vs text files
├─ Binary → Return base64, frontend creates data URL
└─ Text → Return UTF-8 content