forked from Silverfish/proton-bridge
rename IE app GODT-690
This commit is contained in:
@ -37,7 +37,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
appName = "importExport"
|
appName = "importExport"
|
||||||
appNameDash = "import-export"
|
appNameDash = "import-export-app"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@ -830,7 +830,7 @@ Window {
|
|||||||
property string bugNotSent
|
property string bugNotSent
|
||||||
property string bugReportSent
|
property string bugReportSent
|
||||||
|
|
||||||
property string programTitle : "ProtonMail Import-Export App"
|
property string programTitle : "ProtonMail Import-Export app"
|
||||||
property string newversion : "q0.1.0"
|
property string newversion : "q0.1.0"
|
||||||
property string landingPage : "https://landing.page"
|
property string landingPage : "https://landing.page"
|
||||||
property string changelog : "• Lorem ipsum dolor sit amet\n• consetetur sadipscing elitr,\n• sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n• sed diam voluptua.\n• At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."
|
property string changelog : "• Lorem ipsum dolor sit amet\n• consetetur sadipscing elitr,\n• sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n• sed diam voluptua.\n• At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."
|
||||||
|
|||||||
@ -49,65 +49,62 @@ var (
|
|||||||
var (
|
var (
|
||||||
log = logrus.WithField("pkg", "bridgeUtils/updates") //nolint[gochecknoglobals]
|
log = logrus.WithField("pkg", "bridgeUtils/updates") //nolint[gochecknoglobals]
|
||||||
|
|
||||||
installFileSuffix = map[string]string{ //nolint[gochecknoglobals]
|
|
||||||
"darwin": ".dmg",
|
|
||||||
"windows": ".exe",
|
|
||||||
"linux": ".sh",
|
|
||||||
}
|
|
||||||
|
|
||||||
ErrDownloadFailed = errors.New("error happened during download") //nolint[gochecknoglobals]
|
ErrDownloadFailed = errors.New("error happened during download") //nolint[gochecknoglobals]
|
||||||
ErrUpdateVerifyFailed = errors.New("cannot verify signature") //nolint[gochecknoglobals]
|
ErrUpdateVerifyFailed = errors.New("cannot verify signature") //nolint[gochecknoglobals]
|
||||||
)
|
)
|
||||||
|
|
||||||
type Updates struct {
|
type Updates struct {
|
||||||
version string
|
version string
|
||||||
revision string
|
revision string
|
||||||
buildTime string
|
buildTime string
|
||||||
releaseNotes string
|
releaseNotes string
|
||||||
releaseFixedBugs string
|
releaseFixedBugs string
|
||||||
updateTempDir string
|
updateTempDir string
|
||||||
landingPagePath string // Based on Host/; default landing page for download.
|
landingPagePath string // Based on Host/; default landing page for download.
|
||||||
installerFileBaseName string // File for initial install or manual reinstall. per goos [exe, dmg, sh].
|
winInstallerFile string // File for initial install or manual reinstall for windows
|
||||||
versionFileBaseName string // Text file containing information about current file. per goos [_linux,_darwin,_windows].json (have .sig file).
|
macInstallerFile string // File for initial install or manual reinstall for mac
|
||||||
updateFileBaseName string // File for automatic update. per goos [_linux,_darwin,_windows].tgz (have .sig file).
|
versionFileBaseName string // Text file containing information about current file. per goos [_linux,_darwin,_windows].json (have .sig file).
|
||||||
linuxFileBaseName string // Prefix of linux package names.
|
updateFileBaseName string // File for automatic update. per goos [_linux,_darwin,_windows].tgz (have .sig file).
|
||||||
macAppBundleName string // Name of Mac app file in the bundle for update procedure.
|
linuxFileBaseName string // Prefix of linux package names.
|
||||||
cachedNewerVersion *VersionInfo // To have info about latest version even when the internet connection drops.
|
macAppBundleName string // Name of Mac app file in the bundle for update procedure.
|
||||||
|
cachedNewerVersion *VersionInfo // To have info about latest version even when the internet connection drops.
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewBridge inits Updates struct for bridge.
|
// NewBridge inits Updates struct for bridge.
|
||||||
func NewBridge(updateTempDir string) *Updates {
|
func NewBridge(updateTempDir string) *Updates {
|
||||||
return &Updates{
|
return &Updates{
|
||||||
version: constants.Version,
|
version: constants.Version,
|
||||||
revision: constants.Revision,
|
revision: constants.Revision,
|
||||||
buildTime: constants.BuildTime,
|
buildTime: constants.BuildTime,
|
||||||
releaseNotes: bridge.ReleaseNotes,
|
releaseNotes: bridge.ReleaseNotes,
|
||||||
releaseFixedBugs: bridge.ReleaseFixedBugs,
|
releaseFixedBugs: bridge.ReleaseFixedBugs,
|
||||||
updateTempDir: updateTempDir,
|
updateTempDir: updateTempDir,
|
||||||
landingPagePath: "bridge/download",
|
landingPagePath: "bridge/download",
|
||||||
installerFileBaseName: "Bridge-Installer",
|
macInstallerFile: "Bridge-Installer.dmg",
|
||||||
versionFileBaseName: "current_version",
|
winInstallerFile: "Bridge-Installer.exe",
|
||||||
updateFileBaseName: "bridge_upgrade",
|
versionFileBaseName: "current_version",
|
||||||
linuxFileBaseName: "protonmail-bridge",
|
updateFileBaseName: "bridge_upgrade",
|
||||||
macAppBundleName: "ProtonMail Bridge.app",
|
linuxFileBaseName: "protonmail-bridge",
|
||||||
|
macAppBundleName: "ProtonMail Bridge.app",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImportExport inits Updates struct for import-export.
|
// NewImportExport inits Updates struct for import-export.
|
||||||
func NewImportExport(updateTempDir string) *Updates {
|
func NewImportExport(updateTempDir string) *Updates {
|
||||||
return &Updates{
|
return &Updates{
|
||||||
version: constants.Version,
|
version: constants.Version,
|
||||||
revision: constants.Revision,
|
revision: constants.Revision,
|
||||||
buildTime: constants.BuildTime,
|
buildTime: constants.BuildTime,
|
||||||
releaseNotes: importexport.ReleaseNotes,
|
releaseNotes: importexport.ReleaseNotes,
|
||||||
releaseFixedBugs: importexport.ReleaseFixedBugs,
|
releaseFixedBugs: importexport.ReleaseFixedBugs,
|
||||||
updateTempDir: updateTempDir,
|
updateTempDir: updateTempDir,
|
||||||
landingPagePath: "import-export",
|
landingPagePath: "import-export",
|
||||||
installerFileBaseName: "Import-Export-Installer",
|
winInstallerFile: "ie/Import-Export-app-installer.exe",
|
||||||
versionFileBaseName: "current_version_ie",
|
macInstallerFile: "ie/Import-Export-app.dmg",
|
||||||
updateFileBaseName: "ie_upgrade",
|
versionFileBaseName: "current_version_ie",
|
||||||
linuxFileBaseName: "protonmail-import-export",
|
updateFileBaseName: "ie/ie_upgrade",
|
||||||
macAppBundleName: "ProtonMail Import-Export.app",
|
linuxFileBaseName: "ie/protonmail-import-export-app",
|
||||||
|
macAppBundleName: "Import-Export app.app",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,11 +184,15 @@ func (u *Updates) getLocalVersion(goos string) VersionInfo {
|
|||||||
if goos == "linux" {
|
if goos == "linux" {
|
||||||
pkgName := u.linuxFileBaseName
|
pkgName := u.linuxFileBaseName
|
||||||
pkgRel := "1"
|
pkgRel := "1"
|
||||||
pkgBase := strings.Join([]string{Host, DownloadPath, pkgName}, "/")
|
pkgBaseFile := strings.Join([]string{Host, DownloadPath, pkgName}, "/")
|
||||||
|
|
||||||
versionInfo.DebFile = pkgBase + "_" + u.version + "-" + pkgRel + "_amd64.deb"
|
pkgBasePath := DownloadPath + "/" + pkgName // add at least one dir
|
||||||
versionInfo.RpmFile = pkgBase + "-" + u.version + "-" + pkgRel + ".x86_64.rpm"
|
pkgBasePath = filepath.Dir(pkgBasePath) // keep only last dir
|
||||||
versionInfo.PkgFile = strings.Join([]string{Host, DownloadPath, "PKGBUILD"}, "/")
|
pkgBasePath = Host + "/" + pkgBasePath // add host in the end to not strip off double slash in URL
|
||||||
|
|
||||||
|
versionInfo.DebFile = pkgBaseFile + "_" + u.version + "-" + pkgRel + "_amd64.deb"
|
||||||
|
versionInfo.RpmFile = pkgBaseFile + "-" + u.version + "-" + pkgRel + ".x86_64.rpm"
|
||||||
|
versionInfo.PkgFile = strings.Join([]string{pkgBasePath, "PKGBUILD"}, "/")
|
||||||
}
|
}
|
||||||
|
|
||||||
return versionInfo
|
return versionInfo
|
||||||
@ -240,7 +241,14 @@ func (u *Updates) versionFileURL(goos string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (u *Updates) installerFileURL(goos string) string {
|
func (u *Updates) installerFileURL(goos string) string {
|
||||||
return strings.Join([]string{Host, DownloadPath, u.installerFileBaseName + installFileSuffix[goos]}, "/")
|
installerFile := "none"
|
||||||
|
switch goos {
|
||||||
|
case "darwin":
|
||||||
|
installerFile = u.macInstallerFile
|
||||||
|
case "windows":
|
||||||
|
installerFile = u.winInstallerFile
|
||||||
|
}
|
||||||
|
return strings.Join([]string{Host, DownloadPath, installerFile}, "/")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *Updates) updateFileURL(goos string) string {
|
func (u *Updates) updateFileURL(goos string) string {
|
||||||
@ -299,7 +307,8 @@ func (u *Updates) StartUpgrade(currentStatus chan<- Progress) { // nolint[funlen
|
|||||||
status.UpdateDescription(InfoUpgrading)
|
status.UpdateDescription(InfoUpgrading)
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "windows": //nolint[goconst]
|
case "windows": //nolint[goconst]
|
||||||
cmd := exec.Command("./" + u.installerFileBaseName) // nolint[gosec]
|
installerFile := strings.Split(u.winInstallerFile, "/")[1]
|
||||||
|
cmd := exec.Command("./" + installerFile) // nolint[gosec]
|
||||||
cmd.Dir = u.updateTempDir
|
cmd.Dir = u.updateTempDir
|
||||||
status.Err = cmd.Start()
|
status.Err = cmd.Start()
|
||||||
case "darwin":
|
case "darwin":
|
||||||
|
|||||||
Reference in New Issue
Block a user