forked from TrueCloudLab/frostfs-http-gw
90 lines
2.3 KiB
Go Template
90 lines
2.3 KiB
Go Template
{{$bucketName := .BucketName}}
|
|
{{ $prefix := trimPrefix .Prefix }}
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8"/>
|
|
<title>Index of s3://{{$bucketName}}/{{if $prefix}}/{{$prefix}}/{{end}}</title>
|
|
<style>
|
|
table {
|
|
width: 80%;
|
|
border-collapse: collapse;
|
|
}
|
|
body {
|
|
background: #f2f2f2;
|
|
}
|
|
table, th, td {
|
|
border: 0 solid transparent;
|
|
}
|
|
th, td {
|
|
padding: 10px;
|
|
text-align: left;
|
|
}
|
|
th {
|
|
background-color: #c3bcbc;
|
|
}
|
|
tr:nth-child(even) {background-color: #ebe7e7;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>Index of s3://{{$bucketName}}/{{if $prefix}}{{$prefix}}/{{end}}</h1>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Filename</th>
|
|
<th>Size</th>
|
|
<th>Created</th>
|
|
<th>Download</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{ $trimmedPrefix := trimPrefix $prefix }}
|
|
{{if $trimmedPrefix }}
|
|
<tr>
|
|
<td>
|
|
⮐<a href="/get/{{$bucketName}}{{ urlencode $trimmedPrefix "" }}">..</a>
|
|
</td>
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
</tr>
|
|
{{else}}
|
|
<tr>
|
|
<td>
|
|
⮐<a href="/get/{{ $bucketName }}/">..</a>
|
|
</td>
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
</tr>
|
|
{{end}}
|
|
{{range .Objects}}
|
|
<tr>
|
|
<td>
|
|
{{if .IsDir}}
|
|
🗀
|
|
<a href="/get/{{ $bucketName }}{{ urlencode $prefix .FileName }}/">
|
|
{{.FileName}}/
|
|
</a>
|
|
{{else}}
|
|
🗎
|
|
<a href="/get/{{ $bucketName }}{{ urlencode $prefix .FileName }}">
|
|
{{.FileName}}
|
|
</a>
|
|
{{end}}
|
|
</td>
|
|
<td>{{if not .IsDir}}{{ formatSize .Size }}{{end}}</td>
|
|
<td>{{if not .IsDir}}{{ formatTimestamp .Created }}{{end}}</td>
|
|
<td>
|
|
{{ if not .IsDir }}
|
|
<a href="/get/{{ $bucketName}}{{ urlencode $prefix .FileName }}?download=true">
|
|
Link
|
|
</a>
|
|
{{ end }}
|
|
</td>
|
|
</tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
</body>
|
|
</html>
|