feat: add option to delete storage media files

This commit is contained in:
Simon Ding
2024-12-11 21:09:00 +08:00
parent 22f76e3f57
commit 6d127c6d00
10 changed files with 60 additions and 13 deletions

View File

@@ -72,3 +72,7 @@ func (a *Alist) UploadProgress() float64 {
}
return a.progresser()
}
func (a *Alist) RemoveAll(path string) error {
return nil
}

View File

@@ -20,6 +20,7 @@ type Storage interface {
ReadFile(string) ([]byte, error)
WriteFile(string, []byte) error
UploadProgress() float64
RemoveAll(path string) error
}
type uploadFunc func(destPath string, destInfo fs.FileInfo, srcReader io.Reader, mimeType *mimetype.MIME) error

View File

@@ -71,3 +71,7 @@ func (l *LocalStorage) WriteFile(name string, data []byte) error {
func (l *LocalStorage) UploadProgress() float64 {
return 0
}
func (i *LocalStorage) RemoveAll(path string) error {
return os.RemoveAll(path)
}

View File

@@ -85,3 +85,7 @@ func (w *WebdavStorage) UploadProgress() float64 {
}
return w.progresser()
}
func (w *WebdavStorage) RemoveAll(path string) error {
return w.fs.RemoveAll(path)
}