[cmds] Allow running of tauri in beta

This commit is contained in:
Vladimir Stoilov 2024-07-08 09:22:11 +03:00
parent a84bbf4262
commit 0b72e99edd
4 changed files with 126 additions and 3321 deletions
cmds/portmaster-start
desktop
angular
tauri/src-tauri/src
service/updates/helper

View file

@ -29,6 +29,9 @@ const (
// This disables retrying and exits with an error code.
ControlledFailureExitCode = 24
// StartOldUIExitCode is an exit code that is returned by the UI when there. This is manfully triaged by the user, if the new UI does not work for them.
StartOldUIExitCode = -3
exeSuffix = ".exe"
zipSuffix = ".zip"
)
@ -38,6 +41,8 @@ var (
onWindows = runtime.GOOS == "windows"
stdinSignals bool
childIsRunning = abool.NewBool(false)
fallBackToOldUI bool = false
)
// Options for starting component.
@ -71,6 +76,12 @@ func init() {
AllowDownload: false,
AllowHidingWindow: false,
},
{
Name: "Portmaster App2",
Identifier: "app2/portmaster",
AllowDownload: false,
AllowHidingWindow: false,
},
{
Name: "Portmaster Notifier",
Identifier: "notifier/portmaster-notifier",
@ -311,6 +322,14 @@ func persistOutputStreams(opts *Options, version string, cmd *exec.Cmd) (chan st
}
func execute(opts *Options, args []string) (cont bool, err error) {
if registry.UsePreReleases && opts.ShortIdentifier == "app" {
// Check if new ui was already tried.
if !fallBackToOldUI {
opts.Identifier = "app2/portmaster"
opts.ShortIdentifier = "app2"
}
}
file, err := registry.GetFile(
helper.PlatformIdentifier(opts.Identifier),
)
@ -440,6 +459,9 @@ func parseExitError(err error) (restart bool, errWithCtx error) {
return true, nil
case ControlledFailureExitCode:
return false, errors.New("controlled failure, check logs")
case StartOldUIExitCode:
fallBackToOldUI = true
return true, errors.New("user requested old UI")
default:
return true, fmt.Errorf("unknown exit code %w", exErr)
}

File diff suppressed because it is too large Load diff

View file

@ -154,7 +154,9 @@ pub fn may_navigate_to_ui(win: &mut WebviewWindow, force: bool) {
}
#[cfg(not(debug_assertions))]
win.navigate("http://localhost:817".parse().unwrap());
{
_ = win.navigate("http://localhost:817".parse().unwrap());
}
} else {
error!(
"not navigating to user interface: current url: {}",

View file

@ -57,6 +57,7 @@ func MandatoryUpdates() (identifiers []string) {
PlatformIdentifier("start/portmaster-start.exe"),
PlatformIdentifier("notifier/portmaster-notifier.exe"),
PlatformIdentifier("notifier/portmaster-wintoast.dll"),
PlatformIdentifier("app2/portmaster.exe"),
)
} else {
identifiers = append(
@ -64,6 +65,7 @@ func MandatoryUpdates() (identifiers []string) {
PlatformIdentifier("core/portmaster-core"),
PlatformIdentifier("start/portmaster-start"),
PlatformIdentifier("notifier/portmaster-notifier"),
PlatformIdentifier("app2/portmaster"),
)
}