WIP caching system for Modrinth/CurseForge pack export

This commit is contained in:
comp500
2022-05-18 16:02:40 +01:00
parent 3a6109c1f9
commit 30bc6d81bb
5 changed files with 405 additions and 1 deletions

View File

@@ -1,5 +1,7 @@
package core
import "io"
// Updaters stores all the updaters that packwiz can use. Add your own update systems to this map, keyed by the configuration name.
var Updaters = make(map[string]Updater)
@@ -30,3 +32,25 @@ type UpdateCheck struct {
// If an error is returned for a mod, or from CheckUpdate, DoUpdate is not called on that mod / at all
Error error
}
// MetaDownloaders stores all the metadata-based installers that packwiz can use. Add your own downloaders to this map, keyed by the source name.
var MetaDownloaders = make(map[string]MetaDownloader)
// MetaDownloader specifies a downloader for a Mod using a "metadata:source" mode
// The calling code should handle caching and hash validation.
type MetaDownloader interface {
GetFilesMetadata([]*Mod) ([]MetaDownloaderData, error)
}
// MetaDownloaderData specifies the per-Mod metadata retrieved for downloading
type MetaDownloaderData interface {
GetManualDownload() (bool, ManualDownload)
DownloadFile(io.Writer) error
}
type ManualDownload struct {
Name string
FileName string
DestPath string
URL string
}