Skip to content
Merged
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
20 changes: 16 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ toml = "0.8"
git2 = { version = "0.18", default-features = false, features = ["https", "vendored-libgit2"] }

# Terminal
portable-pty = "0.8"
portable-pty = "0.9.0"
vte = "0.15.0"

# Grep (search)
Expand All @@ -101,14 +101,16 @@ similar = "2.5"
urlencoding = "2.1"

# Tauri (desktop only)
tauri = { version = "2", features = ["unstable"] }
tauri = { git = "https://github.com/richerfu/tauri", branch = "feat/open-harmony", features = [] }
tauri-plugin-dialog = "2"
tauri-plugin-opener = "2"
tauri-plugin-dialog = "2.6"
tauri-plugin-fs = "2"
tauri-plugin-log = "2"
tauri-plugin-autostart = "2"
tauri-plugin-notification = "2"
tauri-build = { version = "2", features = [] }
tauri-build = { git = "https://github.com/richerfu/tauri", branch = "feat/open-harmony", features = [] }
napi-ohos = { version = "1.1" }
napi-derive-ohos = { version = "1.1" }

# Windows-specific dependencies
win32job = "2.0"
Expand Down Expand Up @@ -150,3 +152,13 @@ lto = false
codegen-units = 16
strip = false
incremental = true

[patch.crates-io]
wry = { git = "https://github.com/richerfu/wry"}
tao = { git = "https://github.com/richerfu/tao", branch = "feat-ohos-webview"}
openharmony-ability = {git = "https://github.com/harmony-contrib/openharmony-ability.git"}
openharmony-ability-derive = {git = "https://github.com/harmony-contrib/openharmony-ability.git"}
tauri = { git = "https://github.com/richerfu/tauri", branch = "feat/open-harmony"}
tauri-runtime = { git = "https://github.com/richerfu/tauri", branch = "feat/open-harmony"}
tauri-macros = { git = "https://github.com/richerfu/tauri", branch = "feat/open-harmony"}
tauri-runtime-wry = { git = "https://github.com/richerfu/tauri", branch = "feat/open-harmony"}
10 changes: 3 additions & 7 deletions src/apps/desktop/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ tauri-plugin-opener = { workspace = true }
tauri-plugin-dialog = { workspace = true }
tauri-plugin-fs = { workspace = true }
tauri-plugin-log = { workspace = true }
tauri-plugin-autostart = { workspace = true }
tauri-plugin-notification = { workspace = true }
napi-ohos = { workspace = true }
napi-derive-ohos = { workspace = true }

# Inherited from workspace
tokio = { workspace = true }
Expand All @@ -41,7 +41,6 @@ log = { workspace = true }
chrono = { workspace = true }
regex = { workspace = true }
dirs = { workspace = true }
dark-light = { workspace = true }
similar = { workspace = true }
ignore = { workspace = true }
urlencoding = { workspace = true }
Expand All @@ -50,8 +49,6 @@ thiserror = "1.0"
futures = { workspace = true }
async-trait = { workspace = true }
sha1 = { workspace = true }
screenshots = "0.8"
enigo = "0.2"
image = { version = "0.24", default-features = false, features = ["png", "jpeg"] }
resvg = { version = "0.47.0", default-features = false }

Expand Down Expand Up @@ -79,6 +76,5 @@ windows = { version = "0.61.3", features = [
] }
windows-core = "0.61.2"

[target.'cfg(target_os = "linux")'.dependencies]
atspi = "0.29"
[target.'cfg(all(target_os = "linux", not(target_env = "ohos")))'.dependencies]
leptess = "0.14.0"
13 changes: 0 additions & 13 deletions src/apps/desktop/capabilities/browser-webview.json

This file was deleted.

