sources

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DependencyTypeRequired dependencyType
)

noinspection GoUnusedConst

View Source
const (
	GameApiStatusPublic gameApiStatus
)

noinspection GoUnusedConst

View Source
const (
	GameStatusLive gameStatus
)

noinspection GoUnusedConst

Variables

View Source
var GithubRegex = regexp.MustCompile(`^https?://(?:www\.)?github\.com/([^/]+/[^/]+)`)
View Source
var ModloaderIds = [...]string{
	"",
	"forge",
	"cauldron",
	"liteloader",
	"fabric",
	"quilt",
	"neoforge",
}
View Source
var ModloaderNames = [...]string{
	"",
	"Forge",
	"Cauldron",
	"Liteloader",
	"Fabric",
	"Quilt",
	"NeoForge",
}

Functions

func CreateCurseforgeDependencies

func CreateCurseforgeDependencies(depsInstallable []CfInstallableDep) ([]*core.Mod, error)

func CurseforgeCategoryLookup

func CurseforgeCategoryLookup(category string) (uint32, uint32, error)

func CurseforgeFindMissingDependencies

func CurseforgeFindMissingDependencies(
	pack core.Pack,
	fileInfoData CfModFileInfo,
	primaryMCVersion string,
) ([]*core.Mod, error)

func CurseforgeModInfoFromID

func CurseforgeModInfoFromID(
	modID uint32,
	fileID uint32,
	mcVersions []string,
	packLoaders []string,
) (CfModInfo, CfModFileInfo, error)

func CurseforgeModInfoFromSlug

func CurseforgeModInfoFromSlug(
	slug string,
	category string,
	fileID uint32,
	mcVersions []string,
	searchLoaderType ModloaderType,
	packLoaders []string,
) (CfModInfo, CfModFileInfo, error)

func CurseforgeNewMod

func CurseforgeNewMod(modInfo CfModInfo, fileInfo CfModFileInfo, optionalDisabled bool) (*core.Mod, error)

func CurseforgeParseUrl

func CurseforgeParseUrl(url string) (category string, slug string, fileID uint32, err error)

func GetCfModType

func GetCfModType(gameID, classID, categoryID uint32) string

func GetCurseforgeClient

func GetCurseforgeClient() *cfApiClient

func GetCurseforgeVersion

func GetCurseforgeVersion(mcVersion string) string

func GetCurseforgeVersions

func GetCurseforgeVersions(mcVersions []string) []string

func GetModrinthClient

func GetModrinthClient() *modrinthApi.Client

func GetModrinthVersionPrimaryFile

func GetModrinthVersionPrimaryFile(
	version *modrinthApi.Version,
	optionalFilenameMatch string,
) *modrinthApi.File

func GitHubNewMod

func GitHubNewMod(slugOrUrl, branch, regex, modType string) (*core.Mod, error)

func MapDepOverride

func MapDepOverride(depID uint32, isQuilt bool, mcVersion string) uint32

MapDepOverride transforms manual dependency overrides (which will likely be removed when packwiz is able to determine provided mods)

func ModrinthFindMissingDependencies

func ModrinthFindMissingDependencies(
	version *modrinthApi.Version,
	pack core.Pack,
	optionalDatapackFolder string,
) ([]*core.Mod, error)

func ModrinthGetLatestVersion

func ModrinthGetLatestVersion(projectID string, name string, pack core.Pack, optionalDatapackFolder string) (*modrinthApi.Version, error)

func ModrinthNewMod

func ModrinthNewMod(
	project *modrinthApi.Project,
	version *modrinthApi.Version,
	modType string,
	compatibleLoaders []string,
	optionalFilenameMatch string,
) (*core.Mod, error)

func ModrinthProjectFromVersionID

func ModrinthProjectFromVersionID(versionId string) (*modrinthApi.Project, *modrinthApi.Version, error)

func ModrinthSearchForProjects

func ModrinthSearchForProjects(query string, versions []string) ([]*modrinthApi.Project, error)

func ParseAsModrinthSlug

func ParseAsModrinthSlug(input string) string

func ParseAsModrinthVersion

func ParseAsModrinthVersion(input string) string

func ParseAsModrinthVersionID

func ParseAsModrinthVersionID(input string) string

func ParseAsParseAsFilename

func ParseAsParseAsFilename(input string) string

func ParseModrinthSlugOrUrl

func ParseModrinthSlugOrUrl(input string, slug *string, version *string, versionID *string, filename *string) (parsedSlug bool, err error)

func ResolveModrinthVersion

