Add files.

This commit is contained in:
2021-09-21 08:33:24 +09:30
parent 4a23b7032e
commit e7b8410d1b
5 changed files with 355 additions and 0 deletions

29
web/index.html Normal file
View File

@@ -0,0 +1,29 @@
<html>
<head>
<title>index</title>
<link rel="stylesheet" href="https://unpkg.com/purecss@2.0.6/build/pure-min.css" integrity="sha384-Uu6IeWbM+gzNVXJcM9XV3SohHtmWE+3VGi496jvgX1jyvDTXfdK+rfZc8C1Aehk5" crossorigin="anonymous">
</head>
<body>
<p>
Drag this bookmarklet: <a href="{{ .BookmarkletURL }}">Gropple</a> to your bookmark bar, and click it
on any page you want to grab the video from.
</p>
{{ range $k, $v := .Downloads }}
<div>
<h4>{{ $v.Url }}</h4>
<table>
<tr><th>state</th><td>{{ $v.State }}</td></tr>
<tr><th>percent</th><td>{{ $v.Percent }}</td></tr>
<tr><th>files</th><td>{{ range $i, $f := $v.Files }}{{ $f }}<br>{{ end }}</td></tr>
<tr><th>exit code</th><td>{{ $v.ExitCode }}</td></tr>
</table>
<pre>
{{ range $i, $l := $v.Log }}
line: {{ $l }}
{{- end -}}
</pre>
</div>
{{ end }}
</body>

46
web/popup.html Normal file
View File

@@ -0,0 +1,46 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>fetching {{ .Url }}</title>
<script src="//unpkg.com/alpinejs" defer></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://unpkg.com/purecss@2.0.6/build/pure-min.css" integrity="sha384-Uu6IeWbM+gzNVXJcM9XV3SohHtmWE+3VGi496jvgX1jyvDTXfdK+rfZc8C1Aehk5" crossorigin="anonymous">
<link rel="stylesheet" href="https://unpkg.com/purecss@2.0.6/build/grids-responsive-min.css">
</head>
<body>
<div id="layout" class="pure-g pure-u-1">
<p>Fetching <tt>{{ .Url }}</tt></p>
<table class="pure-table" x-data="popup()" x-init="fetch_data()">
<tr><th>current filename</th><td x-text="filename"></td></tr>
<tr><th>state</th><td x-text="state"></td></tr>
<tr><th>progress</th><td x-text="percent"></td></tr>
<tr><th>ETA</th><td x-text="eta"></td></tr>
</table>
<p><a href="/" target="_grobbler">Status page</a> </p>
</div>
</body>
<script>
function popup() {
return {
eta: '', percent: 0.0, state: '??', filename: '',
fetch_data() {
fetch('/fetch/info/{{ .Id }}')
.then(response => response.json())
.then(info => {
this.eta = info.eta;
this.percent = info.percent + "%";
this.state = info.state;
if (info.files && info.files.length > 0) {
this.filename = info.files[info.files.length - 1];
}
if (this.state != "ended") {
setTimeout(() => { this.fetch_data() }, 100);
}
});
},
}
}
</script>
</html>