This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
171 additions
and
24 deletions.
There are no files selected for viewing
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const ipfs = require('./../index.js').ipfs | ||
const boom = require('boom') | ||
|
||
exports = module.exports | ||
|
||
exports.list = (request, reply) => { | ||
ipfs.bootstrap.list((err, list) => { | ||
if (err) { | ||
return reply(boom.badRequest(err)) | ||
} | ||
return reply(list) | ||
}) | ||
} | ||
|
||
exports.add = (request, reply) => { | ||
// ipfs.id((err, id) => { | ||
// if (err) { return reply(boom.badRequest(err)) } | ||
// return reply(id) | ||
// }) | ||
} | ||
|
||
exports.rm = (request, reply) => { | ||
// ipfs.id((err, id) => { | ||
// if (err) { return reply(boom.badRequest(err)) } | ||
// return reply(id) | ||
// }) | ||
} |
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
'use strict' | ||
|
||
const ipfs = require('./../index.js').ipfs | ||
const boom = require('boom') | ||
|
||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
exports.version = require('./version') | ||
exports.id = require('./id') | ||
exports.bootstrap = require('./bootstrap') | ||
exports.repo = require('./repo') | ||
exports.object = require('./object') | ||
exports.config = require('./config') | ||
exports.block = require('./block') |
Empty file.
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
'use strict' | ||
|
||
const ipfs = require('./../index.js').ipfs | ||
const boom = require('boom') | ||
|
||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const api = require('./../index.js').server.select('API') | ||
const resources = require('./../resources') | ||
|
||
// TODO | ||
|
||
api.route({ | ||
method: 'GET', | ||
path: '/api/v0/block', | ||
handler: resources.block | ||
}) |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const api = require('./../index.js').server.select('API') | ||
const resources = require('./../resources') | ||
|
||
// TODO | ||
|
||
api.route({ | ||
method: 'GET', | ||
path: '/api/v0/config', | ||
handler: resources.config | ||
}) |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
require('./version') | ||
require('./id') | ||
require('./bootstrap') | ||
// require('./block') | ||
// require('./object') | ||
// require('./repo') | ||
// require('./config') |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const api = require('./../index.js').server.select('API') | ||
const resources = require('./../resources') | ||
|
||
// TODO | ||
|
||
api.route({ | ||
method: 'GET', | ||
path: '/api/v0/object', | ||
handler: resources.object | ||
}) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const api = require('./../index.js').server.select('API') | ||
const resources = require('./../resources') | ||
|
||
// TODO | ||
|
||
api.route({ | ||
method: 'GET', | ||
path: '/api/v0/repo', | ||
handler: resources.repo | ||
}) |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,104 @@ | ||
/* eslint-env mocha */ | ||
|
||
// const expect = require('chai').expect | ||
const expect = require('chai').expect | ||
const APIctl = require('ipfs-api') | ||
|
||
describe('bootstrap', () => { | ||
describe('api', () => { | ||
// var api | ||
var api | ||
|
||
it.skip('api', (done) => { | ||
// api = require('../../src/http-api').server.select('API') | ||
it('api', (done) => { | ||
api = require('../../src/http-api').server.select('API') | ||
done() | ||
}) | ||
|
||
// TODO | ||
it('list', (done) => { | ||
api.inject({ | ||
method: 'GET', | ||
url: '/api/v0/bootstrap' | ||
}, (res) => { | ||
expect(res.result).to.deep.equal(defaultList) | ||
done() | ||
}) | ||
}) | ||
|
||
it('list 2', (done) => { | ||
api.inject({ | ||
method: 'GET', | ||
url: '/api/v0/bootstrap/list' | ||
}, (res) => { | ||
expect(res.result).to.deep.equal(defaultList) | ||
done() | ||
}) | ||
}) | ||
|
||
it('add', (done) => { | ||
api.inject({ | ||
method: 'GET', | ||
url: '/api/v0/bootstrap/add', | ||
payload: { | ||
arg: '/ip4/111.111.111.111/tcp/1001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLUVIT' | ||
} | ||
}, (res) => { | ||
done() | ||
}) | ||
}) | ||
|
||
it('rm', (done) => { | ||
api.inject({ | ||
method: 'GET', | ||
url: '/api/v0/bootstrap/rm', | ||
payload: { | ||
arg: '/ip4/111.111.111.111/tcp/1001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLUVIT' | ||
} | ||
}, (res) => { | ||
done() | ||
}) | ||
}) | ||
|
||
it('confirm list is as expected', (done) => { | ||
api.inject({ | ||
method: 'GET', | ||
url: '/api/v0/bootstrap/list' | ||
}, (res) => { | ||
expect(res.result).to.deep.equal(defaultList) | ||
done() | ||
}) | ||
}) | ||
}) | ||
|
||
describe('gateway', () => {}) | ||
|
||
describe('using js-ipfs-api', () => { | ||
// TODO | ||
var ctl | ||
|
||
it('start IPFS API ctl', (done) => { | ||
ctl = APIctl('/ip4/127.0.0.1/tcp/6001') | ||
done() | ||
}) | ||
|
||
// TODO: needs https://github.com/ipfs/js-ipfs-api/issues/217 | ||
it.skip('list', (done) => { | ||
ctl.boostrap.list((err, result) => { | ||
expect(err).to.not.exist | ||
expect(result).to.deep.equal(defaultList) | ||
done() | ||
}) | ||
}) | ||
|
||
it.skip('add', (done) => {}) | ||
it.skip('rm', (done) => {}) | ||
}) | ||
}) | ||
|
||
const defaultList = [ | ||
'/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ', | ||
'/ip4/104.236.176.52/tcp/4001/ipfs/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z', | ||
'/ip4/104.236.179.241/tcp/4001/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM', | ||
'/ip4/162.243.248.213/tcp/4001/ipfs/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm', | ||
'/ip4/128.199.219.111/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu', | ||
'/ip4/104.236.76.40/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64', | ||
'/ip4/178.62.158.247/tcp/4001/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd', | ||
'/ip4/178.62.61.185/tcp/4001/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3', | ||
'/ip4/104.236.151.122/tcp/4001/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx' | ||
] |