mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 12:46:46 +00:00
fix: correctly install tls certs with osascript
This commit is contained in:
@ -17,6 +17,9 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/)
|
|||||||
* GODT-124 bump go-appdir from v1.0.0 to v1.1.0
|
* GODT-124 bump go-appdir from v1.0.0 to v1.1.0
|
||||||
* CSB-72 Skip processing message update event if http statuscode is 422
|
* CSB-72 Skip processing message update event if http statuscode is 422
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
* Use correct binary name when finding location of addcert.scpt
|
||||||
|
|
||||||
## [v1.2.6] Donghai - beta (2020-03-31)
|
## [v1.2.6] Donghai - beta (2020-03-31)
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@ -29,11 +29,9 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/kardianos/osext"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type tlsConfiger interface {
|
type tlsConfiger interface {
|
||||||
@ -74,10 +72,11 @@ func GetTLSConfig(cfg tlsConfiger) (tlsConfig *tls.Config, err error) {
|
|||||||
|
|
||||||
if runtime.GOOS == "darwin" {
|
if runtime.GOOS == "darwin" {
|
||||||
// If this fails, log the error but continue to load.
|
// If this fails, log the error but continue to load.
|
||||||
if p, err := osext.Executable(); err == nil {
|
if binaryPath, err := os.Executable(); err == nil {
|
||||||
p = strings.TrimSuffix(p, "MacOS/Desktop-Bridge") // This needs to match the executable name.
|
macOSPath := filepath.Dir(binaryPath)
|
||||||
p += "Resources/addcert.scpt"
|
contentsPath := filepath.Dir(macOSPath)
|
||||||
if err := exec.Command("/usr/bin/osascript", p).Run(); err != nil { // nolint[gosec]
|
resourcesPath := filepath.Join(contentsPath, "Resources", "addcert.scpt")
|
||||||
|
if err := exec.Command("/usr/bin/osascript", resourcesPath).Run(); err != nil { // nolint[gosec]
|
||||||
log.WithError(err).Error("Failed to add cert to system keychain")
|
log.WithError(err).Error("Failed to add cert to system keychain")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user