MCPcopy Index your code
hub / github.com/Threadfin/Threadfin / BinaryUpdate

Function BinaryUpdate

src/update.go:19–180  ·  view source on GitHub ↗

BinaryUpdate : Binary Update Prozess. Git Branch master und beta wird von GitHub geladen.

()

Source from the content-addressed store, hash-verified

17
18// BinaryUpdate : Binary Update Prozess. Git Branch master und beta wird von GitHub geladen.
19func BinaryUpdate() (err error) {
20
21 if !System.GitHub.Update {
22 showWarning(2099)
23 return
24 }
25
26 if !Settings.ThreadfinAutoUpdate {
27 showWarning(2098)
28 return
29 }
30
31 var debug string
32
33 var updater = &up2date.Updater
34 updater.Name = System.Update.Name
35 updater.Branch = System.Branch
36
37 up2date.Init()
38
39 log.Println("BRANCH: ", System.Branch)
40 switch System.Branch {
41
42 // Update von GitHub
43 case "Main", "Beta":
44 var releaseInfo = fmt.Sprintf("%s/releases", System.Update.Github)
45 var latest string
46 var body []byte
47
48 var git []*GithubReleaseInfo
49
50 resp, err := http.Get(releaseInfo)
51 if err != nil {
52 ShowError(err, 6003)
53 return nil
54 }
55
56 body, _ = io.ReadAll(resp.Body)
57
58 err = json.Unmarshal(body, &git)
59 if err != nil {
60 return err
61 }
62
63 // Get latest prerelease tag name
64 if System.Branch == "Beta" {
65 for _, release := range git {
66 if release.Prerelease {
67 latest = release.TagName
68 updater.Response.Version = release.TagName
69 break
70 }
71 }
72 }
73
74 // Latest main tag name
75 if System.Branch == "Main" {
76 for _, release := range git {

Callers 2

mainFunction · 0.92
maintenanceFunction · 0.85

Calls 4

showWarningFunction · 0.85
ShowErrorFunction · 0.85
showInfoFunction · 0.85
showDebugFunction · 0.85

Tested by

no test coverage detected