mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-27 22:22:47 +08:00
http/index: fix indention and remove unused field
License: MIT Signed-off-by: Henry <cryptix@riseup.net>
This commit is contained in:
core/corehttp
@ -3,7 +3,6 @@ package corehttp
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"io"
|
||||
"net/http"
|
||||
gopath "path"
|
||||
@ -30,9 +29,8 @@ const (
|
||||
// gatewayHandler is a HTTP handler that serves IPFS objects (accessible by default at /ipfs/<path>)
|
||||
// (it serves requests like GET /ipfs/QmVRzPKPzNtSrEzBFm2UZfxmPAgnaLke4DMcerbsGGSaFe/link)
|
||||
type gatewayHandler struct {
|
||||
node *core.IpfsNode
|
||||
dirList *template.Template
|
||||
config GatewayConfig
|
||||
node *core.IpfsNode
|
||||
config GatewayConfig
|
||||
}
|
||||
|
||||
func newGatewayHandler(node *core.IpfsNode, conf GatewayConfig) (*gatewayHandler, error) {
|
||||
|
@ -22,65 +22,65 @@ type directoryItem struct {
|
||||
var listingTemplate = template.Must(template.New("dir").Funcs(template.FuncMap{"iconFromExt": iconFromExt}).Parse(`
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<!-- TODO: seed these - maybe like the starter ex or the webui? -->
|
||||
<link rel="stylesheet" href="/ipfs/QmXB7PLRWH6bCiwrGh2MrBBjNkLv3mY3JdYXCikYZSwLED/bootstrap.min.css"/>
|
||||
<!-- helper to construct this is here: https://github.com/cryptix/exp/blob/master/imgesToCSSData/convert.go -->
|
||||
<link rel="stylesheet" href="/ipfs/QmXB7PLRWH6bCiwrGh2MrBBjNkLv3mY3JdYXCikYZSwLED/icons.css">
|
||||
<style>
|
||||
.narrow {width: 0px;}
|
||||
.padding { margin: 100px;}
|
||||
#header {
|
||||
background: #000;
|
||||
}
|
||||
#logo {
|
||||
height: 25px;
|
||||
margin: 10px;
|
||||
}
|
||||
.ipfs-icon {
|
||||
width:16px;
|
||||
}
|
||||
</style>
|
||||
<title>{{ .Path }}</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="header" class="row">
|
||||
<div class="col-xs-2">
|
||||
<div id="logo" class="ipfs-logo"> </div>
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="col-xs-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<strong>Index of {{ .Path }}</strong>
|
||||
</div>
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
<td class="narrow">
|
||||
<div class="ipfs-icon ipfs-_blank"> </div>
|
||||
</td>
|
||||
<td class="padding">
|
||||
<a href="{{.BackLink}}">..</a>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
{{ range .Listing }}
|
||||
<tr>
|
||||
<td>
|
||||
<div class="ipfs-icon {{iconFromExt .Name}}"> </div>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ .Path }}">{{ .Name }}</a>
|
||||
</td>
|
||||
<td>{{ .Size }} bytes</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<!-- TODO: seed these - maybe like the starter ex or the webui? -->
|
||||
<link rel="stylesheet" href="/ipfs/QmXB7PLRWH6bCiwrGh2MrBBjNkLv3mY3JdYXCikYZSwLED/bootstrap.min.css"/>
|
||||
<!-- helper to construct this is here: https://github.com/cryptix/exp/blob/master/imgesToCSSData/convert.go -->
|
||||
<link rel="stylesheet" href="/ipfs/QmXB7PLRWH6bCiwrGh2MrBBjNkLv3mY3JdYXCikYZSwLED/icons.css">
|
||||
<style>
|
||||
.narrow {width: 0px;}
|
||||
.padding { margin: 100px;}
|
||||
#header {
|
||||
background: #000;
|
||||
}
|
||||
#logo {
|
||||
height: 25px;
|
||||
margin: 10px;
|
||||
}
|
||||
.ipfs-icon {
|
||||
width:16px;
|
||||
}
|
||||
</style>
|
||||
<title>{{ .Path }}</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="header" class="row">
|
||||
<div class="col-xs-2">
|
||||
<div id="logo" class="ipfs-logo"> </div>
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="col-xs-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<strong>Index of {{ .Path }}</strong>
|
||||
</div>
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
<td class="narrow">
|
||||
<div class="ipfs-icon ipfs-_blank"> </div>
|
||||
</td>
|
||||
<td class="padding">
|
||||
<a href="{{.BackLink}}">..</a>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
{{ range .Listing }}
|
||||
<tr>
|
||||
<td>
|
||||
<div class="ipfs-icon {{iconFromExt .Name}}"> </div>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ .Path }}">{{ .Name }}</a>
|
||||
</td>
|
||||
<td>{{ .Size }} bytes</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
`))
|
||||
|
||||
|
Reference in New Issue
Block a user