-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathitchfs_utils.go
40 lines (35 loc) · 1.02 KB
/
itchfs_utils.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package operate
import (
"github.com/itchio/butler/butlerd"
itchio "github.com/itchio/go-itchio"
"github.com/itchio/wharf/state"
)
func MakeSourceURL(client *itchio.Client, consumer *state.Consumer, sessionID string, params *InstallParams, fileType string) string {
build := params.Build
if build != nil {
if fileType == "" {
fileType = "archive"
if FindBuildFile(build.Files, itchio.BuildFileTypeUnpacked, itchio.BuildFileSubTypeDefault) != nil {
fileType = "unpacked"
}
}
return client.MakeBuildDownloadURL(itchio.MakeBuildDownloadParams{
BuildID: build.ID,
UUID: sessionID,
Credentials: params.Access.Credentials,
Type: itchio.BuildFileType(fileType),
})
}
return client.MakeUploadDownloadURL(itchio.MakeUploadDownloadParams{
UploadID: params.Upload.ID,
UUID: sessionID,
Credentials: params.Access.Credentials,
})
}
type ItchfsURLParams struct {
Credentials *butlerd.GameCredentials
UploadID int64
BuildID int64
FileType string
UUID string
}