Started work on adding mod downloader

Read from mod-list.json in mod dir and download each mod in list.
This requires reading from factorio mod portal api, and extracting download url and calling it with username and api token.

new field in config.yml username and apitoken, is needed to download mod files from mod.factorio.com
This commit is contained in:
2026-04-30 12:06:49 -06:00
parent b2f485269b
commit 2548261d66
7 changed files with 151 additions and 7 deletions

37
jsonStruts.go Normal file
View File

@@ -0,0 +1,37 @@
package main
type Mod struct {
Name string `json:"name"`
Enabled bool `json:"enabled"`
Version string `json:"version,omitempty"`
}
type ModList struct {
Mods []Mod `json:"mods"`
}
type ModPortal struct {
Category string `json:"category"`
DownloadCount int `json:"downloads_count"`
Name string `json:"name"`
Owner string `json:"owner"`
Releases []Release `json:"releases"`
Score float64 `json:"score"`
Summary string `json:"summary"`
Thumbnail string `json:"thumbnail"`
Title string `json:"title"`
}
type Release struct {
DownloadUrl string `json:"download_url"`
Filename string `json:"file_name"`
InfoJson InfoJSON `json:"info_json"`
ReleaseTime string `json:"released_at"`
Sha1 string `json:"sha1"`
Version string `json:"version"`
}
type InfoJSON struct {
Dependencies []string `json:"dependencies"`
FactorioVersion string `json:"factorio_version"`
}