forked from Silverfish/proton-bridge
Other: Tidy up app.go a bit
This commit is contained in:
@ -138,6 +138,7 @@ func New() *cli.App { //nolint:funlen
|
|||||||
Name: flagParentPID,
|
Name: flagParentPID,
|
||||||
Usage: "Process ID of the parent",
|
Usage: "Process ID of the parent",
|
||||||
Hidden: true,
|
Hidden: true,
|
||||||
|
Value: -1,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,9 +185,11 @@ func run(c *cli.Context) error { //nolint:funlen
|
|||||||
return WithLocations(func(locations *locations.Locations) error {
|
return WithLocations(func(locations *locations.Locations) error {
|
||||||
// Initialize logging.
|
// Initialize logging.
|
||||||
return withLogging(c, crashHandler, locations, func() error {
|
return withLogging(c, crashHandler, locations, func() error {
|
||||||
|
// If there was an error during migration, log it now.
|
||||||
if migrationErr != nil {
|
if migrationErr != nil {
|
||||||
logrus.WithError(migrationErr).Error("Migration failed")
|
logrus.WithError(migrationErr).Error("Failed to migrate old app data")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure we are the only instance running.
|
// Ensure we are the only instance running.
|
||||||
return withSingleInstance(locations, version, func() error {
|
return withSingleInstance(locations, version, func() error {
|
||||||
// Unlock the encrypted vault.
|
// Unlock the encrypted vault.
|
||||||
@ -194,11 +197,7 @@ func run(c *cli.Context) error { //nolint:funlen
|
|||||||
// Load the cookies from the vault.
|
// Load the cookies from the vault.
|
||||||
return withCookieJar(vault, func(cookieJar http.CookieJar) error {
|
return withCookieJar(vault, func(cookieJar http.CookieJar) error {
|
||||||
// Create a new bridge instance.
|
// Create a new bridge instance.
|
||||||
return withBridge(
|
return withBridge(c, exe, locations, version, identifier, crashHandler, reporter, vault, cookieJar, func(b *bridge.Bridge, eventCh <-chan events.Event) error {
|
||||||
c, exe, locations, version,
|
|
||||||
identifier, crashHandler, reporter,
|
|
||||||
vault, cookieJar, func(
|
|
||||||
b *bridge.Bridge, eventCh <-chan events.Event) error {
|
|
||||||
if insecure {
|
if insecure {
|
||||||
logrus.Warn("The vault key could not be retrieved; the vault will not be encrypted")
|
logrus.Warn("The vault key could not be retrieved; the vault will not be encrypted")
|
||||||
b.PushError(bridge.ErrVaultInsecure)
|
b.PushError(bridge.ErrVaultInsecure)
|
||||||
@ -209,17 +208,9 @@ func run(c *cli.Context) error { //nolint:funlen
|
|||||||
b.PushError(bridge.ErrVaultCorrupt)
|
b.PushError(bridge.ErrVaultCorrupt)
|
||||||
}
|
}
|
||||||
|
|
||||||
parentPID := -1
|
|
||||||
if pid := c.Int(flagParentPID); pid != 0 {
|
|
||||||
parentPID = pid
|
|
||||||
}
|
|
||||||
|
|
||||||
// Run the frontend.
|
// Run the frontend.
|
||||||
return runFrontend(c, crashHandler, restarter,
|
return runFrontend(c, crashHandler, restarter, locations, b, eventCh, c.Int(flagParentPID))
|
||||||
locations, b, eventCh, parentPID,
|
})
|
||||||
)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user