operate

package
v14.8.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2018 License: MIT Imports: 42 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BadExternalHosts = map[string]string{

	"dropbox.com":       "Needs a browser",
	"drive.google.com":  "Needs, like, a mountain of javascript to be interpreted first.",
	"docs.google.com":   "See drive.google.com",
	"goo.gl":            "Nothing good can hide behind that URL shortener (probably drive)",
	"onedrive.live.com": "Microsoft's twist on Dropbox",
	"1drv.ms":           "Short url for OneDrive",
	"yadi.sk":           "Yandex dropbox-like?",

	"mega.nz":       "Decrypts files in your browser? What could go wrong.",
	"mega.co.nz":    "Old domain name for mega.nz",
	"mediafire.com": "One of the least terrible 'hosting sites' of its genre, but still no dice.",
	"indiedb.com":   "Also needs a browser",

	"wetransfer.com": "Needs a browser three",
	"hightail.com":   "Looks like a WeTransfer clone?",

	"play.google.com":          "Even if we could download from there, what are we going to do with an APK",
	"itunes.apple.com":         "Ditto",
	"steampowered.com":         "That's not a CDN, just a store page. Don't set your upload to that..",
	"support.steampowered.com": "Why",
	"store.steampowered.com":   "What",
	"gamejolt.com":             "Please stop",

	"puzzlescript.net": "Great little engine, nothing for us to download though.",
	"philome.la":       "Twine embeds, no archive to download from there",
	"scratch.mit.edu":  "More embeds",

	"youtube.com": "Why??",
}

We can't download silently from any of these hosts. This maps host names to fun trivia.

Functions

func DownloadInstallSource

func DownloadInstallSource(consumer *state.Consumer, stageFolder string, ctx context.Context, file eos.File, destPath string) error

func FindBuildFile

func FindBuildFile(files []*itchio.BuildFile, fileType itchio.BuildFileType, subType itchio.BuildFileSubType) *itchio.BuildFile

func GameToString

func GameToString(game *itchio.Game) string

func GetFilteredUploads

func GetFilteredUploads(client *itchio.Client, game *itchio.Game, credentials itchio.GameCredentials, consumer *state.Consumer) (*manager.NarrowDownUploadsResult, error)

func InstallPerform

func InstallPerform(ctx context.Context, rc *butlerd.RequestContext, performParams butlerd.InstallPerformParams) error

func InstallPrepare

func InstallPrepare(oc *OperationContext, meta *MetaSubcontext, isub *InstallSubcontext, allowDownloads bool, task InstallTask) error

func IsBadExternalHost

func IsBadExternalHost(host string) bool

func LogBuild

func LogBuild(consumer *state.Consumer, u *itchio.Upload, b *itchio.Build)

func LogUpload

func LogUpload(consumer *state.Consumer, u *itchio.Upload, b *itchio.Build)

func MakeSourceURL

func MakeSourceURL(client *itchio.Client, consumer *state.Consumer, sessionID string, params *InstallParams, fileType string) string

func TeeConsumer

func TeeConsumer(c *state.Consumer, logFile io.Writer) *state.Consumer

func ValidateCave

func ValidateCave(rc *butlerd.RequestContext, caveID string) *models.Cave

Types

type Accuracy

type Accuracy int
const (
	AccuracyNone     Accuracy = 0
	AccuracyGuess    Accuracy = 10
	AccuracyComputed Accuracy = 20
)

func (Accuracy) String

func (a Accuracy) String() string

type CommitInstallParams

type CommitInstallParams struct {
	InstallerName string
	InstallFolder string

	Game   *itchio.Game
	Upload *itchio.Upload
	Build  *itchio.Build

	InstallResult *installer.InstallResult
}

type DiskUsageInfo

type DiskUsageInfo struct {
	// Space we'll use once the install is all said and done
	FinalDiskUsage int64

	// Space we need to perform that operation
	NeededFreeSpace int64

	// Accuracy of our information
	Accuracy Accuracy
}

func AssessDiskUsage

func AssessDiskUsage(sourceFile eos.File, receiptIn *bfs.Receipt, installFolder string, installerInfo *installer.InstallerInfo) (*DiskUsageInfo, error)

