mirror of
https://github.com/simon-ding/polaris.git
synced 2026-05-27 04:57:42 +08:00
feat: seeding torrent only mark as success
This commit is contained in:
@@ -98,6 +98,15 @@ func (s *Server) RemoveActivity(c *gin.Context) (interface{}, error) {
|
|||||||
if err := s.core.RemoveTaskAndTorrent(his.ID); err != nil {
|
if err := s.core.RemoveTaskAndTorrent(his.ID); err != nil {
|
||||||
return nil, errors.Wrap(err, "remove torrent")
|
return nil, errors.Wrap(err, "remove torrent")
|
||||||
}
|
}
|
||||||
|
if his.Status == history.StatusSeeding {
|
||||||
|
//seeding, will mark as complete
|
||||||
|
log.Infof("history is now seeding, will only mark history as success: (%d) %s", his.ID, his.SourceTitle)
|
||||||
|
if err := s.db.SetHistoryStatus(his.ID, history.StatusSuccess); err!= nil {
|
||||||
|
return nil, errors.Wrap(err, "set status")
|
||||||
|
}
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
err := s.db.DeleteHistory(in.ID)
|
err := s.db.DeleteHistory(in.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "db")
|
return nil, errors.Wrap(err, "db")
|
||||||
|
|||||||
@@ -151,19 +151,30 @@ class _ActivityPageState extends ConsumerState<ActivityPage>
|
|||||||
children: [
|
children: [
|
||||||
Text("开始时间:${timeago.format(ac.date!)}"),
|
Text("开始时间:${timeago.format(ac.date!)}"),
|
||||||
Text("大小:${(ac.size ?? 0).readableFileSize()}"),
|
Text("大小:${(ac.size ?? 0).readableFileSize()}"),
|
||||||
(ac.seedRatio??0) > 0
|
(ac.seedRatio ?? 0) > 0
|
||||||
? Text("分享率:${ac.seedRatio}")
|
? Text("分享率:${ac.seedRatio}")
|
||||||
: SizedBox()
|
: SizedBox()
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
trailing: selectedTab != 2
|
trailing: selectedTab == 0
|
||||||
? IconButton(
|
? IconButton(
|
||||||
tooltip: "删除任务",
|
tooltip: "删除任务",
|
||||||
onPressed: () =>
|
onPressed: () =>
|
||||||
showConfirmDialog(context, ac.id!),
|
showConfirmDialog(context, ac.id!),
|
||||||
icon: const Icon(Icons.delete))
|
icon: const Icon(Icons.delete))
|
||||||
: const Text("-"),
|
: (selectedTab == 1
|
||||||
|
? IconButton(
|
||||||
|
tooltip: "完成做种",
|
||||||
|
onPressed: () => {
|
||||||
|
ref
|
||||||
|
.read(activitiesDataProvider(
|
||||||
|
ActivityStatus.active)
|
||||||
|
.notifier)
|
||||||
|
.deleteActivity(ac.id!, false)
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.check))
|
||||||
|
: const Text("-")),
|
||||||
),
|
),
|
||||||
Divider(),
|
Divider(),
|
||||||
],
|
],
|
||||||
@@ -234,7 +245,9 @@ class _ActivityPageState extends ConsumerState<ActivityPage>
|
|||||||
return ListTile(
|
return ListTile(
|
||||||
dense: true,
|
dense: true,
|
||||||
title: Text(item.torrentName ?? ""),
|
title: Text(item.torrentName ?? ""),
|
||||||
subtitle: Opacity( opacity: 0.7,child: Text("hash: ${item.torrentHash ?? ""}")),
|
subtitle: Opacity(
|
||||||
|
opacity: 0.7,
|
||||||
|
child: Text("hash: ${item.torrentHash ?? ""}")),
|
||||||
trailing: IconButton(
|
trailing: IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
final f = ref
|
final f = ref
|
||||||
|
|||||||
Reference in New Issue
Block a user