Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions desktop/public/pow/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Emerge Tools, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Binary file added desktop/public/pow/plop.m4a
Binary file not shown.
Binary file added desktop/public/pow/poof1@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added desktop/public/pow/poof2@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added desktop/public/pow/poof3@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added desktop/public/pow/poof4@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added desktop/public/pow/poof5@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions desktop/src-tauri/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ mod profile;
mod relay_members;
mod social;
mod teams;
mod warp;
mod workflows;
mod workspace;

Expand All @@ -49,5 +50,6 @@ pub use profile::*;
pub use relay_members::*;
pub use social::*;
pub use teams::*;
pub use warp::*;
pub use workflows::*;
pub use workspace::*;
58 changes: 58 additions & 0 deletions desktop/src-tauri/src/commands/warp.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
use std::io;
use std::process::{Command, Output};

type CmdResult<T> = Result<T, String>;

const WARP_CLI_CANDIDATES: &[&str] = &[
"warp-cli",
"/Applications/Cloudflare WARP.app/Contents/Resources/warp-cli",
];

fn handle_warp_cli_output(command: &str, args: &[&str], output: Output) -> CmdResult<()> {
if output.status.success() {
return Ok(());
}

let stderr = String::from_utf8_lossy(&output.stderr);
let stdout = String::from_utf8_lossy(&output.stdout);
let details = stderr.trim();
let details = if details.is_empty() {
stdout.trim()
} else {
details
};

if details.is_empty() {
Err(format!("{command} {} failed.", args.join(" ")))
} else {
Err(format!("{command} {} failed: {details}", args.join(" ")))
}
}

fn run_warp_cli(args: &[&str]) -> CmdResult<()> {
for command in WARP_CLI_CANDIDATES {
let output = match Command::new(command).args(args).output() {
Ok(output) => output,
Err(error) if error.kind() == io::ErrorKind::NotFound => continue,
Err(error) => return Err(format!("Failed to run {command}: {error}")),
};

return handle_warp_cli_output(command, args, output);
}

Err("Cloudflare WARP CLI is not installed or is not on PATH.".to_string())
}

#[tauri::command]
pub async fn connect_warp_vpn() -> CmdResult<()> {
tokio::task::spawn_blocking(|| run_warp_cli(&["connect"]))
.await
.map_err(|error| format!("Failed to run WARP command: {error}"))?
}

#[tauri::command]
pub async fn refresh_warp_access() -> CmdResult<()> {
tokio::task::spawn_blocking(|| run_warp_cli(&["debug", "access-reauth"]))
.await
.map_err(|error| format!("Failed to run WARP command: {error}"))?
}
2 changes: 2 additions & 0 deletions desktop/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,8 @@ pub fn run() {
cancel_pairing,
apply_workspace,
get_active_workspace,
connect_warp_vpn,
refresh_warp_access,
set_prevent_sleep_active,
get_agent_memory,
])
Expand Down
2 changes: 0 additions & 2 deletions desktop/src/app/AppShell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ import { MainInsetProvider } from "@/shared/layout/MainInsetContext";
import { chromeCssVarDefaults } from "@/shared/layout/chromeLayout";
import { hasPrimaryShortcutModifier } from "@/shared/lib/platform";
import { useMessageDeepLinks } from "@/shared/useMessageDeepLinks";
import { ConnectionBanner } from "@/shared/ui/ConnectionBanner";
import { SidebarInset, SidebarProvider } from "@/shared/ui/sidebar";

type AppView =
Expand Down Expand Up @@ -941,7 +940,6 @@ export function AppShell() {
className="min-h-0 min-w-0 overflow-hidden"
style={chromeCssVarDefaults}
>
<ConnectionBanner />
<Outlet />
</SidebarInset>
</MainInsetProvider>
Expand Down
3 changes: 3 additions & 0 deletions desktop/src/features/onboarding/ui/OnboardingFlow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
profileQueryKey,
useUpdateProfileMutation,
} from "@/features/profile/hooks";
import { useWorkspaces } from "@/features/workspaces/useWorkspaces";
import { relayClient } from "@/shared/api/relayClient";
import { getMyRelayMembershipLookup } from "@/shared/api/relayMembers";
import { getIdentity, importIdentity } from "@/shared/api/tauri";
Expand Down Expand Up @@ -146,6 +147,7 @@ export function OnboardingFlow({
onBackToWorkspaceSetup,
}: OnboardingFlowProps) {
const { complete, skipForNow } = actions;
const { activeWorkspace } = useWorkspaces();
const queryClient = useQueryClient();
const savedProfile = resolveSavedProfile(initialProfile);
const profileUpdateMutation = useUpdateProfileMutation();
Expand Down Expand Up @@ -486,6 +488,7 @@ export function OnboardingFlow({
updateDisplayName: updateDisplayNameDraft,
}}
direction={transitionDirection}
relayUrl={activeWorkspace?.relayUrl}
state={profileStepState}
/>
) : currentPage === "key-import" ? (
Expand Down
Loading