This commit is contained in:
@@ -643,6 +643,19 @@ func registerPublicDownloads(mux *http.ServeMux, store filesvc.MeshStore, blobs
|
||||
defer rc.Close()
|
||||
serveBlob(w, r, rc, meta, it.Name) // Download-Name aus Store!
|
||||
return
|
||||
} else { // ########## HIER EVENTUELL PROBLEM!!! ###########
|
||||
// Lokal nicht vorhanden → nur aus Mesh ziehen, wenn Owner aktiv ist
|
||||
it, err := store.Get(r.Context(), filesvc.ID(id))
|
||||
if err != nil || it.Deleted {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
peers := meshNode.PeerList()
|
||||
ttl := 2 * time.Minute
|
||||
if !isOwnerActive(it.Owner, peers, ttl) {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// 3) aus Mesh holen (signiert) und cachen
|
||||
|
||||
@@ -24,28 +24,19 @@
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Owner</th><th>Status</th><th>ID</th><th>Name</th><th>Updated</th><th>Blob</th><th style="width:260px">Aktionen</th>
|
||||
<th>ID</th>
|
||||
<th>Name</th>
|
||||
<th>Updated</th>
|
||||
<th>Blob</th>
|
||||
<th>Owner</th>
|
||||
<th>Status</th>
|
||||
<th style="width:320px">Aktionen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{ range .Items }}
|
||||
<tr>
|
||||
<td><small class="muted">{{ .Owner }}</small></td>
|
||||
<td>
|
||||
{{ if .OwnerActive }}
|
||||
<span class="pill">online</span>
|
||||
{{ else }}
|
||||
<span class="pill" style="background:#5b1a1a;border-color:#7a2b2b;color:#fbb">offline</span>
|
||||
<form style="display:inline"
|
||||
hx-post="/admin/items/takeover"
|
||||
hx-target="#items" hx-swap="outerHTML"
|
||||
onsubmit="return confirm('Owner übernehmen?');">
|
||||
<input type="hidden" name="id" value="{{ .ID }}">
|
||||
<button class="btn" type="submit">Übernehmen</button>
|
||||
</form>
|
||||
{{ end }}
|
||||
</td>
|
||||
<td>{{ .ID }}</td>
|
||||
<td><code style="font-size:12px">{{ .ID }}</code></td>
|
||||
<td>{{ .Name }}</td>
|
||||
<td><small class="muted">{{ printf "%.19s" (timeRFC3339 .UpdatedAt) }}</small></td>
|
||||
<td>
|
||||
@@ -56,18 +47,34 @@
|
||||
<span class="pill" style="background:#3a0b0b;border-color:#5b1a1a;color:#fbb;">fehlt</span>
|
||||
{{ end }}
|
||||
</td>
|
||||
<td><small class="muted">{{ .Owner }}</small></td>
|
||||
<td>
|
||||
{{ if .OwnerActive }}
|
||||
<span class="pill">online</span>
|
||||
{{ else }}
|
||||
<span class="pill" style="background:#5b1a1a;border-color:#7a2b2b;color:#fbb">offline</span>
|
||||
<!-- Owner-Handover nur wenn offline -->
|
||||
<form style="display:inline"
|
||||
hx-post="/admin/items/takeover"
|
||||
hx-target="#items" hx-swap="outerHTML"
|
||||
onsubmit="return confirm('Owner übernehmen?');">
|
||||
<input type="hidden" name="id" value="{{ .ID }}">
|
||||
<button class="btn" type="submit">Übernehmen</button>
|
||||
</form>
|
||||
{{ end }}
|
||||
</td>
|
||||
<td>
|
||||
<form style="display:inline-flex; gap:6px"
|
||||
hx-post="/admin/items/rename"
|
||||
hx-target="#items" hx-swap="outerHTML">
|
||||
hx-post="/admin/items/rename"
|
||||
hx-target="#items" hx-swap="outerHTML">
|
||||
<input type="hidden" name="id" value="{{ .ID }}">
|
||||
<input type="text" name="name" placeholder="Neuer Name">
|
||||
<button class="btn" type="submit">Rename</button>
|
||||
</form>
|
||||
<form style="display:inline"
|
||||
hx-post="/admin/items/delete"
|
||||
hx-target="#items" hx-swap="outerHTML"
|
||||
onsubmit="return confirm('Wirklich löschen (inkl. Blob)?');">
|
||||
hx-post="/admin/items/delete"
|
||||
hx-target="#items" hx-swap="outerHTML"
|
||||
onsubmit="return confirm('Wirklich löschen (inkl. Blob)?');">
|
||||
<input type="hidden" name="id" value="{{ .ID }}">
|
||||
<button class="btn" type="submit">Delete</button>
|
||||
</form>
|
||||
@@ -77,17 +84,17 @@
|
||||
</td>
|
||||
</tr>
|
||||
{{ else }}
|
||||
<tr><td colspan="5" class="muted">Keine Dateien vorhanden.</td></tr>
|
||||
<tr><td colspan="7" class="muted">Keine Dateien vorhanden.</td></tr>
|
||||
{{ end }}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{{ if .Next }}
|
||||
<div style="margin-top:10px">
|
||||
<button class="btn"
|
||||
hx-get="/admin/items?next={{ .Next }}"
|
||||
<button class="btn"
|
||||
hx-get="/admin/items?next={{ .Next }}"
|
||||
hx-target="#items" hx-swap="outerHTML">Mehr laden</button>
|
||||
<span class="pill">next={{ .Next }}</span>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user