ipfs / ipfs-companion

Browser extension that simplifies access to IPFS resources on the web
https://docs.ipfs.tech/install/ipfs-companion/
Creative Commons Zero v1.0 Universal
2.04k stars 323 forks source link

feat: show full rpc backend version #1294

Closed lidel closed 9 months ago

lidel commented 9 months ago

This PR will try to read version from ipfs.id before it falls back to ipfs.version.

Rationale:

Preview

Before After
2023-09-22_15-21 2023-09-22_15-22 2023-09-22_15-25
lidel commented 9 months ago

we want this to work with any ipfs implementation in the future?

Good question @whizzzkid! Here is how I think about this, in the context of effort to ensure "Kubo !== IPFS", but just an implementation.

We want Companion to work with other backends, yes, but currently, the default backend is Kubo-specific, and we should start making it more obvious in the code (makes it easier to refactor in the future, when we add different backends).

The /api/v0 is "Kubo RPC" and not "IPFS API" for a reason. We've invested a lot of time to remove confusion that Kubo is not "IPFS" and that /api/v0 is not "IPFS API".

Clearly naming Kubo-specific things makes it easier to understand there the line between "generic IPFS" like HTTP Gateways on /ipfs and /ipns or /routing/v1 and "legacy/kubo-specific" like /api/v0.

Other implementations are free to implement endpoint compatible with Kubo RPC and become drop-in replacement (ipfs-cluster does this already), but it is still called "Kubo RPC" as Kubo is the source of truth, and the API is defined at https://docs.ipfs.tech/reference/kubo/rpc/, and has utility limited by Kubo itself (we talk to RPC using a dedicated kubo-rpc-client, we make breaking changes to this RPC API and there is no guarantee of stability nor being "general-purpose", it is not part of https://specs.ipfs.tech).

I think what we want to do over time is to make it more clear that "External" backend today is Kubo-specific, and create room for other implementations and their own RPC protocols (if they decide to use something other than Kubo RPC compatible one).

I did nto want to rename other variables to keep this PR easier to review, but I did rename label to "External (Kubo RPC)" in https://github.com/ipfs/ipfs-companion/pull/1294/commits/eac436c8fa67a447cd481b222d9ac24228abb4d7 to make it extra clear to the user that this is "Kubo-compatible" backend.