-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Add global option to specify the multibase encoding (client side) #5777
Conversation
50a0b45
to
16ee061
Compare
16ee061
to
71f36ca
Compare
Are you planning on allowing people to specify CID base via the HTTP API? It's not absolutely necessary, since the CID can be upgraded/converted client side, but it's super convenient for anyone consuming the HTTP API directly for them to be able to specify it...or to flip it round, it's a bit onerous for every API consumer to have to implement an option for doing this client side for each CID they recieve. I have implemented it for the listed HTTP endoints here ipfs/js-ipfs#1552. I think it would be worthwile for go-ipfs to also have this option. |
Agreed with @alanshaw, why not add this arg to the http-api as well. This it trickles nicely from cli -> http-api -> core. |
I believe the plan was to:
Personally, I prefer keeping display logic client-side but I won't really object to a server-side option (given that we already have a text-based API). Edit: on the other hand, I'd like to avoid complicating the server-side logic, regardless. |
Understood. I don't think it needs to be complicated, for the JS side it was simply adding the additional parameter and reusing the logic that is already being used in the CLI for each route that we want to support it. I still think there's a case for doing this. Maybe consumers might want to save bytes in their response by using a more compact encoding? I'm sure there's even more reasons (in addition to that and the others I outlined above) that we're not even considering... |
@Stebalien @alanshaw sorry, I have been dragging my feet on this on because there is not any clean solution. The client side solution ended up being not so nice because sometime we return formatted string with CID in them (see My current thinking is to switch to server side. Most of the time CIDs are encoded in the @alanshaw note, that specifying |
Oh, agree! I opened this yesterday: ipfs-inactive/interface-js-ipfs-core#394 |
Ah, JS doesn't have
In ipfs/js-ipfs#1552, for the CLI we're able to do everything client side for the commands we currently have, aside from
Yes, thanks 😄, that's taken into account in the PR.
Yes, interested to know which and why - I've listed the commands I've implemented it for in ipfs/js-ipfs#1552. I'm not aware of any issues... |
@alanshaw I am confused, using the (I am not familiar with how command line requests get translated to API requests but I am assuming |
71f36ca
to
2f75218
Compare
2f75218
to
c4849c3
Compare
We choose the options from the command line that we want to pass to the server (core).
The CLI interacts with a IPFS core interface, which might be an actual instance of js-ipfs core or it might be a js-ipfs-api, depending on whether there's a daemon running or not. So we could pass this option into the core interface to take advantage of the So, the |
License: MIT Signed-off-by: Kevin Atkinson <k@kevina.org>
c4849c3
to
2314b14
Compare
…nds. This also adds a global --output-cidv1 option. License: MIT Signed-off-by: Kevin Atkinson <k@kevina.org>
2314b14
to
0518505
Compare
Other related changes. License: MIT Signed-off-by: Kevin Atkinson <k@kevina.org>
License: MIT Signed-off-by: Kevin Atkinson <k@kevina.org>
6901166
to
3093b6c
Compare
License: MIT Signed-off-by: Kevin Atkinson <k@kevina.org>
Closing this because the general consensus is we are going with a (mostly) server side approach. |
(please don't delete a branch and allow it to be archived so that we have the code in case we ever need to refer back to it) |
Redo and simplification of #5464.
After giving it some careful thought I think doing the conversion on the server side for now makes the most sense (see #5789). In particular this code relies on using global variables and a new type to do most of the work and avoid having to thread the cid base though to the point where they get displayed. However, using this hack means that
?enc=text
http requests will also ignore the CID base.The following command are implemented client side:
The following are implemented sever side
ipfs resolve
because it uses a path andipfs refs
do to the fact that a formatted string is sent via the API.Todo (if we decide to go with this implementation):
--cid-base
option in go-ipfs. go-mfs#5Depends on ipfs/go-cidutil#8 and ipfs/go-mfs#5.
Closes #5233. Closes #5234. Closes #5349.