Conversation
Adds `w3 ps` command to run an http server on localhost to allow you to use the IPFS pinning service api with w3up and get ucan auth in pinning service mode. ```sh $ w3 ps ⁂ IPFS Pinning Service on http://127.0.0.1:1337 $ ipfs pin remote service add w3 'http://127.0.0.1:1337' 'did:key:z6MkvqaczHouddZ91gWNsuy2QFm419WFodXbVjBJykvzw1eK' $ ipfs pin remote add --service w3 <cid> ``` License: MIT Signed-off-by: Oli Evans <oli@protocol.ai>
olizilla
commented
Mar 27, 2023
| const pinCache = new Map() | ||
| const client = await getClient() | ||
| const whoami = client.agent().did() | ||
| const token = key ?? whoami |
Contributor
Author
There was a problem hiding this comment.
The http api bound to loopback ip, so token auth is less critical, but kubo requires the user to provide a key when setting up a pin service remote.
@alanshaw suggested setting this as the space DID that we want the local pin service to write to, which would be rad, but we also need changes to the w3up-client to allow users to pass in a space did (with) when doing an upload. The upload client supports it but it's not exposed in w3up-client
olizilla
commented
Mar 27, 2023
pin.js
Outdated
| const rootCID = CID.parse(cid) | ||
| const ipfsUrl = new URL(`/ipfs/${cid}?format=car`, ipfsGatewayUrl, { signal }) | ||
| const res = await fetch(ipfsUrl) | ||
| const storedCID = await client.uploadCAR({ stream: () => res.body }, { |
Contributor
Author
There was a problem hiding this comment.
We should tweak the w3up-client uploadCAR to allow users to pass a stream, as currently it requires a blob but just calls stream on it, and it means we can't pass a stream directly, and need this madness.
License: MIT Signed-off-by: Oli Evans <oli@protocol.ai>
License: MIT Signed-off-by: Oli Evans <oli@protocol.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
POC based on https://hackmd.io/@olizilla/beam
Adds
w3 pscommand to run an http server on localhost to allow you to use the IPFS pinning service api with w3up and get ucan auth in pinning service mode.License: MIT