added cache only access server

This commit is contained in:
ston1th 2022-03-22 21:48:59 +01:00
commit b5ae5504a7
6 changed files with 217 additions and 8 deletions

View file

@ -5,7 +5,7 @@ package srv
import "html/template"
var (
index = template.Must(template.New("index").Parse(`<!doctype html>
indexHead = `<!doctype html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
@ -107,8 +107,9 @@ span {
font-size: 15px;
}
</style>
</head>
<body>
</head>`
index = template.Must(template.New("index").Parse(indexHead + `<body>
<article>
<pre>[v]: show video
[n]: skip file caching
@ -143,6 +144,39 @@ span {
</table>
</article>
</body>
</html>`))
cache = template.Must(template.New("cache").Parse(indexHead + `<body>
<article>
<pre>[v]: show video</pre>
<table>
<tr class="listitem">
<td class="listpath up"><a href="../">../</a></td>
<td class="listoptions">[dir]</td>
</tr>
<tr class="spacer"><td colspan="2"></td></tr>
{{range $s := .Dirs -}}
<tr class="listitem">
<td class="listpath"><a href="{{$s.URI}}">{{$s.Name}}</a></td>
<td class="listoptions">[dir]</td>
</tr>
<tr class="spacer"><td colspan="2"></td></tr>
{{end -}}
{{range $s := .Files -}}
<tr class="listitem">
<td class="listpath"><a id="{{$s.Anchor}}" href="{{$s.URI}}">{{$s.Name}}</a></td>
<td class="listoptions">
{{if ge $s.Status 0}}<span>{{$s.Status}}%</span>{{end}}<a href="{{$s.URI}}?o=v">[v]</a>
</td>
</tr>
<tr class="spacer"><td colspan="2">
{{if ge $s.Status 0}}
<div class="spacer {{if le $s.Status 35}}red{{else if le $s.Status 65}}yellow{{else}}green{{end}}" style="width: {{$s.Status}}%;"></div>
{{end -}}
</td></tr>
{{end -}}
</table>
</article>
</body>
</html>`))
video = template.Must(template.New("video").Parse(`<!doctype html>
<html lang="en">