Skip to content
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

feat: Moving from ipfs-http-client -> kubo-rpc-client #1124

Merged
merged 2 commits into from
Jan 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions add-on/src/lib/ipfs-client/external.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@

import debug from 'debug'

import { create } from 'ipfs-http-client'
import { create } from 'kubo-rpc-client'
const log = debug('ipfs-companion:client:external')
log.error = debug('ipfs-companion:client:external:error')

export async function init (browser, opts) {
log(`init with IPFS API at ${opts.apiURLString}`)
const clientConfig = opts.apiURLString
// https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-http-client#importing-the-module-and-usage
const api = await create(clientConfig)
return api
}
Expand Down
4 changes: 2 additions & 2 deletions add-on/src/lib/ipfs-client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export async function destroyIpfsClient (browser) {
*
* @typedef {embedded|brave|external} Browser
* @param {Browser} browser
* @param {import('ipfs-http-client').default} instance
* @param {import('kubo-rpc-client').default} instance
* @param {Object} opts
* @param {Array.[InternalTabReloader|LocalGatewayReloader|WebUiReloader]=} reloadExtensions
* @returns {void}
Expand Down Expand Up @@ -102,7 +102,7 @@ async function _reloadIpfsClientDependents (
*
* @typedef {embedded|brave|external} Browser
* @param {Browser} browser
* @param {import('ipfs-http-client').default} instance
* @param {import('kubo-rpc-client').default} instance
* @param {Object} opts
* @returns {void}
*/
Expand Down
2 changes: 1 addition & 1 deletion add-on/src/lib/ipfs-companion.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default async function init () {
const onBeforeSendInfoSpec = ['blocking', 'requestHeaders']
if (browser.webRequest.OnBeforeSendHeadersOptions && 'EXTRA_HEADERS' in browser.webRequest.OnBeforeSendHeadersOptions) {
// Chrome 72+ requires 'extraHeaders' for accessing all headers
// Note: we need this for code ensuring ipfs-http-client can talk to API without setting CORS
// Note: we need this for code ensuring kubo-rpc-client can talk to API without setting CORS
onBeforeSendInfoSpec.push('extraHeaders')
}
browser.webRequest.onBeforeSendHeaders.addListener(onBeforeSendHeaders, { urls: ['<all_urls>'] }, onBeforeSendInfoSpec)
Expand Down
2 changes: 1 addition & 1 deletion add-on/src/lib/ipfs-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export function createRequestModifier (getState, dnslinkResolver, ipfsPathValida
// '403 - Forbidden' fix for Chrome and Firefox
// --------------------------------------------
// We update "Origin: *-extension://" HTTP headers in requests made to API
// by js-ipfs-http-client running in the background page of browser
// by js-kubo-rpc-client running in the background page of browser
// extension. Without this, some users would need to do manual CORS
// whitelisting by adding "..extension://<UUID>" to
// API.HTTPHeaders.Access-Control-Allow-Origin in go-ipfs config.
Expand Down
Loading