- Fix Delete button in webdav

- Other bug fixes
This commit is contained in:
Mukhtar Akere
2025-05-16 16:43:01 +01:00
parent b984697fe3
commit 35a74d8dba
6 changed files with 50 additions and 23 deletions
+1 -2
View File
@@ -650,8 +650,7 @@ func (c *Cache) DeleteTorrent(id string) error {
defer c.torrentsRefreshMu.Unlock()
if c.deleteTorrent(id, true) {
c.listingDebouncer.Call(true)
c.logger.Trace().Msgf("Torrent %s deleted successfully", id)
go c.RefreshListings(true)
return nil
}
return nil
+2
View File
@@ -12,6 +12,7 @@ import (
)
type fileInfo struct {
id string
name string
size int64
mode os.FileMode
@@ -24,6 +25,7 @@ func (fi *fileInfo) Size() int64 { return fi.size }
func (fi *fileInfo) Mode() os.FileMode { return fi.mode }
func (fi *fileInfo) ModTime() time.Time { return fi.modTime }
func (fi *fileInfo) IsDir() bool { return fi.isDir }
func (fi *fileInfo) ID() string { return fi.id }
func (fi *fileInfo) Sys() interface{} { return nil }
func (c *Cache) RefreshListings(refreshRclone bool) {
+4 -2
View File
@@ -143,7 +143,7 @@ func (tc *torrentCache) refreshListing() {
go func() {
listing := make([]os.FileInfo, len(all))
for i, sf := range all {
listing[i] = &fileInfo{sf.name, sf.size, 0755 | os.ModeDir, sf.modTime, true}
listing[i] = &fileInfo{sf.id, sf.name, sf.size, 0755 | os.ModeDir, sf.modTime, true}
}
tc.listing.Store(listing)
}()
@@ -156,7 +156,8 @@ func (tc *torrentCache) refreshListing() {
for _, sf := range all {
if sf.bad {
listing = append(listing, &fileInfo{
name: fmt.Sprintf("%s(%s)", sf.name, sf.id),
id: sf.id,
name: fmt.Sprintf("%s || %s", sf.name, sf.id),
size: sf.size,
mode: 0755 | os.ModeDir,
modTime: sf.modTime,
@@ -183,6 +184,7 @@ func (tc *torrentCache) refreshListing() {
for _, sf := range all {
if tc.torrentMatchDirectory(filters, sf, now) {
matched = append(matched, &fileInfo{
id: sf.id,
name: sf.name, size: sf.size,
mode: 0755 | os.ModeDir, modTime: sf.modTime, isDir: true,
})