215 changes: 107 additions & 108 deletions src/apps/desktop/capabilities/default.json
Original file line number Diff line number Diff line change
@@ -1,109 +1,108 @@
{
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
"description": "BitFun default capabilities",
"windows": ["main"],
"permissions": [
"log:default",
"autostart:default",
"core:default",
"core:path:default",
"core:event:default",
"core:event:allow-listen",
"core:event:allow-emit",
"core:window:default",
"core:webview:default",
"core:webview:allow-create-webview",
"core:webview:allow-set-webview-position",
"core:webview:allow-set-webview-size",
"core:webview:allow-set-webview-focus",
"core:webview:allow-reparent",
"core:webview:allow-webview-show",
"core:webview:allow-webview-hide",
"core:webview:allow-webview-close",
"core:window:allow-create",
"core:window:allow-set-focus",
"core:window:allow-set-always-on-top",
"core:window:allow-set-position",
"core:window:allow-set-size",
"core:window:allow-set-decorations",
"core:window:allow-set-title-bar-style",
"core:window:allow-set-skip-taskbar",
"core:window:allow-set-resizable",
"core:window:allow-current-monitor",
"core:window:allow-outer-position",
"core:window:allow-outer-size",
"core:window:allow-is-maximized",
"core:window:allow-center",
"core:window:allow-close",
"core:window:allow-hide",
"core:window:allow-maximize",
"core:window:allow-minimize",
"core:window:allow-show",
"core:window:allow-start-dragging",
"core:window:allow-unmaximize",
"core:window:allow-unminimize",
"core:window:allow-set-min-size",
"dialog:default",
"dialog:allow-open",
"dialog:allow-save",
"dialog:allow-ask",
"dialog:allow-confirm",
"dialog:allow-message",
"opener:default",
"opener:allow-open-url",
{
"identifier": "opener:allow-open-path",
"allow": [
{ "path": "$APPDATA/**" },
{ "path": "$HOME/**" }
]
},
"opener:allow-reveal-item-in-dir",
"fs:default",
"fs:allow-read-file",
"fs:allow-write-file",
"fs:allow-read-dir",
"fs:allow-copy-file",
"fs:allow-create",
"fs:allow-mkdir",
"fs:allow-remove",
"fs:allow-rename",
"fs:allow-exists",
"fs:allow-read-text-file",
"fs:allow-write-text-file",
"fs:allow-stat",
"fs:allow-lstat",
"fs:allow-fstat",
"fs:allow-truncate",
"fs:allow-ftruncate",
"fs:allow-open",
"fs:allow-read",
"fs:allow-write",
"fs:allow-seek",
"fs:allow-unwatch",
"fs:allow-watch",
"fs:read-all",
"fs:write-all",
"fs:scope-app-recursive",
{
"identifier": "fs:allow-home-read-recursive",
"allow": [
{ "path": "$HOME/**" }
]
},
{
"identifier": "fs:allow-home-write-recursive",
"allow": [
{ "path": "$HOME/**" }
]
},
"notification:default",
"notification:allow-notify",
"notification:allow-show",
"notification:allow-request-permission",
"notification:allow-check-permissions",
"notification:allow-permission-state",
"notification:allow-is-permission-granted"
]
}
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
"description": "BitFun default capabilities",
"windows": ["main"],
"permissions": [
"log:default",
"core:default",
"core:path:default",
"core:event:default",
"core:event:allow-listen",
"core:event:allow-emit",
"core:window:default",
"core:webview:default",
"core:webview:allow-create-webview",
"core:webview:allow-set-webview-position",
"core:webview:allow-set-webview-size",
"core:webview:allow-set-webview-focus",
"core:webview:allow-reparent",
"core:webview:allow-webview-show",
"core:webview:allow-webview-hide",
"core:webview:allow-webview-close",
"core:window:allow-create",
"core:window:allow-set-focus",
"core:window:allow-set-always-on-top",
"core:window:allow-set-position",
"core:window:allow-set-size",
"core:window:allow-set-decorations",
"core:window:allow-set-title-bar-style",
"core:window:allow-set-skip-taskbar",
"core:window:allow-set-resizable",
"core:window:allow-current-monitor",
"core:window:allow-outer-position",
"core:window:allow-outer-size",
"core:window:allow-is-maximized",
"core:window:allow-center",
"core:window:allow-close",
"core:window:allow-hide",
"core:window:allow-maximize",
"core:window:allow-minimize",
"core:window:allow-show",
"core:window:allow-start-dragging",
"core:window:allow-unmaximize",
"core:window:allow-unminimize",
"core:window:allow-set-min-size",
"dialog:default",
"dialog:allow-open",
"dialog:allow-save",
"dialog:allow-ask",
"dialog:allow-confirm",
"dialog:allow-message",
"opener:default",
"opener:allow-open-url",
{
"identifier": "opener:allow-open-path",
"allow": [
{ "path": "$APPDATA/**" },
{ "path": "$HOME/**" }
]
},
"opener:allow-reveal-item-in-dir",
"fs:default",
"fs:allow-read-file",
"fs:allow-write-file",
"fs:allow-read-dir",
"fs:allow-copy-file",
"fs:allow-create",
"fs:allow-mkdir",
"fs:allow-remove",
"fs:allow-rename",
"fs:allow-exists",
"fs:allow-read-text-file",
"fs:allow-write-text-file",
"fs:allow-stat",
"fs:allow-lstat",
"fs:allow-fstat",
"fs:allow-truncate",
"fs:allow-ftruncate",
"fs:allow-open",
"fs:allow-read",
"fs:allow-write",
"fs:allow-seek",
"fs:allow-unwatch",
"fs:allow-watch",
"fs:read-all",
"fs:write-all",
"fs:scope-app-recursive",
{
"identifier": "fs:allow-home-read-recursive",
"allow": [
{ "path": "$HOME/**" }
]
},
{
"identifier": "fs:allow-home-write-recursive",
"allow": [
{ "path": "$HOME/**" }
]
},
"notification:default",
"notification:allow-notify",
"notification:allow-show",
"notification:allow-request-permission",
"notification:allow-check-permissions",
"notification:allow-permission-state",
"notification:allow-is-permission-granted"
]
}
20 changes: 2 additions & 18 deletions src/apps/desktop/src/api/browser_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,7 @@ pub async fn browser_webview_eval(
app: tauri::AppHandle,
request: WebviewEvalRequest,
) -> Result<(), String> {
let webview = app
.get_webview(&request.label)
.ok_or_else(|| format!("Webview not found: {}", request.label))?;

webview
.eval(&request.script)
.map_err(|e| format!("eval failed: {e}"))
Err("Webview not found".to_string())
}

