mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 12:46:46 +00:00
Other: Fix force-update test after version bump
This commit is contained in:
@ -34,11 +34,17 @@ func withBridge(
|
|||||||
cookieJar http.CookieJar,
|
cookieJar http.CookieJar,
|
||||||
fn func(*bridge.Bridge) error,
|
fn func(*bridge.Bridge) error,
|
||||||
) error {
|
) error {
|
||||||
|
// Get the current bridge version.
|
||||||
|
version, err := semver.NewVersion(constants.Version)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("could not create version: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
// Create the underlying dialer used by the bridge.
|
// Create the underlying dialer used by the bridge.
|
||||||
// It only connects to trusted servers and reports any untrusted servers it finds.
|
// It only connects to trusted servers and reports any untrusted servers it finds.
|
||||||
pinningDialer := dialer.NewPinningTLSDialer(
|
pinningDialer := dialer.NewPinningTLSDialer(
|
||||||
dialer.NewBasicTLSDialer(constants.APIHost),
|
dialer.NewBasicTLSDialer(constants.APIHost),
|
||||||
dialer.NewTLSReporter(constants.APIHost, constants.AppVersion, identifier, dialer.TrustedAPIPins),
|
dialer.NewTLSReporter(constants.APIHost, constants.AppVersion(version.Original()), identifier, dialer.TrustedAPIPins),
|
||||||
dialer.NewTLSPinChecker(dialer.TrustedAPIPins),
|
dialer.NewTLSPinChecker(dialer.TrustedAPIPins),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -57,12 +63,6 @@ func withBridge(
|
|||||||
return fmt.Errorf("could not create updater: %w", err)
|
return fmt.Errorf("could not create updater: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the current bridge version.
|
|
||||||
version, err := semver.NewVersion(constants.Version)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("could not create version: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create a new bridge.
|
// Create a new bridge.
|
||||||
bridge, err := bridge.New(
|
bridge, err := bridge.New(
|
||||||
// The app stuff.
|
// The app stuff.
|
||||||
|
|||||||
@ -98,7 +98,7 @@ func New(
|
|||||||
) (*Bridge, error) {
|
) (*Bridge, error) {
|
||||||
api := liteapi.New(
|
api := liteapi.New(
|
||||||
liteapi.WithHostURL(apiURL),
|
liteapi.WithHostURL(apiURL),
|
||||||
liteapi.WithAppVersion(constants.AppVersion),
|
liteapi.WithAppVersion(constants.AppVersion(curVersion.Original())),
|
||||||
liteapi.WithCookieJar(cookieJar),
|
liteapi.WithCookieJar(cookieJar),
|
||||||
liteapi.WithTransport(roundTripper),
|
liteapi.WithTransport(roundTripper),
|
||||||
)
|
)
|
||||||
|
|||||||
@ -45,9 +45,6 @@ var (
|
|||||||
// Version of the build.
|
// Version of the build.
|
||||||
Version = "2.4.1+git"
|
Version = "2.4.1+git"
|
||||||
|
|
||||||
// AppVersion is the full rendered version of the app (to be used in request headers).
|
|
||||||
AppVersion = getAPIOS() + cases.Title(language.Und).String(ConfigName) + "_" + Version
|
|
||||||
|
|
||||||
// Revision is current hash of the build.
|
// Revision is current hash of the build.
|
||||||
Revision = ""
|
Revision = ""
|
||||||
|
|
||||||
@ -67,6 +64,11 @@ var (
|
|||||||
Host = "127.0.0.1"
|
Host = "127.0.0.1"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// AppVersion returns the full rendered version of the app (to be used in request headers).
|
||||||
|
func AppVersion(version string) string {
|
||||||
|
return getAPIOS() + cases.Title(language.Und).String(ConfigName) + "_" + version
|
||||||
|
}
|
||||||
|
|
||||||
func getAPIOS() string {
|
func getAPIOS() string {
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "darwin":
|
case "darwin":
|
||||||
|
|||||||
Reference in New Issue
Block a user