shelfy/templates/godownloader_download.pages.tmpl

75 lines
2.5 KiB
Cheetah
Raw Normal View History

2025-06-12 08:57:10 +00:00
<h1>Download</h1>
<div class="box">
<form hx-post="/api/download/add"
hx-trigger="submit"
hx-swap="none"
hx-on="htmx:afterRequest: this.reset()"
class="mb-4">
<div class="field">
<label class="label">Lien à débrider</label>
<div class="control">
<input class="input" type="text" name="link" placeholder="https://..." required>
</div>
</div>
<div class="field">
<label class="label">Chemin d'enregistrement</label>
<div class="control">
<div class="select">
<select name="path_id">
{{range .paths}}<option value="{{.ID}}">{{.PathName}}</option>{{end}}
</select>
</div>
</div>
</div>
<div class="field is-grouped">
<div class="control">
<button class="button is-primary" type="submit">Ajouter</button>
</div>
</div>
</form>
<div id="downloads-table" hx-get="/api/download/all" hx-trigger="every 2s" hx-swap="outerHTML">
<table class="table is-fullwidth is-striped">
<thead>
<tr>
<th>Fichier</th>
<th>Statut</th>
<th>Vitesse</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{{ range .jobs }}
<tr class="border-b {{ if eq .Status "error" }}bg-red-100 text-red-800{{ end }}">
<td class="px-2 py-1 text-sm">{{ .FileName }}</td>
<td class="px-2 py-1 text-sm">{{ .Status }}</td>
<td class="px-2 py-1 text-sm">{{ .Speed }}</td>
<td class="px-2 py-1 text-sm">
{{ if eq .Status "added" }}
<button hx-post="/api/download/start/{{ .ID }}" class="text-indigo-600">⬇ Télécharger</button>
{{ end }}
{{ if eq .Status "paused" }}
<button hx-post="/api/download/resume/{{ .ID }}" class="text-blue-600">▶</button>
{{ else if eq .Status "downloading" }}
<button hx-post="/api/download/pause/{{ .ID }}" class="text-yellow-600">⏸</button>
{{ end }}
{{ if and (eq .Status "downloaded") .StreamURL }}
<a href="/stream/{{ .ID }}" target="_blank" class="text-green-600 ml-2">🎬 Stream</a>
<button onclick="navigator.clipboard.writeText('{{ .StreamURL }}')" class="text-gray-600 ml-1">📋</button>
<a href="{{ .DownloadLink }}" class="text-blue-600 ml-1" download>⬇</a>
{{ end }}
<button hx-delete="/api/download/delete/{{ .ID }}" class="text-red-600 ml-2">✖</button>
</td>
</tr>
{{ if eq .Status "error" }}
<tr class="bg-red-50 text-sm text-red-600">
<td colspan="4" class="px-2 py-1">Erreur : {{ .ErrorMsg }}</td>
</tr>
{{ end }}
{{ end }}
</tbody>
</table>
</div>
</div>