mirror of
https://github.com/simon-ding/polaris.git
synced 2026-05-11 04:57:28 +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 {
|
||||
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)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "db")
|
||||
|
||||
@@ -151,19 +151,30 @@ class _ActivityPageState extends ConsumerState<ActivityPage>
|
||||
children: [
|
||||
Text("开始时间:${timeago.format(ac.date!)}"),
|
||||
Text("大小:${(ac.size ?? 0).readableFileSize()}"),
|
||||
(ac.seedRatio??0) > 0
|
||||
(ac.seedRatio ?? 0) > 0
|
||||
? Text("分享率:${ac.seedRatio}")
|
||||
: SizedBox()
|
||||
],
|
||||
),
|
||||
),
|
||||
trailing: selectedTab != 2
|
||||
trailing: selectedTab == 0
|
||||
? IconButton(
|
||||
tooltip: "删除任务",
|
||||
onPressed: () =>
|
||||
showConfirmDialog(context, ac.id!),
|
||||
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(),
|
||||
],
|
||||
@@ -234,7 +245,9 @@ class _ActivityPageState extends ConsumerState<ActivityPage>
|
||||
return ListTile(
|
||||
dense: true,
|
||||
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(
|
||||
onPressed: () {
|
||||
final f = ref
|
||||
|
||||
Reference in New Issue
Block a user