Skip to content

Commit 2c2a077

Browse files
authored
Fix/desktop oauth connect opener (#270)
* fix(desktop): open OAuth URLs via the opener plugin (fixes dead connect buttons)
1 parent 634cd8c commit 2c2a077

34 files changed

Lines changed: 1815 additions & 52 deletions

‎desktop/app/src-tauri/Cargo.lock‎

Lines changed: 439 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎desktop/app/src-tauri/Cargo.toml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "orcabot-desktop"
3-
version = "0.8.0"
3+
version = "0.9.1"
44
edition = "2021"
55
description = "Orcabot Desktop shell"
66
license = "UNLICENSED"
@@ -43,6 +43,7 @@ ratatui = "0.29"
4343
tungstenite = { version = "0.21", default-features = false, features = ["handshake"] }
4444
# VT/ANSI parser to render PTY output (agents draw full-screen TUIs).
4545
vt100 = "0.15"
46+
tauri-plugin-opener = "2.5.4"
4647

4748
[dev-dependencies]
4849
# Used by the vm/image.rs unit tests (was referenced but never declared).

‎desktop/app/src-tauri/build.rs‎

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,35 @@
11
fn main() {
2-
tauri_build::build()
2+
// The packaged frontend is a REMOTE-origin webview (http://localhost:8788), and
3+
// Tauri v2's ACL rejects custom app commands from remote origins unless they're
4+
// explicitly granted in a capability. Declaring the commands here generates the
5+
// `allow-<command>` permissions that capabilities/default.json references, so the
6+
// frontend can invoke sign-in / workspace / cloud commands (not just the opener
7+
// plugin). Keep this list in sync with the `generate_handler!` list in main.rs.
8+
tauri_build::try_build(
9+
tauri_build::Attributes::new().app_manifest(
10+
tauri_build::AppManifest::new().commands(&[
11+
"get_workspace_path",
12+
"import_folder",
13+
"switch_to_cli",
14+
"quit_app",
15+
"get_surface_token",
16+
"open_url",
17+
"reveal_workspace",
18+
"get_ports",
19+
"get_app_version",
20+
"read_startup_log",
21+
"verify_orcabot_account",
22+
"set_cloud_credential",
23+
"sign_in_google_loopback",
24+
"cancel_google_sign_in",
25+
"rollback_sign_in",
26+
"get_cloud_account",
27+
"clear_cloud_credential",
28+
"list_cloud_dashboards",
29+
"get_cloud_dashboard",
30+
"download_cloud_workspace",
31+
]),
32+
),
33+
)
34+
.expect("failed to run tauri build script");
335
}

‎desktop/app/src-tauri/capabilities/default.json‎

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,32 @@
88
"permissions": [
99
"core:default",
1010
"dialog:default",
11-
"dialog:allow-open"
11+
"dialog:allow-open",
12+
{
13+
"identifier": "opener:allow-open-url",
14+
"allow": [
15+
{ "url": "http://*" },
16+
{ "url": "https://*" }
17+
]
18+
},
19+
"allow-get-workspace-path",
20+
"allow-import-folder",
21+
"allow-switch-to-cli",
22+
"allow-quit-app",
23+
"allow-get-surface-token",
24+
"allow-reveal-workspace",
25+
"allow-get-ports",
26+
"allow-get-app-version",
27+
"allow-read-startup-log",
28+
"allow-verify-orcabot-account",
29+
"allow-set-cloud-credential",
30+
"allow-sign-in-google-loopback",
31+
"allow-cancel-google-sign-in",
32+
"allow-rollback-sign-in",
33+
"allow-get-cloud-account",
34+
"allow-clear-cloud-credential",
35+
"allow-list-cloud-dashboards",
36+
"allow-get-cloud-dashboard",
37+
"allow-download-cloud-workspace"
1238
]
1339
}

‎desktop/app/src-tauri/gen/schemas/acl-manifests.json‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"default":{"identifier":"default","description":"Default capabilities for the main window","remote":{"urls":["http://localhost:*"]},"local":true,"windows":["main"],"permissions":["core:default","dialog:default","dialog:allow-open"]}}
1+
{"default":{"identifier":"default","description":"Default capabilities for the main window","remote":{"urls":["http://localhost:*"]},"local":true,"windows":["main"],"permissions":["core:default","dialog:default","dialog:allow-open",{"identifier":"opener:allow-open-url","allow":[{"url":"http://*"},{"url":"https://*"}]},"allow-get-workspace-path","allow-import-folder","allow-switch-to-cli","allow-quit-app","allow-get-surface-token","allow-open-url","allow-reveal-workspace","allow-get-ports","allow-get-app-version","allow-read-startup-log","allow-verify-orcabot-account","allow-set-cloud-credential","allow-sign-in-google-loopback","allow-cancel-google-sign-in","allow-rollback-sign-in","allow-get-cloud-account","allow-clear-cloud-credential","allow-list-cloud-dashboards","allow-get-cloud-dashboard","allow-download-cloud-workspace"]}}

‎desktop/app/src-tauri/gen/schemas/desktop-schema.json‎

Lines changed: 473 additions & 0 deletions
Large diffs are not rendered by default.

‎desktop/app/src-tauri/gen/schemas/macOS-schema.json‎

Lines changed: 473 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Automatically generated - DO NOT EDIT!
2+
3+
[[permission]]
4+
identifier = "allow-cancel-google-sign-in"
5+
description = "Enables the cancel_google_sign_in command without any pre-configured scope."
6+
commands.allow = ["cancel_google_sign_in"]
7+
8+
[[permission]]
9+
identifier = "deny-cancel-google-sign-in"
10+
description = "Denies the cancel_google_sign_in command without any pre-configured scope."
11+
commands.deny = ["cancel_google_sign_in"]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Automatically generated - DO NOT EDIT!
2+
3+
[[permission]]
4+
identifier = "allow-clear-cloud-credential"
5+
description = "Enables the clear_cloud_credential command without any pre-configured scope."
6+
commands.allow = ["clear_cloud_credential"]
7+
8+
[[permission]]
9+
identifier = "deny-clear-cloud-credential"
10+
description = "Denies the clear_cloud_credential command without any pre-configured scope."
11+
commands.deny = ["clear_cloud_credential"]

0 commit comments

Comments
 (0)