This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree 3 files changed +13
-25
lines changed
3 files changed +13
-25
lines changed Original file line number Diff line number Diff line change @@ -79,10 +79,10 @@ module.exports = {
79
79
try {
80
80
await daemon . start ( )
81
81
daemon . _httpApi . _apiServers . forEach ( apiServer => {
82
- print ( `API listening on ${ apiServer . info . ma . toString ( ) } ` )
82
+ print ( `API listening on ${ apiServer . info . ma } ` )
83
83
} )
84
84
daemon . _httpApi . _gatewayServers . forEach ( gatewayServer => {
85
- print ( `Gateway (read only) listening on ${ gatewayServer . info . ma . toString ( ) } ` )
85
+ print ( `Gateway (read only) listening on ${ gatewayServer . info . ma } ` )
86
86
} )
87
87
daemon . _httpApi . _apiServers . forEach ( apiServer => {
88
88
print ( `Web UI available at ${ toUri ( apiServer . info . ma ) } /webui` )
Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
3
- const Joi = require ( '@hapi/joi' )
4
- const resources = require ( '../../gateway/resources' )
3
+ const multiaddr = require ( 'multiaddr' )
5
4
6
5
module . exports = [
7
- {
8
- method : '*' ,
9
- path : '/ipfs/{path*}' ,
10
- options : {
11
- handler : resources . gateway . handler ,
12
- validate : {
13
- params : {
14
- path : Joi . string ( ) . required ( )
15
- }
16
- } ,
17
- response : {
18
- ranges : false // disable built-in support, handler does it manually
19
- } ,
20
- ext : {
21
- onPostHandler : { method : resources . gateway . afterHandler }
22
- }
23
- }
24
- } ,
25
6
{
26
7
method : '*' ,
27
8
path : '/webui' ,
28
- handler ( request , h ) {
29
- return h . redirect ( '/ipns/webui.ipfs.io' )
9
+ async handler ( request , h ) {
10
+ const { ipfs } = request . server . app
11
+ const gateway = await ipfs . config . get ( 'Addresses.Gateway' )
12
+ const addr = multiaddr ( gateway )
13
+ const {
14
+ port,
15
+ address
16
+ } = addr . nodeAddress ( )
17
+
18
+ return h . redirect ( `http://${ address } :${ port } /ipns/webui.ipfs.io` )
30
19
}
31
20
}
32
21
]
Original file line number Diff line number Diff line change @@ -44,7 +44,6 @@ module.exports = {
44
44
let ipfsPath = decodeURI ( path . startsWith ( '/ipns/' )
45
45
? await ipfs . name . resolve ( path , { recursive : true } )
46
46
: path )
47
-
48
47
let directory = false
49
48
let data
50
49
try {
You can’t perform that action at this time.
0 commit comments