type GameAccess

type GameAccess struct {
	APIKey      string                 `json:"api_key"`
	Credentials itchio.GameCredentials `json:"credentials"`
}

func AccessForGameID

func AccessForGameID(conn *sqlite.Conn, gameID int64) *GameAccess

func (*GameAccess) OnlyAPIKey

func (ga *GameAccess) OnlyAPIKey() *GameAccess

type InstallParams

type InstallParams struct {
	StagingFolder string `json:"stagingFolder"`

	Reason butlerd.DownloadReason `json:"reason"`

	CaveID            string `json:"caveId"`
	InstallFolderName string `json:"installFolderName"`
	InstallLocationID string `json:"installLocationID"`

	InstallFolder string `json:"installFolder"`

	NoCave bool `json:"noCave"`

	Game   *itchio.Game   `json:"game"`
	Upload *itchio.Upload `json:"upload"`
	Build  *itchio.Build  `json:"build"`

	IgnoreInstallers bool `json:"ignoreInstallers,omitempty"`

	Access *GameAccess `json:"credentials"`
}

type InstallPerformStrategy

type InstallPerformStrategy = int
const (
	InstallPerformStrategyNone    InstallPerformStrategy = 0
	InstallPerformStrategyInstall InstallPerformStrategy = 1
	InstallPerformStrategyHeal    InstallPerformStrategy = 2
	InstallPerformStrategyUpgrade InstallPerformStrategy = 3
)

type InstallPrepareResult

type InstallPrepareResult struct {
	File      eos.File
	ReceiptIn *bfs.Receipt
	Strategy  InstallPerformStrategy
}

type InstallSubcontext

type InstallSubcontext struct {
	Data *InstallSubcontextState
}

func (*InstallSubcontext) GetData

func (mt *InstallSubcontext) GetData() interface{}

func (*InstallSubcontext) Key

func (mt *InstallSubcontext) Key() string

type InstallSubcontextState

type InstallSubcontextState struct {
	DownloadSessionID   string                   `json:"downloadSessionId,omitempty"`
	InstallerInfo       *installer.InstallerInfo `json:"installerInfo,omitempty"`
	IsAvailableLocally  bool                     `json:"isAvailableLocally,omitempty"`
	FirstInstallResult  *installer.InstallResult `json:"firstInstallResult,omitempty"`
	SecondInstallerInfo *installer.InstallerInfo `json:"secondInstallerInfo,omitempty"`
	UpgradePath         *itchio.UpgradePath      `json:"upgradePath,omitempty"`
	UpgradePathIndex    int                      `json:"upgradePathIndex,omitempty"`
}

type InstallTask

type InstallTask func(res *InstallPrepareResult) error

type ItchfsURLParams

type ItchfsURLParams struct {
	Credentials *butlerd.GameCredentials
	UploadID    int64
	BuildID     int64
	FileType    string
	UUID        string
}

type MetaSubcontext

type MetaSubcontext struct {
	Data *InstallParams
}

func NewMetaSubcontext

func NewMetaSubcontext() *MetaSubcontext

func (*MetaSubcontext) GetData

func (mt *MetaSubcontext) GetData() interface{}

func (*MetaSubcontext) Key

func (mt *MetaSubcontext) Key() string

type OperationContext

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

func LoadContext

func LoadContext(ctx context.Context, rc *butlerd.RequestContext, stageFolder string) (*OperationContext, error)

func (*OperationContext) Consumer

func (oc *OperationContext) Consumer() *state.Consumer

func (*OperationContext) Load

func (oc *OperationContext) Load(s Subcontext)

func (*OperationContext) Release

func (oc *OperationContext) Release()

func (*OperationContext) Retire

func (oc *OperationContext) Retire()

func (*OperationContext) Save

func (oc *OperationContext) Save(s Subcontext) error

func (*OperationContext) StageFolder

func (oc *OperationContext) StageFolder() string

type PidFileContents

type PidFileContents struct {
	PID int64 `json:"pid"`
}

type Subcontext

type Subcontext interface {
	// Key returns a unique string key used for storing
	// something under the context object
	Key() string

	// Data should return a pointer to the underlying struct
	// of the subcontext
	GetData() interface{}
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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