Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

Commit

Permalink
fix: update IPFS API endpoints (#139)
Browse files Browse the repository at this point in the history
`ipfs` URLs were changed during the micro service REST endpoint
alignment, and they are incorrect.

## Solution:
- Rollback `ipfs` URL changes

## How to Test

- [ ] Confirm that images can be published to `ipfs`
  • Loading branch information
mattheworris authored Jul 3, 2024
1 parent c40f369 commit 9ede276
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libs/common/src/utils/ipfs.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class IpfsService {
}

private async ipfsPinBuffer(filename: string, contentType: string, fileBuffer: Buffer): Promise<FilePin> {
const ipfsAdd = `${this.configService.ipfsEndpoint}/v1/add`;
const ipfsAdd = `${this.configService.ipfsEndpoint}/api/v0/add`;
const form = new FormData();
form.append('file', fileBuffer, {
filename,
Expand Down Expand Up @@ -87,7 +87,7 @@ export class IpfsService {
if (checkExistence && !(await this.isPinned(cid))) {
return Promise.resolve(Buffer.alloc(0));
}
const ipfsGet = `${this.configService.ipfsEndpoint}/v1/cat?arg=${cid}`;
const ipfsGet = `${this.configService.ipfsEndpoint}/api/v0/cat?arg=${cid}`;
const ipfsAuthUser = this.configService.ipfsBasicAuthUser;
const ipfsAuthSecret = this.configService.ipfsBasicAuthSecret;
const ipfsAuth = ipfsAuthUser && ipfsAuthSecret ? `Basic ${Buffer.from(`${ipfsAuthUser}:${ipfsAuthSecret}`).toString('base64')}` : '';
Expand All @@ -107,7 +107,7 @@ export class IpfsService {
public async isPinned(cid: string): Promise<boolean> {
const parsedCid = CID.parse(cid);
const v0Cid = parsedCid.toV0().toString();
const ipfsGet = `${this.configService.ipfsEndpoint}/v1/pin/ls?type=all&quiet=true&arg=${v0Cid}`;
const ipfsGet = `${this.configService.ipfsEndpoint}/api/v0/pin/ls?type=all&quiet=true&arg=${v0Cid}`;
const ipfsAuthUser = this.configService.ipfsBasicAuthUser;
const ipfsAuthSecret = this.configService.ipfsBasicAuthSecret;
const ipfsAuth = ipfsAuthUser && ipfsAuthSecret ? `Basic ${Buffer.from(`${ipfsAuthUser}:${ipfsAuthSecret}`).toString('base64')}` : '';
Expand Down

0 comments on commit 9ede276

Please sign in to comment.