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

fix(ui): replace IPFS API with Kubo RPC #2267

Merged
merged 1 commit into from
Sep 24, 2024
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
2 changes: 1 addition & 1 deletion cors-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ set -e
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[$ALLOW_ORIGINS]"
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "POST"]'

echo "IPFS API CORS headers configured for $ALLOW_ORIGINS"
echo "Kubo RPC CORS headers configured for $ALLOW_ORIGINS"
echo "Please restart your IPFS daemon"
6 changes: 3 additions & 3 deletions public/locales/en/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"done": "Done"
},
"cliModal": {
"description": "Paste the following into your terminal to do this task in IPFS via the command line. Remember that you'll need to replace placeholders with your specific parameters."
"description": "Paste the following into your terminal to do this task in Kubo via the command line. Remember that you'll need to replace placeholders with your specific parameters."
},
"nav": {
"bugsLink": "Report a bug",
Expand All @@ -43,7 +43,7 @@
"status": {
"connectedToIpfs": "Connected to IPFS",
"connectingToIpfs": "Connecting to IPFS…",
"couldNotConnect": "Could not connect to the IPFS API"
"couldNotConnect": "Could not connect to the Kubo RPC"
},
"apiAddressForm": {
"placeholder": "Enter a URL (http://127.0.0.1:5001) or a Multiaddr (/ip4/127.0.0.1/tcp/5001)"
Expand All @@ -60,7 +60,7 @@
"advanced": "Advanced",
"agent": "Agent",
"api": "Kubo RPC",
"apiAddress": "RPC API address",
"apiAddress": "Kubo RPC API address",
"blocks": "Blocks",
"connection": "Connection",
"downSpeed": "Incoming",
Expand Down
6 changes: 3 additions & 3 deletions public/locales/en/notify.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"ipfsApiRequestFailed": "Could not connect. Please check if your daemon is running.",
"windowIpfsRequestFailed": "IPFS request failed. Please check your IPFS Companion settings.",
"ipfsInvalidApiAddress": "The provided IPFS API address is invalid.",
"ipfsConnectSuccess": "Successfully connected to the IPFS API address",
"ipfsConnectFail": "Unable to connect to the provided IPFS API address",
"ipfsInvalidApiAddress": "The provided Kubo RPC address is invalid.",
"ipfsConnectSuccess": "Successfully connected to the Kubo RPC address",
"ipfsConnectFail": "Unable to connect to the provided Kubo RPC address",
"ipfsPinFailReason": "Unable to set pinning at {serviceName}: {errorMsg}",
"ipfsPinSucceedReason": "Successfully pinned at {serviceName}",
"ipfsUnpinSucceedReason": "Successfully unpinned from {serviceName}",
Expand Down
2 changes: 1 addition & 1 deletion public/locales/en/status.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"step2": {
"title": "Connection status",
"paragraph1": "Click this icon from anywhere in the app to return to the Status page. If you lose your connection to the IPFS API, the icon will turn red.",
"paragraph1": "Click this icon from anywhere in the app to return to the Status page. If you lose your connection to the Kubo RPC, the icon will turn red.",
"paragraph2": "If you need to configure a custom API address for your node, just click the \"Edit\" link next to where the API address is listed on this page."
},
"step3": {
Expand Down
8 changes: 4 additions & 4 deletions public/locales/en/welcome.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
},
"notConnected": {
"paragraph1": "<0>Check out the installation guide in the <1>IPFS Docs</1>, or try these common fixes:</0>",
"paragraph2": "<0>Is your IPFS daemon running? Try starting or restarting it from your terminal:</0>",
"paragraph3": "<0>Is your IPFS API configured to allow <1>cross-origin (CORS) requests</1>? If not, run these commands and then start your daemon from the terminal:</0>",
"paragraph4": "<0>Is your IPFS API on a port other than 5001? If your node is configured with a <1>custom API address</1>, enter it here.</0>"
"paragraph2": "<0>Is your IPFS daemon running? Try starting or restarting Kubo from your terminal:</0>",
"paragraph3": "<0>Is your Kubo RPC API configured to allow <1>cross-origin (CORS) requests</1>? If not, run these commands and then start your daemon from the terminal:</0>",
"paragraph4": "<0>Is your Kubo RPC API on a port other than 5001? If your node is configured with a <1>custom API address</1>, enter it here.</0>"
},
"aboutIpfs": {
"header": "What is IPFS?",
Expand All @@ -31,7 +31,7 @@
"step1": {
"title": "Welcome page",
"paragraph1": "This page lets you know if you're connected to IPFS, and offers ideas for things you can do in this app.",
"paragraph2": "If you aren't connected to the IPFS API, this page also appears in place of some other pages, with hints for how to get connected.",
"paragraph2": "If you aren't connected to the Kubo RPC API, this page also appears in place of some other pages, with hints for how to get connected.",
"paragraph3": "You can visit this page from anywhere in the app by clicking the IPFS cube logo in the navigation bar."
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/bundles/ipfs-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ const actions = {
})

if (!result) {
throw Error(`Could not connect to the IPFS API (${apiAddress})`)
throw Error(`Could not connect to the Kubo RPC (${apiAddress})`)
} else {
return result
}
Expand Down Expand Up @@ -421,7 +421,7 @@ const actions = {
await writeSetting('ipfsApi', apiAddress)
context.dispatch({ type: ACTIONS.IPFS_API_ADDRESS_UPDATED, payload: apiAddress })

// Sends action to indicate we're going to try to update the IPFS API address.
// Sends action to indicate we're going to try to update the Kubo RPC address.
// There is logic to retry doTryInitIpfs in bundles/retry-init.js, so
// we're triggering the PENDING_FIRST_CONNECTION action here to avoid blocking
// the UI while we automatically retry.
Expand Down
8 changes: 4 additions & 4 deletions src/components/is-not-connected/IsNotConnected.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ const IsNotConnected = ({ t, apiUrl, connected, sameOrigin, ipfsApiAddress, doUp
</Trans>
<ol className='pl3 pt2'>
<Trans i18nKey='notConnected.paragraph2' t={t}>
<li className='mb3'>Is your IPFS daemon running? Try starting or restarting it from your terminal:</li>
<li className='mb3'>Is your IPFS daemon running? Try starting or restarting Kubo from your terminal:</li>
</Trans>
<Shell title='Any Shell'>
<code className='db'><b className='no-select'>$ </b>ipfs daemon</code>
<code className='db'>Initializing daemon...</code>
<code className='db'>API server listening on /ip4/127.0.0.1/tcp/5001</code>
<code className='db'>RPC API server listening on /ip4/127.0.0.1/tcp/5001</code>
</Shell>
{ !sameOrigin && (
<div>
<Trans i18nKey='notConnected.paragraph3' t={t}>
<li className='mb3 mt4'>Is your IPFS API configured to allow <a className='link blue' href='https://github.com/ipfs/ipfs-webui#configure-kubo-rpc-api-cors-headers'>cross-origin (CORS) requests</a>? If not, run these commands and then start your daemon from the terminal:</li>
<li className='mb3 mt4'>Is your Kubo RPC API configured to allow <a className='link blue' href='https://github.com/ipfs/ipfs-webui#configure-kubo-rpc-api-cors-headers'>cross-origin (CORS) requests</a>? If not, run these commands and then start your daemon from the terminal:</li>
</Trans>
<div className='br1 overflow-hidden'>
<div className='f7 mb0 sans-serif charcoal pv1 pl2 bg-black-20 flex items-center overflow-x-auto'>
Expand Down Expand Up @@ -77,7 +77,7 @@ const IsNotConnected = ({ t, apiUrl, connected, sameOrigin, ipfsApiAddress, doUp
</div>
)}
<Trans i18nKey='notConnected.paragraph4' t={t}>
<li className='mt4 mb3'>Is your IPFS API on a port other than 5001? If your node is configured with a <a className='link blue' href='https://github.com/ipfs/kubo/blob/master/docs/config.md#addresses' target='_blank' rel='noopener noreferrer'>custom API address</a>, enter it here.</li>
<li className='mt4 mb3'>Is your Kubo RPC on a port other than 5001? If your node is configured with a <a className='link blue' href='https://github.com/ipfs/kubo/blob/master/docs/config.md#addresses' target='_blank' rel='noopener noreferrer'>custom RPC API address</a>, enter it here.</li>
</Trans>
<ApiAddressForm
t={t}
Expand Down
2 changes: 1 addition & 1 deletion src/settings/SettingsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const SettingsPage = ({
<title>{t('title')} | IPFS</title>
</Helmet>

{/* Enable a full screen loader after updating to a new IPFS API address.
{/* Enable a full screen loader after updating to a new Kubo RPC address.
* Will not show on consequent retries after a failure.
*/}
{ ipfsPendingFirstConnection
Expand Down
Loading