#[derive(Debug, Deserialize)]
Expand All @@ -45,15 +39,5 @@ pub async fn browser_get_url(
app: tauri::AppHandle,
request: WebviewLabelRequest,
) -> Result<String, String> {
let webview = app
.get_webview(&request.label)
.ok_or_else(|| format!("Webview not found: {}", request.label))?;

let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| webview.url()));

match result {
Ok(Ok(url)) => Ok(url.to_string()),
Ok(Err(e)) => Err(format!("url failed: {e}")),
Err(_) => Err("url unavailable (webview URL is nil)".to_string()),
}
Err("Url is unavailable (webview URL is nil)".to_string())
}
2 changes: 1 addition & 1 deletion src/apps/desktop/src/api/remote_connect_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn set_mobile_web_resource_path(path: PathBuf) {
/// and restore any previously paired bot connections. Without this, bots
/// only start listening after the user first opens the Remote Connect dialog.
pub fn init_on_startup() {
tokio::spawn(async {
tauri::async_runtime::spawn(async {
if let Err(e) = ensure_service().await {
log::warn!("Remote connect startup init failed: {e}");
}
Expand Down
8 changes: 1 addition & 7 deletions src/apps/desktop/src/api/system_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,5 @@ pub async fn send_system_notification(
app: tauri::AppHandle,
request: SendNotificationRequest,
) -> Result<(), String> {
use tauri_plugin_notification::NotificationExt;

let mut builder = app.notification().builder().title(&request.title);
if let Some(body) = &request.body {
builder = builder.body(body);
}
builder.show().map_err(|e| e.to_string())
Err("No notification provided".to_string())
}
2 changes: 1 addition & 1 deletion src/apps/desktop/src/api/terminal_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ pub async fn terminal_get_history(
}

pub fn start_terminal_event_loop(terminal_state: TerminalState, app_handle: AppHandle) {
tokio::spawn(async move {
tauri::async_runtime::spawn(async move {
let api = match terminal_state.get_or_init_api().await {
Ok(api) => api,
Err(e) => {
Expand Down
Loading
Loading