forked from Vencord/Installer
-
Notifications
You must be signed in to change notification settings - Fork 4
/
self_updater.go
42 lines (35 loc) · 975 Bytes
/
self_updater.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
41
42
/*
* SPDX-License-Identifier: GPL-3.0
* Vencord Installer, a cross platform gui/cli app for installing Vencord
* Copyright (c) 2023 Vendicated and Vencord contributors
*/
package main
import (
"fmt"
"runtime"
)
var IsInstallerOutdated = false
func CheckSelfUpdate() {
fmt.Println("Checking for Installer Updates...")
res, err := GetGithubRelease(InstallerReleaseUrl, InstallerReleaseUrlFallback)
if err == nil {
IsInstallerOutdated = res.TagName != InstallerTag
}
}
func GetInstallerDownloadLink() string {
switch runtime.GOOS {
case "windows":
return "https://github.com/Vencord/Installer/releases/latest/download/VencordInstaller.exe"
case "darwin":
return "https://github.com/Vencord/Installer/releases/latest/download/VencordInstaller.MacOS.zip"
default:
return ""
}
}
func GetInstallerDownloadMarkdown() string {
link := GetInstallerDownloadLink()
if link == "" {
return ""
}
return " [Download the latest Installer](" + link + ")"
}