forked from tangled.org/core
Monorepo for Tangled — https://tangled.org

appview/pages/markup: use xrpc for fetching image from knot

Signed-off-by: Anirudh Oppiliappan <anirudh@tangled.sh>

anirudh.fi 12e8af08 4b9fa84f

verified
Changed files
+10 -8
appview
pages
markup
+10 -8
appview/pages/markup/markdown.go
··· 22 22 "github.com/yuin/goldmark/util" 23 23 htmlparse "golang.org/x/net/html" 24 24 25 + "tangled.sh/tangled.sh/core/api/tangled" 25 26 "tangled.sh/tangled.sh/core/appview/pages/repoinfo" 26 27 ) 27 28 ··· 231 232 232 233 actualPath := rctx.actualPath(dst) 233 234 235 + repoName := fmt.Sprintf("%s/%s", rctx.RepoInfo.OwnerDid, rctx.RepoInfo.Name) 236 + 237 + query := fmt.Sprintf("repo=%s&ref=%s&path=%s&raw=true", 238 + repoName, url.PathEscape(rctx.RepoInfo.Ref), actualPath) 239 + 234 240 parsedURL := &url.URL{ 235 - Scheme: scheme, 236 - Host: rctx.Knot, 237 - Path: path.Join("/", 238 - rctx.RepoInfo.OwnerDid, 239 - rctx.RepoInfo.Name, 240 - "raw", 241 - url.PathEscape(rctx.RepoInfo.Ref), 242 - actualPath), 241 + Scheme: scheme, 242 + Host: rctx.Knot, 243 + Path: path.Join("/xrpc", tangled.RepoBlobNSID), 244 + RawQuery: query, 243 245 } 244 246 newPath := parsedURL.String() 245 247 return newPath