Files
jellybit/web/templates/index.html
T
avandClaude Opus 4.8 cc7e51b3a4 Обработка рассинхрона состояния с реальностью (state-reconciliation)
Распознаём ручное удаление источника (раздача в qBittorrent) и/или цели
(разложенные хардлинки) и отражаем его в состоянии задачи, без автодействий.

- Новая capability state-reconciliation (OpenSpec): фоновая сверка по матрице
  «источник × цель» → состояния target_missing/orphaned/deleted, переходы и
  самовосстановление (healing).
- worker: reconcileDesync в Poll (только разложенные/desync-задачи), дебаунс
  пропажи источника (порог [worker].source_missing_threshold) и синхронный
  preflight перед действиями (relink/recognize/apply/undo) — не доверяем
  state в БД.
- layout.Undo: отказ снять последнюю копию (nlink<=1 или нет источника),
  отказ всего батча без частичного отката (ErrLastCopy).
- store: единый список terminalStates для IsTerminal и FindActiveByInfohash
  (иначе семантика «активности» разъезжается), столбец source_miss_count,
  миграция 0003.
- httpapi/web и Telegram: показ новых состояний и уведомления о рассинхроне.
- Доки: workflow.md, jellyfin-layout.md, database.md (+0003), config.

Change заархивирован в openspec/changes/archive, дельта влита в openspec/specs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 11:07:09 +03:00

96 lines
3.7 KiB
HTML

<!doctype html>
<html lang="ru">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="refresh" content="5">
<title>jellybit</title>
<style>
:root { color-scheme: light dark; }
body { font-family: system-ui, sans-serif; max-width: 60rem; margin: 2rem auto; padding: 0 1rem; }
h1 { margin-bottom: .25rem; }
form.add { display: flex; gap: .5rem; flex-wrap: wrap; margin: 1rem 0; }
form.add input[name=source] { flex: 1 1 24rem; }
input, button { padding: .4rem .6rem; font-size: 1rem; }
table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
th, td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid #8884; vertical-align: top; }
td.src { font-family: monospace; font-size: .85rem; word-break: break-all; }
.err { color: #c0392b; }
.state { font-size: .8rem; padding: .1rem .5rem; border-radius: 1rem; background: #8883; white-space: nowrap; }
.state-completed { background: #2ecc7155; }
.state-downloading { background: #3498db55; }
.state-recognizing { background: #9b59b655; }
.state-review { background: #f1c40f88; }
.state-deferred { background: #f39c1255; }
.state-linking { background: #1abc9c55; }
.state-done { background: #2ecc7188; }
.state-stuck { background: #f39c1255; }
.state-failed { background: #e74c3c55; }
.state-cancelled { background: #95a5a655; }
.state-reverted { background: #95a5a655; }
.state-target_missing { background: #e67e2255; }
.state-orphaned { background: #e74c3c88; }
.state-deleted { background: #95a5a655; }
.actions { display: flex; gap: .4rem; flex-wrap: wrap; }
a.button { display: inline-block; padding: .35rem .6rem; border: 1px solid #8886; border-radius: .3rem; text-decoration: none; }
small { color: #8888; }
</style>
</head>
<body>
<h1>jellybit</h1>
<p><small>обновляется каждые 5 с</small></p>
<form class="add" method="post" action="/ui/downloads">
<input type="text" name="source" placeholder="magnet:?xt=urn:btih:…" required>
<input type="text" name="context" placeholder="контекст (опц.)">
<button type="submit">Добавить</button>
</form>
{{if .Error}}<p class="err">{{.Error}}</p>{{end}}
<table>
<thead>
<tr><th>#</th><th>Источник</th><th>Контекст</th><th>Состояние</th><th></th></tr>
</thead>
<tbody>
{{range .Downloads}}
<tr>
<td>{{.ID}}</td>
<td class="src" title="{{.Infohash}}">{{.Source}}</td>
<td>{{.Context}}</td>
<td>
<span class="state state-{{.State}}">{{.State}}</span>
{{if .Note}}<br><small>{{.Note}}</small>{{end}}
{{if .Error}}<br><small>{{.Error}}</small>{{end}}
</td>
<td>
<div class="actions">
{{if .Reviewable}}
<a class="button" href="/review/{{.ID}}">Ревью →</a>
{{end}}
{{if .Undoable}}
<form method="post" action="/ui/downloads/{{.ID}}/undo">
<button type="submit">Откатить</button>
</form>
{{end}}
{{if .Relinkable}}
<form method="post" action="/ui/downloads/{{.ID}}/relink">
<button type="submit">Привязать заново</button>
</form>
{{end}}
{{if not .Terminal}}
<form method="post" action="/ui/downloads/{{.ID}}/cancel">
<button type="submit">Отклонить</button>
</form>
{{end}}
</div>
</td>
</tr>
{{else}}
<tr><td colspan="5"><small>пока пусто</small></td></tr>
{{end}}
</tbody>
</table>
</body>
</html>