func ResolveModrinthVersion(project *modrinthApi.Project, version string) (*modrinthApi.Version, error)

Types

type Asset

type Asset struct {
	URL                string `json:"url"`
	BrowserDownloadURL string `json:"browser_download_url"`
	Name               string `json:"name"`
}

type CfDownloadMetadata

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

func (*CfDownloadMetadata) DownloadFile

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

func (*CfDownloadMetadata) GetManualDownload

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

type CfDownloader

type CfDownloader struct{}

func (CfDownloader) GetFilesMetadata

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

type CfExportData

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

func ParseExportData

func ParseExportData(from map[string]interface{}) (CfExportData, error)

func (CfExportData) ToMap

func (e CfExportData) ToMap() (map[string]interface{}, error)

type CfInstallableDep

type CfInstallableDep struct {
	CfModInfo
	FileInfo CfModFileInfo
}

type CfModFileInfo

type CfModFileInfo 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"`
	// According to the CurseForge API T&Cs, this must not be saved or cached
	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"`
}

CfModFileInfo is a subset of the deserialised JSON response from the Curse API for mod files

func CfFindLatestFile

func CfFindLatestFile(modInfoData CfModInfo, mcVersions []string, packLoaders []string) (fileID uint32, fileInfoData *CfModFileInfo, fileName string)

CfFindLatestFile looks at mod info, and finds the latest file ID (and potentially the file info for it - may be null)

func GetLatestFile

func GetLatestFile(modInfoData CfModInfo, mcVersions []string, fileID uint32, packLoaders []string) (CfModFileInfo, error)

func (CfModFileInfo) GetBestHash

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

type CfModInfo

type CfModInfo 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            []CfModFileInfo `json:"latestFiles"`
	GameVersionLatestFiles []struct {
		// TODO: check how twitch launcher chooses which one to use, when you are on beta/alpha channel?!
		// or does it not have the concept of release channels?!
		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"`
}

CfModInfo is a subset of the deserialised JSON response from the Curse API for mods (addons)

type CfUpdateData

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

func (CfUpdateData) ToMap

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

type CfUpdater

type CfUpdater struct{}

func (CfUpdater) CheckUpdate

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

func (CfUpdater) DoUpdate

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

func (CfUpdater) GetName

func (u CfUpdater) GetName() string

func (CfUpdater) ParseUpdate

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

type ModloaderType

type ModloaderType uint8
const (
	// ModloaderTypeAny should not be passed to the API - it does not work
	ModloaderTypeAny ModloaderType = iota
	ModloaderTypeForge
	ModloaderTypeCauldron
	ModloaderTypeLiteloader
	ModloaderTypeFabric
	ModloaderTypeQuilt
	ModloaderTypeNeoForge
)

noinspection GoUnusedConst

func CfFilterFileInfoLoaderIndex

func CfFilterFileInfoLoaderIndex(packLoaders []string, fileInfoData CfModFileInfo) (ModloaderType, bool)

func CfFilterLoaderTypeIndex

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

func CfGetSearchLoaderType

func CfGetSearchLoaderType(pack core.Pack) ModloaderType

type ModrinthDepMetadataStore

type ModrinthDepMetadataStore struct {
	ProjectInfo *modrinthApi.Project
	VersionInfo *modrinthApi.Version
	FileInfo    *modrinthApi.File
}

type ModrinthPack

type ModrinthPack struct {
	FormatVersion uint32             `json:"formatVersion"`
	Game          string             `json:"game"`
	VersionID     string             `json:"versionId"`
	Name          string             `json:"name"`
	Summary       string             `json:"summary,omitempty"`
	Files         []ModrinthPackFile `json:"files"`
	Dependencies  map[string]string  `json:"dependencies"`
}

type ModrinthPackFile

type ModrinthPackFile struct {
	Path   string            `json:"path"`
	Hashes map[string]string `json:"hashes"`
	Env    *struct {
		Client string `json:"client"`
		Server string `json:"server"`
	} `json:"env"`
	Downloads []string `json:"downloads"`
	FileSize  uint32   `json:"fileSize"`
}

type Release

type Release struct {
	URL             string  `json:"url"`
	TagName         string  `json:"tag_name"`
	TargetCommitish string  `json:"target_commitish"` // The branch of the release
	Name            string  `json:"name"`
	CreatedAt       string  `json:"created_at"`
	Assets          []Asset `json:"assets"`
}

type Repo

type Repo struct {
	ID       int    `json:"id"`
	Name     string `json:"name"`      // "hello_world"
	FullName string `json:"full_name"` // "owner/hello_world"
}

Jump to

Keyboard shortcuts

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