zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
47.96k stars 2.83k forks source link

Git blame avatars for everyone #11043

Open WeetHet opened 5 months ago

WeetHet commented 5 months ago

Currently, only GitHub avatars are supported in git blame. Other hostings should be supported as well.

Avatar support

Questions

mrnugget commented 5 months ago
  • Should this be an API for extensions?

I think for now it's fine to keep it in there, since it's similar to the permalinks behavior we have.

  • Should we make a Commit/Author/User/... struct for each hosting separately or extract them? For now I've extracted the Author struct as it's the only one that is built by hand and not deserialised from the response.

I don't think we need more than a URL right now. Once we need more, we can add more.

WeetHet commented 5 months ago
  • Should this be an API for extensions?

I think for now it's fine to keep it in there, since it's similar to the permalinks behavior we have.

  • Should we make a Commit/Author/User/... struct for each hosting separately or extract them? For now I've extracted the Author struct as it's the only one that is built by hand and not deserialised from the response.

I don't think we need more than a URL right now. Once we need more, we can add more.

Okay, I'll undraft the PR and we'll go from there

d1y commented 5 months ago

The Gitee host need access_token after you can send request fetch avatar So the user may need to fill it in manually, this is a setting item 🤔

API: https://gitee.com/api/v5/swagger#/getV5ReposOwnerRepoCommitsSha

function createURL(owner: string, repo: string, sha: string, token: string) {
  return `https://gitee.com/api/v5/repos/${owner}/${repo}/commits/${sha}?access_token=${token}`
}

const token = Bun.env["ACCESS_TOKEN"]!

const url = createURL('libkitten', 'zed', 'f72cf2afe34f77bf498454cd5486aa2c31b820d6', token)

console.log(url)

// export ACCESS_TOKEN=$$$
// bun run run.ts | xargs curl | jless

Avatar is author.avatar_url

At present, it seems that it does not support setting the image size