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.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow /ipns/webui.ipfs.io on api port
We want to allow user to try out the latest versions of the webui before they are officially released with js-ipfs. Context: ipfs/ipfs-companion#736 go-ipfs counterpart: ipfs/kubo#6530 License: MIT Signed-off-by: Marcin Rataj <lidel@lidel.org>
- Loading branch information
Showing
2 changed files
with
104 additions
and
5 deletions.
There are no files selected for viewing
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,66 @@ | ||
/* eslint-env mocha */ | ||
'use strict' | ||
|
||
const expect = require('chai').expect | ||
|
||
module.exports = (http) => { | ||
describe('Web UI', function () { | ||
let api | ||
|
||
before(() => { | ||
api = http.api._httpApi._apiServers[0] | ||
}) | ||
|
||
it('allow /webui', async () => { | ||
const res = await api.inject({ | ||
method: 'GET', | ||
url: '/webui' | ||
}) | ||
// it should return a redirect | ||
expect(res.statusCode).to.equal(302) | ||
expect(res.headers.location).to.exist() | ||
}) | ||
|
||
it('disallow /ipfs/ paths that are not webui', async () => { | ||
const res = await api.inject({ | ||
method: 'GET', | ||
url: '/ipfs/QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn' // empty dir | ||
}) | ||
expect(res.statusCode).to.equal(404) | ||
}) | ||
|
||
it('disallow /ipns/ paths that are not webui', async () => { | ||
const res = await api.inject({ | ||
method: 'GET', | ||
url: '/ipns/ipfs.io' // empty dir | ||
}) | ||
expect(res.statusCode).to.equal(404) | ||
}) | ||
|
||
/* DNSLink + fetching actual webui is too slow to include in the test :'-( | ||
it('/ipns/webui.ipfs.io', async () => { | ||
const res = await api.inject({ | ||
method: 'GET', | ||
url: '/ipns/webui.ipfs.io' | ||
}) | ||
expect(res.statusCode).to.equal(302) | ||
expect(res.headers.location).to.exist() | ||
}) | ||
it('/ipns/webui.ipfs.io/', async () => { | ||
const res = await api.inject({ | ||
method: 'GET', | ||
url: '/ipns/webui.ipfs.io/' | ||
}) | ||
expect(res.statusCode).to.equal(200) | ||
}) | ||
it('/ipns/ipfs.io/', async () => { | ||
const res = await api.inject({ | ||
method: 'GET', | ||
url: '/ipns/ipfs.io/' | ||
}) | ||
expect(res.statusCode).to.equal(404) | ||
}) | ||
*/ | ||
}) | ||
} |