curseforge

package
v0.0.0-...-21f6cc7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const CurseApiKeyDefault = "JDJhJDEwJHNBWVhqblU1N0EzSmpzcmJYM3JVdk92UWk2NHBLS3BnQ2VpbGc1TUM1UGNKL0RYTmlGWWxh"

TODO: Get our own API key

View Source
const CurseApiServer = "api.curseforge.com"

Variables

View Source
var CurseApiKey = ""
View Source
var CurseDefaultClient = CurseApiClient{&http.Client{}}
View Source
var ModloaderIds = [...]string{
	"",
	"forge",
	"cauldron",
	"liteloader",
	"fabric",
	"quilt",
}
View Source
var ModloaderNames = [...]string{
	"",
	"Forge",
	"Cauldron",
	"Liteloader",
	"Fabric",
	"Quilt",
}
View Source
var SnapshotNames = [...]string{"-pre", " Pre-Release ", " Pre-release ", "-rc"}
View Source
var SnapshotVersionRegex = regexp.MustCompile(`(?:Snapshot )?(\d+)w0?(0|[1-9]\d*)([a-z])`)

Functions

func CreateCurseModlist

func CreateCurseModlist(zw *zip.Writer, mods []*core.Mod) error

func DecodeDefaultKey

func DecodeDefaultKey() string

func GetCurseforgeVersion

func GetCurseforgeVersion(mcVersion string) string

func GetCurseforgeVersions

func GetCurseforgeVersions(mcVersions []string) []string

Types

type CachedStateStore

type CachedStateStore struct {
	ModInfo
	// contains filtered or unexported fields
}

type CurseApiClient

type CurseApiClient struct {
	// contains filtered or unexported fields
}

func (*CurseApiClient) GetFileInfo

func (c *CurseApiClient) GetFileInfo(modID uint32, fileID uint32) (ModFileInfo, error)

func (*CurseApiClient) GetFileInfoMultiple

func (c *CurseApiClient) GetFileInfoMultiple(fileIDs []uint32) ([]ModFileInfo, error)

func (*CurseApiClient) GetModInfoMultiple

func (c *CurseApiClient) GetModInfoMultiple(modIDs []uint32) ([]ModInfo, error)

func (*CurseApiClient) MakeGet

func (c *CurseApiClient) MakeGet(endpoint string) (*http.Response, error)

func (*CurseApiClient) MakePost

func (c *CurseApiClient) MakePost(endpoint string, body io.Reader) (*http.Response, error)

type CurseDownloadMetadata

type CurseDownloadMetadata struct {
	// contains filtered or unexported fields
}

func (*CurseDownloadMetadata) DownloadFile

func (m *CurseDownloadMetadata) DownloadFile() (io.ReadCloser, error)

func (*CurseDownloadMetadata) GetManualDownload

func (m *CurseDownloadMetadata) GetManualDownload() (bool, core.ManualDownload)

type CurseDownloader

type CurseDownloader struct{}

func (CurseDownloader) GetFilesMetadata

func (c CurseDownloader) GetFilesMetadata(mods []*core.Mod) ([]core.MetaDownloaderData, error)

type CurseExportData

type CurseExportData struct {
	ProjectID uint32 `mapstructure:"project-id"`
}

func ParseCurseExportData

func ParseCurseExportData(from map[string]interface{}) (CurseExportData, error)

type CurseUpdateData

type CurseUpdateData struct {
	ProjectID uint32 `mapstructure:"project-id"`
	FileID    uint32 `mapstructure:"file-id"`
}

func (CurseUpdateData) ToMap

func (u CurseUpdateData) ToMap() (map[string]interface{}, error)

type CurseUpdater

type CurseUpdater struct{}

func (CurseUpdater) CheckUpdate

func (u CurseUpdater) CheckUpdate(mods []*core.Mod, pack core.Pack) ([]core.UpdateCheck, error)

func (CurseUpdater) DoUpdate

func (u CurseUpdater) DoUpdate(mods []*core.Mod, cachedState []interface{}) error

func (CurseUpdater) ParseUpdate

func (u CurseUpdater) ParseUpdate(updateUnparsed map[string]interface{}) (interface{}, error)

type DependencyType

type DependencyType uint8

type FileType

type FileType uint8

type HashAlgo

type HashAlgo uint8
const (
	HashAlgoSHA1 HashAlgo = iota + 1
	HashAlgoMD5
)

type ModFileInfo

type ModFileInfo struct {
	ID           uint32    `json:"id"`
	ModID        uint32    `json:"modId"`
	FileName     string    `json:"fileName"`
	FriendlyName string    `json:"displayName"`
	Date         time.Time `json:"fileDate"`
	Length       uint64    `json:"fileLength"`
	FileType     FileType  `json:"releaseType"`
	DownloadURL  string    `json:"downloadUrl"`
	GameVersions []string  `json:"gameVersions"`
	Fingerprint  uint32    `json:"fileFingerprint"`

	Dependencies []struct {
		ModID uint32         `json:"modId"`
		Type  DependencyType `json:"relationType"`
	} `json:"dependencies"`

	Hashes []struct {
		Value     string   `json:"value"`
		Algorithm HashAlgo `json:"algo"`
	} `json:"hashes"`
}

func FindLatestFile

func FindLatestFile(modInfoData ModInfo, mcVersions []string, packLoaders []string) (fileID uint32, fileInfoData *ModFileInfo, fileName string)

func (ModFileInfo) GetBestHash

func (i ModFileInfo) GetBestHash() (hash string, hashFormat string)

type ModInfo

type ModInfo struct {
	Name              string        `json:"name"`
	Summary           string        `json:"summary"`
	Slug              string        `json:"slug"`
	ID                uint32        `json:"id"`
	GameID            uint32        `json:"gameId"`
	PrimaryCategoryID uint32        `json:"primaryCategoryId"`
	ClassID           uint32        `json:"classId"`
	LatestFiles       []ModFileInfo `json:"latestFiles"`

	GameVersionLatestFiles []struct {
		GameVersion string        `json:"gameVersion"`
		ID          uint32        `json:"fileId"`
		Name        string        `json:"filename"`
		FileType    FileType      `json:"releaseType"`
		Modloader   ModloaderType `json:"modLoader"`
	} `json:"latestFilesIndexes"`

	ModLoaders []string `json:"modLoaders"`

	Links struct {
		WebsiteURL string `json:"websiteUrl"`
	} `json:"links"`
}

type ModloaderType

type ModloaderType uint8
const ModloaderTypeAny ModloaderType = iota

func FilterFileInfoLoaderIndex

func FilterFileInfoLoaderIndex(packLoaders []string, fileInfoData ModFileInfo) (ModloaderType, bool)

func FilterLoaderTypeIndex

func FilterLoaderTypeIndex(packLoaders []string, modLoaderType ModloaderType) (ModloaderType, bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL