@helia/verified-fetch-interop 1.21.0 → 1.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/bin.js +0 -1
- package/dist/src/bin.js.map +1 -1
- package/dist/src/fixtures/create-kubo.d.ts +2 -2
- package/dist/src/fixtures/create-kubo.d.ts.map +1 -1
- package/dist/src/fixtures/create-kubo.js +9 -8
- package/dist/src/fixtures/create-kubo.js.map +1 -1
- package/dist/src/fixtures/load-fixtures.d.ts +6 -0
- package/dist/src/fixtures/load-fixtures.d.ts.map +1 -0
- package/dist/src/fixtures/load-fixtures.js +14 -0
- package/dist/src/fixtures/load-fixtures.js.map +1 -0
- package/dist/src/json.spec.js +8 -10
- package/dist/src/json.spec.js.map +1 -1
- package/dist/src/unixfs-dir.spec.js +35 -27
- package/dist/src/unixfs-dir.spec.js.map +1 -1
- package/dist/src/websites.spec.js +20 -19
- package/dist/src/websites.spec.js.map +1 -1
- package/package.json +6 -5
- package/src/bin.ts +0 -1
- package/src/fixtures/create-kubo.ts +9 -8
- package/src/fixtures/load-fixtures.ts +15 -0
- package/src/json.spec.ts +8 -11
- package/src/unixfs-dir.spec.ts +35 -32
- package/src/websites.spec.ts +20 -20
- package/dist/src/fixtures/create-kubo.browser.d.ts +0 -3
- package/dist/src/fixtures/create-kubo.browser.d.ts.map +0 -1
- package/dist/src/fixtures/create-kubo.browser.js +0 -30
- package/dist/src/fixtures/create-kubo.browser.js.map +0 -1
- package/dist/src/fixtures/load-fixture-data.d.ts +0 -3
- package/dist/src/fixtures/load-fixture-data.d.ts.map +0 -1
- package/dist/src/fixtures/load-fixture-data.js +0 -8
- package/dist/src/fixtures/load-fixture-data.js.map +0 -1
- package/src/fixtures/create-kubo.browser.ts +0 -30
- package/src/fixtures/load-fixture-data.ts +0 -9
package/dist/src/bin.js
CHANGED
package/dist/src/bin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../../src/bin.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../../src/bin.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,yDAAyD;AACzD,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAA;AAEtE,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE;IAC3C,GAAG;CACJ,CAAC,CAAA;AAEF,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;IAC9B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;AAC5B,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;IAC9B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;AAC5B,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;IACxB,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAA;AACzB,CAAC,CAAC,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export declare function createKuboNode(): Promise<
|
|
1
|
+
import { type KuboNode } from 'ipfsd-ctl';
|
|
2
|
+
export declare function createKuboNode(repoPath?: undefined): Promise<KuboNode>;
|
|
3
3
|
//# sourceMappingURL=create-kubo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-kubo.d.ts","sourceRoot":"","sources":["../../../src/fixtures/create-kubo.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-kubo.d.ts","sourceRoot":"","sources":["../../../src/fixtures/create-kubo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAA;AAIrD,wBAAsB,cAAc,CAAE,QAAQ,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,CA4B7E"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import { createController } from 'ipfsd-ctl';
|
|
1
|
+
import { createNode } from 'ipfsd-ctl';
|
|
3
2
|
import { path as kuboPath } from 'kubo';
|
|
4
|
-
import
|
|
5
|
-
export async function createKuboNode() {
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import { create } from 'kubo-rpc-client';
|
|
4
|
+
export async function createKuboNode(repoPath = undefined) {
|
|
5
|
+
return createNode({
|
|
6
|
+
type: 'kubo',
|
|
7
|
+
rpc: create,
|
|
8
|
+
bin: kuboPath(),
|
|
9
9
|
test: true,
|
|
10
|
-
|
|
10
|
+
repo: repoPath,
|
|
11
|
+
init: {
|
|
11
12
|
config: {
|
|
12
13
|
Addresses: {
|
|
13
14
|
Swarm: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-kubo.js","sourceRoot":"","sources":["../../../src/fixtures/create-kubo.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"create-kubo.js","sourceRoot":"","sources":["../../../src/fixtures/create-kubo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAiB,MAAM,WAAW,CAAA;AACrD,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,MAAM,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAExC,MAAM,CAAC,KAAK,UAAU,cAAc,CAAE,QAAQ,GAAG,SAAS;IACxD,OAAO,UAAU,CAAC;QAChB,IAAI,EAAE,MAAM;QACZ,GAAG,EAAE,MAAM;QACX,GAAG,EAAE,QAAQ,EAAE;QACf,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,SAAS,EAAE;oBACT,KAAK,EAAE;wBACL,uBAAuB;wBACvB,0BAA0B;qBAC3B;oBACD,OAAO,EAAE,yBAAyB;iBACnC;gBACD,OAAO,EAAE;oBACP,OAAO,EAAE,IAAI;oBACb,gBAAgB,EAAE,IAAI;oBACtB,WAAW,EAAE;wBACX,6BAA6B,EAAE,CAAC,GAAG,CAAC;wBACpC,8BAA8B,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC;qBAClE;iBACF;aACF;SACF;QACD,IAAI,EAAE,CAAC,4BAA4B,EAAE,yBAAyB,CAAC;KAChE,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Only callable from node (intended to be consumed by .aegir.js)
|
|
3
|
+
* but the fixtures loaded by this function are also used by browser tests.
|
|
4
|
+
*/
|
|
5
|
+
export declare function loadFixtures(IPFS_PATH?: undefined): Promise<void>;
|
|
6
|
+
//# sourceMappingURL=load-fixtures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-fixtures.d.ts","sourceRoot":"","sources":["../../../src/fixtures/load-fixtures.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAsB,YAAY,CAAE,SAAS,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAMxE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { $ } from 'execa';
|
|
2
|
+
import fg from 'fast-glob';
|
|
3
|
+
import { path as kuboPath } from 'kubo';
|
|
4
|
+
/**
|
|
5
|
+
* Only callable from node (intended to be consumed by .aegir.js)
|
|
6
|
+
* but the fixtures loaded by this function are also used by browser tests.
|
|
7
|
+
*/
|
|
8
|
+
export async function loadFixtures(IPFS_PATH = undefined) {
|
|
9
|
+
const kuboBinary = process.env.KUBO_BINARY ?? kuboPath();
|
|
10
|
+
for (const carFile of await fg.glob('**/fixtures/data/*.car')) {
|
|
11
|
+
await $({ env: { IPFS_PATH } }) `${kuboBinary} dag import --pin-roots=false --offline ${carFile}`;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=load-fixtures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-fixtures.js","sourceRoot":"","sources":["../../../src/fixtures/load-fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,MAAM,WAAW,CAAA;AAC1B,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,MAAM,CAAA;AAEvC;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAE,SAAS,GAAG,SAAS;IACvD,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,QAAQ,EAAE,CAAA;IAExD,KAAK,MAAM,OAAO,IAAI,MAAM,EAAE,CAAC,IAAI,CAAC,wBAAwB,CAAC,EAAE,CAAC;QAC9D,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,SAAS,EAAE,EAAE,CAAC,CAAA,GAAG,UAAU,2CAA2C,OAAO,EAAE,CAAA;IAClG,CAAC;AACH,CAAC"}
|
package/dist/src/json.spec.js
CHANGED
|
@@ -2,31 +2,29 @@
|
|
|
2
2
|
import { createVerifiedFetch } from '@helia/verified-fetch';
|
|
3
3
|
import { expect } from 'aegir/chai';
|
|
4
4
|
import { CID } from 'multiformats/cid';
|
|
5
|
-
import { createKuboNode } from './fixtures/create-kubo.js';
|
|
6
|
-
import { loadFixtureDataCar } from './fixtures/load-fixture-data.js';
|
|
7
5
|
describe('@helia/verified-fetch - json', () => {
|
|
8
6
|
describe('unixfs - multiblock', () => {
|
|
9
|
-
let controller;
|
|
10
7
|
let verifiedFetch;
|
|
11
8
|
before(async () => {
|
|
12
|
-
controller = await createKuboNode();
|
|
13
|
-
await controller.start();
|
|
14
9
|
// As of 2024-01-18, https://cloudflare-ipfs.com/ipns/tokens.uniswap.org resolves to:
|
|
15
10
|
// root: QmQJ8fxavY54CUsxMSx9aE9Rdcmvhx8awJK2jzJp4iAqCr
|
|
16
11
|
// child1: QmNik5N4ryNwzzXYq5hCYKGcRjAf9QtigxtiJh9o8aXXbG // partial JSON
|
|
17
12
|
// child2: QmWNBJX6fZyNTLWNYBHxAHpBctCP43R2zeqV2G8uavqFZn // partial JSON
|
|
18
|
-
await loadFixtureDataCar(controller, 'QmQJ8fxavY54CUsxMSx9aE9Rdcmvhx8awJK2jzJp4iAqCr-tokens.uniswap.org-2024-01-18.car');
|
|
19
13
|
verifiedFetch = await createVerifiedFetch({
|
|
20
|
-
gateways: [
|
|
21
|
-
routers: [
|
|
14
|
+
gateways: ['http://127.0.0.1:8180'],
|
|
15
|
+
routers: ['http://127.0.0.1:8180'],
|
|
16
|
+
allowInsecure: true,
|
|
17
|
+
allowLocal: true
|
|
22
18
|
});
|
|
23
19
|
});
|
|
24
20
|
after(async () => {
|
|
25
|
-
await controller.stop();
|
|
26
21
|
await verifiedFetch.stop();
|
|
27
22
|
});
|
|
28
23
|
it('handles UnixFS-chunked JSON file', async () => {
|
|
29
|
-
const resp = await verifiedFetch(CID.parse('QmQJ8fxavY54CUsxMSx9aE9Rdcmvhx8awJK2jzJp4iAqCr')
|
|
24
|
+
const resp = await verifiedFetch(CID.parse('QmQJ8fxavY54CUsxMSx9aE9Rdcmvhx8awJK2jzJp4iAqCr'), {
|
|
25
|
+
allowLocal: true,
|
|
26
|
+
allowInsecure: true
|
|
27
|
+
});
|
|
30
28
|
expect(resp).to.be.ok();
|
|
31
29
|
const jsonObj = await resp.json();
|
|
32
30
|
expect(jsonObj).to.be.ok();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.spec.js","sourceRoot":"","sources":["../../src/json.spec.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"json.spec.js","sourceRoot":"","sources":["../../src/json.spec.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAEtC,QAAQ,CAAC,8BAA8B,EAAE,GAAG,EAAE;IAC5C,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;QACnC,IAAI,aAA8D,CAAA;QAElE,MAAM,CAAC,KAAK,IAAI,EAAE;YAChB,qFAAqF;YACrF,uDAAuD;YACvD,yEAAyE;YACzE,yEAAyE;YACzE,aAAa,GAAG,MAAM,mBAAmB,CAAC;gBACxC,QAAQ,EAAE,CAAC,uBAAuB,CAAC;gBACnC,OAAO,EAAE,CAAC,uBAAuB,CAAC;gBAClC,aAAa,EAAE,IAAI;gBACnB,UAAU,EAAE,IAAI;aACjB,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QAEF,KAAK,CAAC,KAAK,IAAI,EAAE;YACf,MAAM,aAAa,CAAC,IAAI,EAAE,CAAA;QAC5B,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,kCAAkC,EAAE,KAAK,IAAI,EAAE;YAChD,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,gDAAgD,CAAC,EAAE;gBAC5F,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C,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QACzD,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -2,59 +2,62 @@
|
|
|
2
2
|
import { createVerifiedFetch } from '@helia/verified-fetch';
|
|
3
3
|
import { expect } from 'aegir/chai';
|
|
4
4
|
import { filetypemime } from 'magic-bytes.js';
|
|
5
|
-
import { createKuboNode } from './fixtures/create-kubo.js';
|
|
6
|
-
import { loadFixtureDataCar } from './fixtures/load-fixture-data.js';
|
|
7
5
|
describe('@helia/verified-fetch - unixfs directory', () => {
|
|
8
|
-
let controller;
|
|
9
6
|
let verifiedFetch;
|
|
10
7
|
before(async () => {
|
|
11
|
-
controller = await createKuboNode();
|
|
12
|
-
await controller.start();
|
|
13
8
|
verifiedFetch = await createVerifiedFetch({
|
|
14
|
-
gateways: [
|
|
15
|
-
routers: [
|
|
9
|
+
gateways: ['http://127.0.0.1:8180'],
|
|
10
|
+
routers: [],
|
|
11
|
+
allowInsecure: true,
|
|
12
|
+
allowLocal: true
|
|
16
13
|
});
|
|
17
14
|
});
|
|
18
15
|
after(async () => {
|
|
19
|
-
await controller.stop();
|
|
20
16
|
await verifiedFetch.stop();
|
|
21
17
|
});
|
|
22
18
|
describe('unixfs-dir-redirect', () => {
|
|
23
|
-
before(async () => {
|
|
24
|
-
await loadFixtureDataCar(controller, 'gateway-conformance-fixtures.car');
|
|
25
|
-
});
|
|
26
19
|
[
|
|
27
20
|
'https://example.com/ipfs/bafybeifq2rzpqnqrsdupncmkmhs3ckxxjhuvdcbvydkgvch3ms24k5lo7q',
|
|
28
21
|
'ipfs://bafybeifq2rzpqnqrsdupncmkmhs3ckxxjhuvdcbvydkgvch3ms24k5lo7q',
|
|
29
22
|
'http://example.com/ipfs/bafybeifq2rzpqnqrsdupncmkmhs3ckxxjhuvdcbvydkgvch3ms24k5lo7q'
|
|
30
23
|
].forEach((url) => {
|
|
31
24
|
it(`request to unixfs directory with ${url} should return a 301 with a trailing slash`, async () => {
|
|
32
|
-
const response = await verifiedFetch(url, {
|
|
25
|
+
const response = await verifiedFetch(url, {
|
|
26
|
+
redirect: 'manual',
|
|
27
|
+
allowLocal: true,
|
|
28
|
+
allowInsecure: true
|
|
29
|
+
});
|
|
33
30
|
expect(response).to.be.ok();
|
|
34
31
|
expect(response.status).to.equal(301);
|
|
35
32
|
expect(response.headers.get('location')).to.equal(`${url}/`);
|
|
36
33
|
});
|
|
37
34
|
});
|
|
38
35
|
});
|
|
36
|
+
// This tests the content of https://explore.ipld.io/#/explore/QmdmQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7RgQm/1%20-%20Barrel%20-%20Part%201
|
|
39
37
|
describe('XKCD Barrel Part 1', () => {
|
|
40
|
-
before(async () => {
|
|
41
|
-
// This is the content of https://explore.ipld.io/#/explore/QmdmQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7RgQm/1%20-%20Barrel%20-%20Part%201
|
|
42
|
-
await loadFixtureDataCar(controller, 'QmbQDovX7wRe9ek7u6QXe9zgCXkTzoUSsTFJEkrYV1HrVR-xkcd-Barrel-part-1.car');
|
|
43
|
-
});
|
|
44
38
|
it('fails to load when passed the root', async () => {
|
|
45
39
|
// The spec says we should generate HTML with directory listings, but we don't do that yet, so expect a failure
|
|
46
|
-
const resp = await verifiedFetch('ipfs://QmbQDovX7wRe9ek7u6QXe9zgCXkTzoUSsTFJEkrYV1HrVR'
|
|
40
|
+
const resp = await verifiedFetch('ipfs://QmbQDovX7wRe9ek7u6QXe9zgCXkTzoUSsTFJEkrYV1HrVR', {
|
|
41
|
+
allowLocal: true,
|
|
42
|
+
allowInsecure: true
|
|
43
|
+
});
|
|
47
44
|
expect(resp).to.be.ok();
|
|
48
45
|
expect(resp.status).to.equal(501); // TODO: we should do a directory listing instead
|
|
49
46
|
});
|
|
50
47
|
it('can return a string for unixfs pathed data', async () => {
|
|
51
|
-
const resp = await verifiedFetch('ipfs://QmbQDovX7wRe9ek7u6QXe9zgCXkTzoUSsTFJEkrYV1HrVR/1 - Barrel - Part 1 - alt.txt'
|
|
48
|
+
const resp = await verifiedFetch('ipfs://QmbQDovX7wRe9ek7u6QXe9zgCXkTzoUSsTFJEkrYV1HrVR/1 - Barrel - Part 1 - alt.txt', {
|
|
49
|
+
allowLocal: true,
|
|
50
|
+
allowInsecure: true
|
|
51
|
+
});
|
|
52
52
|
expect(resp).to.be.ok();
|
|
53
53
|
const text = await resp.text();
|
|
54
54
|
expect(text).to.equal('Don\'t we all.');
|
|
55
55
|
});
|
|
56
56
|
it('can return an image for unixfs pathed data', async () => {
|
|
57
|
-
const resp = await verifiedFetch('ipfs://QmbQDovX7wRe9ek7u6QXe9zgCXkTzoUSsTFJEkrYV1HrVR/1 - Barrel - Part 1.png'
|
|
57
|
+
const resp = await verifiedFetch('ipfs://QmbQDovX7wRe9ek7u6QXe9zgCXkTzoUSsTFJEkrYV1HrVR/1 - Barrel - Part 1.png', {
|
|
58
|
+
allowLocal: true,
|
|
59
|
+
allowInsecure: true
|
|
60
|
+
});
|
|
58
61
|
expect(resp).to.be.ok();
|
|
59
62
|
const imgData = await resp.blob();
|
|
60
63
|
expect(imgData).to.be.ok();
|
|
@@ -65,8 +68,10 @@ describe('@helia/verified-fetch - unixfs directory', () => {
|
|
|
65
68
|
before(async () => {
|
|
66
69
|
await verifiedFetch.stop();
|
|
67
70
|
verifiedFetch = await createVerifiedFetch({
|
|
68
|
-
gateways: [
|
|
69
|
-
routers: [
|
|
71
|
+
gateways: ['http://127.0.0.1:8180'],
|
|
72
|
+
routers: ['http://127.0.0.1:8180'],
|
|
73
|
+
allowInsecure: true,
|
|
74
|
+
allowLocal: true
|
|
70
75
|
}, {
|
|
71
76
|
contentTypeParser: (bytes) => {
|
|
72
77
|
return filetypemime(bytes)?.[0];
|
|
@@ -74,18 +79,21 @@ describe('@helia/verified-fetch - unixfs directory', () => {
|
|
|
74
79
|
});
|
|
75
80
|
});
|
|
76
81
|
it('can return an image content-type for unixfs pathed data', async () => {
|
|
77
|
-
const resp = await verifiedFetch('ipfs://QmbQDovX7wRe9ek7u6QXe9zgCXkTzoUSsTFJEkrYV1HrVR/1 - Barrel - Part 1.png'
|
|
82
|
+
const resp = await verifiedFetch('ipfs://QmbQDovX7wRe9ek7u6QXe9zgCXkTzoUSsTFJEkrYV1HrVR/1 - Barrel - Part 1.png', {
|
|
83
|
+
allowLocal: true,
|
|
84
|
+
allowInsecure: true
|
|
85
|
+
});
|
|
78
86
|
// tediously this is actually a jpeg file with a .png extension
|
|
79
87
|
expect(resp.headers.get('content-type')).to.equal('image/jpeg');
|
|
80
88
|
});
|
|
81
89
|
});
|
|
90
|
+
// from https://github.com/ipfs/gateway-conformance/blob/193833b91f2e9b17daf45c84afaeeae61d9d7c7e/fixtures/trustless_gateway_car/single-layer-hamt-with-multi-block-files.car
|
|
82
91
|
describe('HAMT-sharded directory', () => {
|
|
83
|
-
before(async () => {
|
|
84
|
-
// from https://github.com/ipfs/gateway-conformance/blob/193833b91f2e9b17daf45c84afaeeae61d9d7c7e/fixtures/trustless_gateway_car/single-layer-hamt-with-multi-block-files.car
|
|
85
|
-
await loadFixtureDataCar(controller, 'bafybeidbclfqleg2uojchspzd4bob56dqetqjsj27gy2cq3klkkgxtpn4i-single-layer-hamt-with-multi-block-files.car');
|
|
86
|
-
});
|
|
87
92
|
it('loads path /ipfs/bafybeidbclfqleg2uojchspzd4bob56dqetqjsj27gy2cq3klkkgxtpn4i/685.txt', async () => {
|
|
88
|
-
const resp = await verifiedFetch('ipfs://bafybeidbclfqleg2uojchspzd4bob56dqetqjsj27gy2cq3klkkgxtpn4i/685.txt'
|
|
93
|
+
const resp = await verifiedFetch('ipfs://bafybeidbclfqleg2uojchspzd4bob56dqetqjsj27gy2cq3klkkgxtpn4i/685.txt', {
|
|
94
|
+
allowLocal: true,
|
|
95
|
+
allowInsecure: true
|
|
96
|
+
});
|
|
89
97
|
expect(resp).to.be.ok();
|
|
90
98
|
const text = await resp.text();
|
|
91
99
|
// npx kubo@0.25.0 cat '/ipfs/bafybeidbclfqleg2uojchspzd4bob56dqetqjsj27gy2cq3klkkgxtpn4i/685.txt'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unixfs-dir.spec.js","sourceRoot":"","sources":["../../src/unixfs-dir.spec.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"unixfs-dir.spec.js","sourceRoot":"","sources":["../../src/unixfs-dir.spec.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAG7C,QAAQ,CAAC,0CAA0C,EAAE,GAAG,EAAE;IACxD,IAAI,aAA4B,CAAA;IAEhC,MAAM,CAAC,KAAK,IAAI,EAAE;QAChB,aAAa,GAAG,MAAM,mBAAmB,CAAC;YACxC,QAAQ,EAAE,CAAC,uBAAuB,CAAC;YACnC,OAAO,EAAE,EAAE;YACX,aAAa,EAAE,IAAI;YACnB,UAAU,EAAE,IAAI;SACjB,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,KAAK,CAAC,KAAK,IAAI,EAAE;QACf,MAAM,aAAa,CAAC,IAAI,EAAE,CAAA;IAC5B,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;QACnC;YACE,sFAAsF;YACtF,oEAAoE;YACpE,qFAAqF;SACtF,CAAC,OAAO,CAAC,CAAC,GAAW,EAAE,EAAE;YACxB,EAAE,CAAC,oCAAoC,GAA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E,CAAC,yDAAyD,EAAE,KAAK,IAAI,EAAE;YACvE,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,+EAA+E,EAAE;gBAChH,UAAU,EAAE,IAAI;gBAChB,aAAa,EAAE,IAAI;aACpB,CAAC,CAAA;YACF,+DAA+D;YAC/D,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;QACjE,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,6KAA6K;IAC7K,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;QACtC,EAAE,CAAC,sFAAsF,EAAE,KAAK,IAAI,EAAE;YACpG,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,4EAA4E,EAAE;gBAC7G,UAAU,EAAE,IAAI;gBAChB,aAAa,EAAE,IAAI;aACpB,CAAC,CAAA;YACF,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAA;YACvB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAA;YAC9B,kGAAkG;YAClG,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;;icAEqa,CAAC,CAAA;QAC9b,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
/* eslint-env mocha */
|
|
2
2
|
import { createVerifiedFetch } from '@helia/verified-fetch';
|
|
3
3
|
import { expect } from 'aegir/chai';
|
|
4
|
-
import { createKuboNode } from './fixtures/create-kubo.js';
|
|
5
|
-
import { loadFixtureDataCar } from './fixtures/load-fixture-data.js';
|
|
6
4
|
describe('@helia/verified-fetch - websites', () => {
|
|
7
5
|
describe('helia-identify.on.fleek.co', () => {
|
|
8
|
-
let controller;
|
|
9
6
|
let verifiedFetch;
|
|
10
7
|
before(async () => {
|
|
11
|
-
controller = await createKuboNode();
|
|
12
|
-
await controller.start();
|
|
13
8
|
// 2024-01-22 CID for _dnslink.helia-identify.on.fleek.co
|
|
14
|
-
await loadFixtureDataCar(controller, 'QmbxpRxwKXxnJQjnPqm1kzDJSJ8YgkLxH23mcZURwPHjGv-helia-identify-website.car');
|
|
15
9
|
verifiedFetch = await createVerifiedFetch({
|
|
16
|
-
gateways: [
|
|
17
|
-
routers: [
|
|
10
|
+
gateways: ['http://127.0.0.1:8180'],
|
|
11
|
+
routers: ['http://127.0.0.1:8180'],
|
|
12
|
+
allowInsecure: true,
|
|
13
|
+
allowLocal: true
|
|
18
14
|
});
|
|
19
15
|
});
|
|
20
16
|
after(async () => {
|
|
21
|
-
await controller.stop();
|
|
22
17
|
await verifiedFetch.stop();
|
|
23
18
|
});
|
|
24
19
|
it('loads index.html when passed helia-identify.on.fleek.co root CID', async () => {
|
|
25
|
-
const resp = await verifiedFetch('ipfs://QmbxpRxwKXxnJQjnPqm1kzDJSJ8YgkLxH23mcZURwPHjGv'
|
|
20
|
+
const resp = await verifiedFetch('ipfs://QmbxpRxwKXxnJQjnPqm1kzDJSJ8YgkLxH23mcZURwPHjGv', {
|
|
21
|
+
allowLocal: true,
|
|
22
|
+
allowInsecure: true
|
|
23
|
+
});
|
|
26
24
|
expect(resp).to.be.ok();
|
|
27
25
|
const html = await resp.text();
|
|
28
26
|
expect(html).to.be.ok();
|
|
29
27
|
expect(html).to.include('<title>Run Identify on a remote node with Helia</title>');
|
|
30
28
|
});
|
|
31
29
|
it('loads helia-identify.on.fleek.co index.html directly ', async () => {
|
|
32
|
-
const resp = await verifiedFetch('ipfs://QmbxpRxwKXxnJQjnPqm1kzDJSJ8YgkLxH23mcZURwPHjGv/index.html'
|
|
30
|
+
const resp = await verifiedFetch('ipfs://QmbxpRxwKXxnJQjnPqm1kzDJSJ8YgkLxH23mcZURwPHjGv/index.html', {
|
|
31
|
+
allowLocal: true,
|
|
32
|
+
allowInsecure: true
|
|
33
|
+
});
|
|
33
34
|
expect(resp).to.be.ok();
|
|
34
35
|
const html = await resp.text();
|
|
35
36
|
expect(html).to.be.ok();
|
|
@@ -48,23 +49,23 @@ describe('@helia/verified-fetch - websites', () => {
|
|
|
48
49
|
* ```
|
|
49
50
|
*/
|
|
50
51
|
describe('fake blog.libp2p.io', () => {
|
|
51
|
-
let controller;
|
|
52
52
|
let verifiedFetch;
|
|
53
53
|
before(async () => {
|
|
54
|
-
controller = await createKuboNode();
|
|
55
|
-
await controller.start();
|
|
56
|
-
await loadFixtureDataCar(controller, 'QmeiDMLtPUS3RT2xAcUwsNyZz169wPke2q7im9vZpVLSYw-fake-blog.libp2p.io.car');
|
|
57
54
|
verifiedFetch = await createVerifiedFetch({
|
|
58
|
-
gateways: [
|
|
59
|
-
routers: [
|
|
55
|
+
gateways: ['http://127.0.0.1:8180'],
|
|
56
|
+
routers: ['http://127.0.0.1:8180'],
|
|
57
|
+
allowInsecure: true,
|
|
58
|
+
allowLocal: true
|
|
60
59
|
});
|
|
61
60
|
});
|
|
62
61
|
after(async () => {
|
|
63
|
-
await controller.stop();
|
|
64
62
|
await verifiedFetch.stop();
|
|
65
63
|
});
|
|
66
64
|
it('loads index.html when passed fake-blog.libp2p.io root CID', async () => {
|
|
67
|
-
const resp = await verifiedFetch('ipfs://QmeiDMLtPUS3RT2xAcUwsNyZz169wPke2q7im9vZpVLSYw'
|
|
65
|
+
const resp = await verifiedFetch('ipfs://QmeiDMLtPUS3RT2xAcUwsNyZz169wPke2q7im9vZpVLSYw', {
|
|
66
|
+
allowLocal: true,
|
|
67
|
+
allowInsecure: true
|
|
68
|
+
});
|
|
68
69
|
expect(resp).to.be.ok();
|
|
69
70
|
const html = await resp.text();
|
|
70
71
|
expect(html).to.be.ok();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"websites.spec.js","sourceRoot":"","sources":["../../src/websites.spec.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,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E,CAAC,EAAE,EAAE,CAAA;YACvB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAA;YAC9B,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAA;YACvB,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,+CAA+C,CAAC,CAAA;YACxE,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,kDAAkD,CAAC,CAAA;QAC7E,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@helia/verified-fetch-interop",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.22.0",
|
|
4
4
|
"description": "Interop tests for @helia/verified-fetch",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/ipfs/helia-verified-fetch/tree/main/packages/interop#readme",
|
|
@@ -57,12 +57,13 @@
|
|
|
57
57
|
"test:electron-main": "aegir test -t electron-main"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@helia/verified-fetch": "1.
|
|
60
|
+
"@helia/verified-fetch": "1.4.0",
|
|
61
61
|
"aegir": "^42.2.5",
|
|
62
|
-
"
|
|
63
|
-
"
|
|
62
|
+
"execa": "^8.0.1",
|
|
63
|
+
"fast-glob": "^3.3.2",
|
|
64
|
+
"ipfsd-ctl": "^14.1.0",
|
|
64
65
|
"kubo": "^0.27.0",
|
|
65
|
-
"kubo-rpc-client": "^
|
|
66
|
+
"kubo-rpc-client": "^4.1.1",
|
|
66
67
|
"magic-bytes.js": "^1.10.0",
|
|
67
68
|
"multiformats": "^13.1.0"
|
|
68
69
|
},
|
package/src/bin.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
import { createController, type Controller } from 'ipfsd-ctl'
|
|
1
|
+
import { createNode, type KuboNode } from 'ipfsd-ctl'
|
|
3
2
|
import { path as kuboPath } from 'kubo'
|
|
4
|
-
import
|
|
3
|
+
import { create } from 'kubo-rpc-client'
|
|
5
4
|
|
|
6
|
-
export async function createKuboNode (): Promise<
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
export async function createKuboNode (repoPath = undefined): Promise<KuboNode> {
|
|
6
|
+
return createNode({
|
|
7
|
+
type: 'kubo',
|
|
8
|
+
rpc: create,
|
|
9
|
+
bin: kuboPath(),
|
|
10
10
|
test: true,
|
|
11
|
-
|
|
11
|
+
repo: repoPath,
|
|
12
|
+
init: {
|
|
12
13
|
config: {
|
|
13
14
|
Addresses: {
|
|
14
15
|
Swarm: [
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { $ } from 'execa'
|
|
2
|
+
import fg from 'fast-glob'
|
|
3
|
+
import { path as kuboPath } from 'kubo'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Only callable from node (intended to be consumed by .aegir.js)
|
|
7
|
+
* but the fixtures loaded by this function are also used by browser tests.
|
|
8
|
+
*/
|
|
9
|
+
export async function loadFixtures (IPFS_PATH = undefined): Promise<void> {
|
|
10
|
+
const kuboBinary = process.env.KUBO_BINARY ?? kuboPath()
|
|
11
|
+
|
|
12
|
+
for (const carFile of await fg.glob('**/fixtures/data/*.car')) {
|
|
13
|
+
await $({ env: { IPFS_PATH } })`${kuboBinary} dag import --pin-roots=false --offline ${carFile}`
|
|
14
|
+
}
|
|
15
|
+
}
|
package/src/json.spec.ts
CHANGED
|
@@ -2,36 +2,33 @@
|
|
|
2
2
|
import { createVerifiedFetch } from '@helia/verified-fetch'
|
|
3
3
|
import { expect } from 'aegir/chai'
|
|
4
4
|
import { CID } from 'multiformats/cid'
|
|
5
|
-
import { createKuboNode } from './fixtures/create-kubo.js'
|
|
6
|
-
import { loadFixtureDataCar } from './fixtures/load-fixture-data.js'
|
|
7
|
-
import type { Controller } from 'ipfsd-ctl'
|
|
8
5
|
|
|
9
6
|
describe('@helia/verified-fetch - json', () => {
|
|
10
7
|
describe('unixfs - multiblock', () => {
|
|
11
|
-
let controller: Controller<'go'>
|
|
12
8
|
let verifiedFetch: Awaited<ReturnType<typeof createVerifiedFetch>>
|
|
13
9
|
|
|
14
10
|
before(async () => {
|
|
15
|
-
controller = await createKuboNode()
|
|
16
|
-
await controller.start()
|
|
17
11
|
// As of 2024-01-18, https://cloudflare-ipfs.com/ipns/tokens.uniswap.org resolves to:
|
|
18
12
|
// root: QmQJ8fxavY54CUsxMSx9aE9Rdcmvhx8awJK2jzJp4iAqCr
|
|
19
13
|
// child1: QmNik5N4ryNwzzXYq5hCYKGcRjAf9QtigxtiJh9o8aXXbG // partial JSON
|
|
20
14
|
// child2: QmWNBJX6fZyNTLWNYBHxAHpBctCP43R2zeqV2G8uavqFZn // partial JSON
|
|
21
|
-
await loadFixtureDataCar(controller, 'QmQJ8fxavY54CUsxMSx9aE9Rdcmvhx8awJK2jzJp4iAqCr-tokens.uniswap.org-2024-01-18.car')
|
|
22
15
|
verifiedFetch = await createVerifiedFetch({
|
|
23
|
-
gateways: [
|
|
24
|
-
routers: [
|
|
16
|
+
gateways: ['http://127.0.0.1:8180'],
|
|
17
|
+
routers: ['http://127.0.0.1:8180'],
|
|
18
|
+
allowInsecure: true,
|
|
19
|
+
allowLocal: true
|
|
25
20
|
})
|
|
26
21
|
})
|
|
27
22
|
|
|
28
23
|
after(async () => {
|
|
29
|
-
await controller.stop()
|
|
30
24
|
await verifiedFetch.stop()
|
|
31
25
|
})
|
|
32
26
|
|
|
33
27
|
it('handles UnixFS-chunked JSON file', async () => {
|
|
34
|
-
const resp = await verifiedFetch(CID.parse('QmQJ8fxavY54CUsxMSx9aE9Rdcmvhx8awJK2jzJp4iAqCr')
|
|
28
|
+
const resp = await verifiedFetch(CID.parse('QmQJ8fxavY54CUsxMSx9aE9Rdcmvhx8awJK2jzJp4iAqCr'), {
|
|
29
|
+
allowLocal: true,
|
|
30
|
+
allowInsecure: true
|
|
31
|
+
})
|
|
35
32
|
expect(resp).to.be.ok()
|
|
36
33
|
const jsonObj = await resp.json()
|
|
37
34
|
expect(jsonObj).to.be.ok()
|
package/src/unixfs-dir.spec.ts
CHANGED
|
@@ -2,42 +2,36 @@
|
|
|
2
2
|
import { createVerifiedFetch } from '@helia/verified-fetch'
|
|
3
3
|
import { expect } from 'aegir/chai'
|
|
4
4
|
import { filetypemime } from 'magic-bytes.js'
|
|
5
|
-
import { createKuboNode } from './fixtures/create-kubo.js'
|
|
6
|
-
import { loadFixtureDataCar } from './fixtures/load-fixture-data.js'
|
|
7
5
|
import type { VerifiedFetch } from '@helia/verified-fetch'
|
|
8
|
-
import type { Controller } from 'ipfsd-ctl'
|
|
9
6
|
|
|
10
7
|
describe('@helia/verified-fetch - unixfs directory', () => {
|
|
11
|
-
let controller: Controller
|
|
12
8
|
let verifiedFetch: VerifiedFetch
|
|
13
9
|
|
|
14
10
|
before(async () => {
|
|
15
|
-
controller = await createKuboNode()
|
|
16
|
-
await controller.start()
|
|
17
|
-
|
|
18
11
|
verifiedFetch = await createVerifiedFetch({
|
|
19
|
-
gateways: [
|
|
20
|
-
routers: [
|
|
12
|
+
gateways: ['http://127.0.0.1:8180'],
|
|
13
|
+
routers: [],
|
|
14
|
+
allowInsecure: true,
|
|
15
|
+
allowLocal: true
|
|
21
16
|
})
|
|
22
17
|
})
|
|
23
18
|
|
|
24
19
|
after(async () => {
|
|
25
|
-
await controller.stop()
|
|
26
20
|
await verifiedFetch.stop()
|
|
27
21
|
})
|
|
28
22
|
|
|
29
23
|
describe('unixfs-dir-redirect', () => {
|
|
30
|
-
before(async () => {
|
|
31
|
-
await loadFixtureDataCar(controller, 'gateway-conformance-fixtures.car')
|
|
32
|
-
});
|
|
33
|
-
|
|
34
24
|
[
|
|
35
25
|
'https://example.com/ipfs/bafybeifq2rzpqnqrsdupncmkmhs3ckxxjhuvdcbvydkgvch3ms24k5lo7q',
|
|
36
26
|
'ipfs://bafybeifq2rzpqnqrsdupncmkmhs3ckxxjhuvdcbvydkgvch3ms24k5lo7q',
|
|
37
27
|
'http://example.com/ipfs/bafybeifq2rzpqnqrsdupncmkmhs3ckxxjhuvdcbvydkgvch3ms24k5lo7q'
|
|
38
28
|
].forEach((url: string) => {
|
|
39
29
|
it(`request to unixfs directory with ${url} should return a 301 with a trailing slash`, async () => {
|
|
40
|
-
const response = await verifiedFetch(url, {
|
|
30
|
+
const response = await verifiedFetch(url, {
|
|
31
|
+
redirect: 'manual',
|
|
32
|
+
allowLocal: true,
|
|
33
|
+
allowInsecure: true
|
|
34
|
+
})
|
|
41
35
|
expect(response).to.be.ok()
|
|
42
36
|
expect(response.status).to.equal(301)
|
|
43
37
|
expect(response.headers.get('location')).to.equal(`${url}/`)
|
|
@@ -45,28 +39,33 @@ describe('@helia/verified-fetch - unixfs directory', () => {
|
|
|
45
39
|
})
|
|
46
40
|
})
|
|
47
41
|
|
|
42
|
+
// This tests the content of https://explore.ipld.io/#/explore/QmdmQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7RgQm/1%20-%20Barrel%20-%20Part%201
|
|
48
43
|
describe('XKCD Barrel Part 1', () => {
|
|
49
|
-
before(async () => {
|
|
50
|
-
// This is the content of https://explore.ipld.io/#/explore/QmdmQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7RgQm/1%20-%20Barrel%20-%20Part%201
|
|
51
|
-
await loadFixtureDataCar(controller, 'QmbQDovX7wRe9ek7u6QXe9zgCXkTzoUSsTFJEkrYV1HrVR-xkcd-Barrel-part-1.car')
|
|
52
|
-
})
|
|
53
|
-
|
|
54
44
|
it('fails to load when passed the root', async () => {
|
|
55
45
|
// The spec says we should generate HTML with directory listings, but we don't do that yet, so expect a failure
|
|
56
|
-
const resp = await verifiedFetch('ipfs://QmbQDovX7wRe9ek7u6QXe9zgCXkTzoUSsTFJEkrYV1HrVR'
|
|
46
|
+
const resp = await verifiedFetch('ipfs://QmbQDovX7wRe9ek7u6QXe9zgCXkTzoUSsTFJEkrYV1HrVR', {
|
|
47
|
+
allowLocal: true,
|
|
48
|
+
allowInsecure: true
|
|
49
|
+
})
|
|
57
50
|
expect(resp).to.be.ok()
|
|
58
51
|
expect(resp.status).to.equal(501) // TODO: we should do a directory listing instead
|
|
59
52
|
})
|
|
60
53
|
|
|
61
54
|
it('can return a string for unixfs pathed data', async () => {
|
|
62
|
-
const resp = await verifiedFetch('ipfs://QmbQDovX7wRe9ek7u6QXe9zgCXkTzoUSsTFJEkrYV1HrVR/1 - Barrel - Part 1 - alt.txt'
|
|
55
|
+
const resp = await verifiedFetch('ipfs://QmbQDovX7wRe9ek7u6QXe9zgCXkTzoUSsTFJEkrYV1HrVR/1 - Barrel - Part 1 - alt.txt', {
|
|
56
|
+
allowLocal: true,
|
|
57
|
+
allowInsecure: true
|
|
58
|
+
})
|
|
63
59
|
expect(resp).to.be.ok()
|
|
64
60
|
const text = await resp.text()
|
|
65
61
|
expect(text).to.equal('Don\'t we all.')
|
|
66
62
|
})
|
|
67
63
|
|
|
68
64
|
it('can return an image for unixfs pathed data', async () => {
|
|
69
|
-
const resp = await verifiedFetch('ipfs://QmbQDovX7wRe9ek7u6QXe9zgCXkTzoUSsTFJEkrYV1HrVR/1 - Barrel - Part 1.png'
|
|
65
|
+
const resp = await verifiedFetch('ipfs://QmbQDovX7wRe9ek7u6QXe9zgCXkTzoUSsTFJEkrYV1HrVR/1 - Barrel - Part 1.png', {
|
|
66
|
+
allowLocal: true,
|
|
67
|
+
allowInsecure: true
|
|
68
|
+
})
|
|
70
69
|
expect(resp).to.be.ok()
|
|
71
70
|
const imgData = await resp.blob()
|
|
72
71
|
expect(imgData).to.be.ok()
|
|
@@ -78,8 +77,10 @@ describe('@helia/verified-fetch - unixfs directory', () => {
|
|
|
78
77
|
before(async () => {
|
|
79
78
|
await verifiedFetch.stop()
|
|
80
79
|
verifiedFetch = await createVerifiedFetch({
|
|
81
|
-
gateways: [
|
|
82
|
-
routers: [
|
|
80
|
+
gateways: ['http://127.0.0.1:8180'],
|
|
81
|
+
routers: ['http://127.0.0.1:8180'],
|
|
82
|
+
allowInsecure: true,
|
|
83
|
+
allowLocal: true
|
|
83
84
|
}, {
|
|
84
85
|
contentTypeParser: (bytes) => {
|
|
85
86
|
return filetypemime(bytes)?.[0]
|
|
@@ -88,20 +89,22 @@ describe('@helia/verified-fetch - unixfs directory', () => {
|
|
|
88
89
|
})
|
|
89
90
|
|
|
90
91
|
it('can return an image content-type for unixfs pathed data', async () => {
|
|
91
|
-
const resp = await verifiedFetch('ipfs://QmbQDovX7wRe9ek7u6QXe9zgCXkTzoUSsTFJEkrYV1HrVR/1 - Barrel - Part 1.png'
|
|
92
|
+
const resp = await verifiedFetch('ipfs://QmbQDovX7wRe9ek7u6QXe9zgCXkTzoUSsTFJEkrYV1HrVR/1 - Barrel - Part 1.png', {
|
|
93
|
+
allowLocal: true,
|
|
94
|
+
allowInsecure: true
|
|
95
|
+
})
|
|
92
96
|
// tediously this is actually a jpeg file with a .png extension
|
|
93
97
|
expect(resp.headers.get('content-type')).to.equal('image/jpeg')
|
|
94
98
|
})
|
|
95
99
|
})
|
|
96
100
|
|
|
101
|
+
// from https://github.com/ipfs/gateway-conformance/blob/193833b91f2e9b17daf45c84afaeeae61d9d7c7e/fixtures/trustless_gateway_car/single-layer-hamt-with-multi-block-files.car
|
|
97
102
|
describe('HAMT-sharded directory', () => {
|
|
98
|
-
before(async () => {
|
|
99
|
-
// from https://github.com/ipfs/gateway-conformance/blob/193833b91f2e9b17daf45c84afaeeae61d9d7c7e/fixtures/trustless_gateway_car/single-layer-hamt-with-multi-block-files.car
|
|
100
|
-
await loadFixtureDataCar(controller, 'bafybeidbclfqleg2uojchspzd4bob56dqetqjsj27gy2cq3klkkgxtpn4i-single-layer-hamt-with-multi-block-files.car')
|
|
101
|
-
})
|
|
102
|
-
|
|
103
103
|
it('loads path /ipfs/bafybeidbclfqleg2uojchspzd4bob56dqetqjsj27gy2cq3klkkgxtpn4i/685.txt', async () => {
|
|
104
|
-
const resp = await verifiedFetch('ipfs://bafybeidbclfqleg2uojchspzd4bob56dqetqjsj27gy2cq3klkkgxtpn4i/685.txt'
|
|
104
|
+
const resp = await verifiedFetch('ipfs://bafybeidbclfqleg2uojchspzd4bob56dqetqjsj27gy2cq3klkkgxtpn4i/685.txt', {
|
|
105
|
+
allowLocal: true,
|
|
106
|
+
allowInsecure: true
|
|
107
|
+
})
|
|
105
108
|
expect(resp).to.be.ok()
|
|
106
109
|
const text = await resp.text()
|
|
107
110
|
// npx kubo@0.25.0 cat '/ipfs/bafybeidbclfqleg2uojchspzd4bob56dqetqjsj27gy2cq3klkkgxtpn4i/685.txt'
|
package/src/websites.spec.ts
CHANGED
|
@@ -1,33 +1,30 @@
|
|
|
1
1
|
/* eslint-env mocha */
|
|
2
2
|
import { createVerifiedFetch } from '@helia/verified-fetch'
|
|
3
3
|
import { expect } from 'aegir/chai'
|
|
4
|
-
import { createKuboNode } from './fixtures/create-kubo.js'
|
|
5
|
-
import { loadFixtureDataCar } from './fixtures/load-fixture-data.js'
|
|
6
|
-
import type { Controller } from 'ipfsd-ctl'
|
|
7
4
|
|
|
8
5
|
describe('@helia/verified-fetch - websites', () => {
|
|
9
6
|
describe('helia-identify.on.fleek.co', () => {
|
|
10
|
-
let controller: Controller<'go'>
|
|
11
7
|
let verifiedFetch: Awaited<ReturnType<typeof createVerifiedFetch>>
|
|
12
8
|
|
|
13
9
|
before(async () => {
|
|
14
|
-
controller = await createKuboNode()
|
|
15
|
-
await controller.start()
|
|
16
10
|
// 2024-01-22 CID for _dnslink.helia-identify.on.fleek.co
|
|
17
|
-
await loadFixtureDataCar(controller, 'QmbxpRxwKXxnJQjnPqm1kzDJSJ8YgkLxH23mcZURwPHjGv-helia-identify-website.car')
|
|
18
11
|
verifiedFetch = await createVerifiedFetch({
|
|
19
|
-
gateways: [
|
|
20
|
-
routers: [
|
|
12
|
+
gateways: ['http://127.0.0.1:8180'],
|
|
13
|
+
routers: ['http://127.0.0.1:8180'],
|
|
14
|
+
allowInsecure: true,
|
|
15
|
+
allowLocal: true
|
|
21
16
|
})
|
|
22
17
|
})
|
|
23
18
|
|
|
24
19
|
after(async () => {
|
|
25
|
-
await controller.stop()
|
|
26
20
|
await verifiedFetch.stop()
|
|
27
21
|
})
|
|
28
22
|
|
|
29
23
|
it('loads index.html when passed helia-identify.on.fleek.co root CID', async () => {
|
|
30
|
-
const resp = await verifiedFetch('ipfs://QmbxpRxwKXxnJQjnPqm1kzDJSJ8YgkLxH23mcZURwPHjGv'
|
|
24
|
+
const resp = await verifiedFetch('ipfs://QmbxpRxwKXxnJQjnPqm1kzDJSJ8YgkLxH23mcZURwPHjGv', {
|
|
25
|
+
allowLocal: true,
|
|
26
|
+
allowInsecure: true
|
|
27
|
+
})
|
|
31
28
|
expect(resp).to.be.ok()
|
|
32
29
|
const html = await resp.text()
|
|
33
30
|
expect(html).to.be.ok()
|
|
@@ -35,7 +32,10 @@ describe('@helia/verified-fetch - websites', () => {
|
|
|
35
32
|
})
|
|
36
33
|
|
|
37
34
|
it('loads helia-identify.on.fleek.co index.html directly ', async () => {
|
|
38
|
-
const resp = await verifiedFetch('ipfs://QmbxpRxwKXxnJQjnPqm1kzDJSJ8YgkLxH23mcZURwPHjGv/index.html'
|
|
35
|
+
const resp = await verifiedFetch('ipfs://QmbxpRxwKXxnJQjnPqm1kzDJSJ8YgkLxH23mcZURwPHjGv/index.html', {
|
|
36
|
+
allowLocal: true,
|
|
37
|
+
allowInsecure: true
|
|
38
|
+
})
|
|
39
39
|
expect(resp).to.be.ok()
|
|
40
40
|
const html = await resp.text()
|
|
41
41
|
expect(html).to.be.ok()
|
|
@@ -55,26 +55,26 @@ describe('@helia/verified-fetch - websites', () => {
|
|
|
55
55
|
* ```
|
|
56
56
|
*/
|
|
57
57
|
describe('fake blog.libp2p.io', () => {
|
|
58
|
-
let controller: Controller<'go'>
|
|
59
58
|
let verifiedFetch: Awaited<ReturnType<typeof createVerifiedFetch>>
|
|
60
59
|
|
|
61
60
|
before(async () => {
|
|
62
|
-
controller = await createKuboNode()
|
|
63
|
-
await controller.start()
|
|
64
|
-
await loadFixtureDataCar(controller, 'QmeiDMLtPUS3RT2xAcUwsNyZz169wPke2q7im9vZpVLSYw-fake-blog.libp2p.io.car')
|
|
65
61
|
verifiedFetch = await createVerifiedFetch({
|
|
66
|
-
gateways: [
|
|
67
|
-
routers: [
|
|
62
|
+
gateways: ['http://127.0.0.1:8180'],
|
|
63
|
+
routers: ['http://127.0.0.1:8180'],
|
|
64
|
+
allowInsecure: true,
|
|
65
|
+
allowLocal: true
|
|
68
66
|
})
|
|
69
67
|
})
|
|
70
68
|
|
|
71
69
|
after(async () => {
|
|
72
|
-
await controller.stop()
|
|
73
70
|
await verifiedFetch.stop()
|
|
74
71
|
})
|
|
75
72
|
|
|
76
73
|
it('loads index.html when passed fake-blog.libp2p.io root CID', async () => {
|
|
77
|
-
const resp = await verifiedFetch('ipfs://QmeiDMLtPUS3RT2xAcUwsNyZz169wPke2q7im9vZpVLSYw'
|
|
74
|
+
const resp = await verifiedFetch('ipfs://QmeiDMLtPUS3RT2xAcUwsNyZz169wPke2q7im9vZpVLSYw', {
|
|
75
|
+
allowLocal: true,
|
|
76
|
+
allowInsecure: true
|
|
77
|
+
})
|
|
78
78
|
expect(resp).to.be.ok()
|
|
79
79
|
const html = await resp.text()
|
|
80
80
|
expect(html).to.be.ok()
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-kubo.browser.d.ts","sourceRoot":"","sources":["../../../src/fixtures/create-kubo.browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,WAAW,CAAA;AAG7D,wBAAsB,cAAc,IAAK,OAAO,CAAC,UAAU,CAAC,CA0B3D"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { createController } from 'ipfsd-ctl';
|
|
2
|
-
import * as kuboRpcClient from 'kubo-rpc-client';
|
|
3
|
-
export async function createKuboNode() {
|
|
4
|
-
return createController({
|
|
5
|
-
kuboRpcModule: kuboRpcClient,
|
|
6
|
-
test: true,
|
|
7
|
-
endpoint: process.env.IPFSD_SERVER,
|
|
8
|
-
ipfsOptions: {
|
|
9
|
-
config: {
|
|
10
|
-
Addresses: {
|
|
11
|
-
Swarm: [
|
|
12
|
-
'/ip4/0.0.0.0/tcp/0',
|
|
13
|
-
'/ip4/0.0.0.0/tcp/0/ws'
|
|
14
|
-
],
|
|
15
|
-
Gateway: '/ip4/127.0.0.1/tcp/8180'
|
|
16
|
-
},
|
|
17
|
-
Gateway: {
|
|
18
|
-
NoFetch: true,
|
|
19
|
-
ExposeRoutingAPI: true,
|
|
20
|
-
HTTPHeaders: {
|
|
21
|
-
'Access-Control-Allow-Origin': ['*'],
|
|
22
|
-
'Access-Control-Allow-Methods': ['GET', 'POST', 'PUT', 'OPTIONS']
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
args: ['--enable-pubsub-experiment', '--enable-namesys-pubsub']
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=create-kubo.browser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-kubo.browser.js","sourceRoot":"","sources":["../../../src/fixtures/create-kubo.browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAC7D,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAA;AAEhD,MAAM,CAAC,KAAK,UAAU,cAAc;IAClC,OAAO,gBAAgB,CAAC;QACtB,aAAa,EAAE,aAAa;QAC5B,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY;QAClC,WAAW,EAAE;YACX,MAAM,EAAE;gBACN,SAAS,EAAE;oBACT,KAAK,EAAE;wBACL,oBAAoB;wBACpB,uBAAuB;qBACxB;oBACD,OAAO,EAAE,yBAAyB;iBACnC;gBACD,OAAO,EAAE;oBACP,OAAO,EAAE,IAAI;oBACb,gBAAgB,EAAE,IAAI;oBACtB,WAAW,EAAE;wBACX,6BAA6B,EAAE,CAAC,GAAG,CAAC;wBACpC,8BAA8B,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC;qBAClE;iBACF;aACF;SACF;QACD,IAAI,EAAE,CAAC,4BAA4B,EAAE,yBAAyB,CAAC;KAChE,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"load-fixture-data.d.ts","sourceRoot":"","sources":["../../../src/fixtures/load-fixture-data.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAE3C,wBAAsB,kBAAkB,CAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI7F"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import loadFixture from 'aegir/fixtures';
|
|
2
|
-
import drain from 'it-drain';
|
|
3
|
-
export async function loadFixtureDataCar(controller, path) {
|
|
4
|
-
const fixtureData = `src/fixtures/data/${path}`;
|
|
5
|
-
const buf = loadFixture(fixtureData);
|
|
6
|
-
await drain(controller.api.dag.import([buf]));
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=load-fixture-data.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"load-fixture-data.js","sourceRoot":"","sources":["../../../src/fixtures/load-fixture-data.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,gBAAgB,CAAA;AACxC,OAAO,KAAK,MAAM,UAAU,CAAA;AAG5B,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAE,UAAsB,EAAE,IAAY;IAC5E,MAAM,WAAW,GAAG,qBAAqB,IAAI,EAAE,CAAA;IAC/C,MAAM,GAAG,GAAG,WAAW,CAAC,WAAW,CAAC,CAAA;IACpC,MAAM,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AAC/C,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { type Controller, createController } from 'ipfsd-ctl'
|
|
2
|
-
import * as kuboRpcClient from 'kubo-rpc-client'
|
|
3
|
-
|
|
4
|
-
export async function createKuboNode (): Promise<Controller> {
|
|
5
|
-
return createController({
|
|
6
|
-
kuboRpcModule: kuboRpcClient,
|
|
7
|
-
test: true,
|
|
8
|
-
endpoint: process.env.IPFSD_SERVER,
|
|
9
|
-
ipfsOptions: {
|
|
10
|
-
config: {
|
|
11
|
-
Addresses: {
|
|
12
|
-
Swarm: [
|
|
13
|
-
'/ip4/0.0.0.0/tcp/0',
|
|
14
|
-
'/ip4/0.0.0.0/tcp/0/ws'
|
|
15
|
-
],
|
|
16
|
-
Gateway: '/ip4/127.0.0.1/tcp/8180'
|
|
17
|
-
},
|
|
18
|
-
Gateway: {
|
|
19
|
-
NoFetch: true,
|
|
20
|
-
ExposeRoutingAPI: true,
|
|
21
|
-
HTTPHeaders: {
|
|
22
|
-
'Access-Control-Allow-Origin': ['*'],
|
|
23
|
-
'Access-Control-Allow-Methods': ['GET', 'POST', 'PUT', 'OPTIONS']
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
args: ['--enable-pubsub-experiment', '--enable-namesys-pubsub']
|
|
29
|
-
})
|
|
30
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import loadFixture from 'aegir/fixtures'
|
|
2
|
-
import drain from 'it-drain'
|
|
3
|
-
import type { Controller } from 'ipfsd-ctl'
|
|
4
|
-
|
|
5
|
-
export async function loadFixtureDataCar (controller: Controller, path: string): Promise<void> {
|
|
6
|
-
const fixtureData = `src/fixtures/data/${path}`
|
|
7
|
-
const buf = loadFixture(fixtureData)
|
|
8
|
-
await drain(controller.api.dag.import([buf]))
|
|
9
|
-
}
|