-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #696 from yyk808/main
[zed integration]: fix warnings, improve user interface
- Loading branch information
Showing
24 changed files
with
2,906 additions
and
14 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
scripts/zed-intergration/patches/0001-add-new-module-mega-and-mega_panel.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 006bd0e01b5deba6792af824a5a73c32e96efa2c Mon Sep 17 00:00:00 2001 | ||
From: Neon <[email protected]> | ||
Date: Sat, 19 Oct 2024 21:24:00 +0800 | ||
Subject: [PATCH 01/14] add new module mega and mega_panel | ||
Subject: [PATCH 01/24] add new module mega and mega_panel | ||
|
||
--- | ||
Cargo.lock | 23 ++++++ | ||
|
2 changes: 1 addition & 1 deletion
2
scripts/zed-intergration/patches/0002-mega-integrate-basic-panel-code-with-zed.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From afca3aee776df6674d0c6d17858d944c64ec56ae Mon Sep 17 00:00:00 2001 | ||
From: Neon <[email protected]> | ||
Date: Mon, 21 Oct 2024 09:18:40 +0800 | ||
Subject: [PATCH 02/14] mega: integrate basic panel code with zed | ||
Subject: [PATCH 02/24] mega: integrate basic panel code with zed | ||
|
||
--- | ||
Cargo.lock | 7 +- | ||
|
2 changes: 1 addition & 1 deletion
2
scripts/zed-intergration/patches/0003-add-mega-panel-trait-implementation.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From a6636b00e11cfa284e2e152cb2ac0a6d92508a34 Mon Sep 17 00:00:00 2001 | ||
From: Neon <[email protected]> | ||
Date: Mon, 21 Oct 2024 09:33:24 +0800 | ||
Subject: [PATCH 03/14] add: mega `panel` trait implementation | ||
Subject: [PATCH 03/24] add: mega `panel` trait implementation | ||
|
||
--- | ||
Cargo.lock | 1 + | ||
|
2 changes: 1 addition & 1 deletion
2
scripts/zed-intergration/patches/0004-fix-make-mega_panel-runnable.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 5e676b9b1669d078a25bcee9a0d1b87743862a30 Mon Sep 17 00:00:00 2001 | ||
From: Neon <[email protected]> | ||
Date: Mon, 21 Oct 2024 10:00:36 +0800 | ||
Subject: [PATCH 04/14] fix: make mega_panel runnable | ||
Subject: [PATCH 04/24] fix: make mega_panel runnable | ||
|
||
--- | ||
assets/settings/default.json | 8 ++++++++ | ||
|
2 changes: 1 addition & 1 deletion
2
scripts/zed-intergration/patches/0005-mega_panel-very-basic-info-render-support.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From e04d4b01af7991ed4b40fcd9553f20e67f2ec53f Mon Sep 17 00:00:00 2001 | ||
From: Neon <[email protected]> | ||
Date: Tue, 22 Oct 2024 16:15:01 +0800 | ||
Subject: [PATCH 05/14] mega_panel: very basic info render support | ||
Subject: [PATCH 05/24] mega_panel: very basic info render support | ||
|
||
--- | ||
Cargo.lock | 4 +- | ||
|
2 changes: 1 addition & 1 deletion
2
scripts/zed-intergration/patches/0006-mega-basic-rest-api-support.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 8b57a9f693c95e92ee5299ff30b6cd791c08da71 Mon Sep 17 00:00:00 2001 | ||
From: Neon <[email protected]> | ||
Date: Tue, 22 Oct 2024 19:12:08 +0800 | ||
Subject: [PATCH 06/14] mega: basic rest api support | ||
Subject: [PATCH 06/24] mega: basic rest api support | ||
|
||
--- | ||
Cargo.lock | 1 + | ||
|
2 changes: 1 addition & 1 deletion
2
scripts/zed-intergration/patches/0007-mega_panel-control-pad-and-information-display.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 0ae6bfb40025aca376878982579a322eaa231143 Mon Sep 17 00:00:00 2001 | ||
From: Neon <[email protected]> | ||
Date: Sat, 26 Oct 2024 22:02:19 +0800 | ||
Subject: [PATCH 07/14] mega_panel: control pad and information display | ||
Subject: [PATCH 07/24] mega_panel: control pad and information display | ||
|
||
--- | ||
crates/mega/src/mega.rs | 56 ++++++++--- | ||
|
2 changes: 1 addition & 1 deletion
2
scripts/zed-intergration/patches/0008-mega-feat-toggle-fuse-mount.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 8f8d3a30a45fa4f3b2359060d63a51f065c327d9 Mon Sep 17 00:00:00 2001 | ||
From: Neon <[email protected]> | ||
Date: Tue, 29 Oct 2024 18:50:39 +0800 | ||
Subject: [PATCH 08/14] mega: feat toggle fuse mount | ||
Subject: [PATCH 08/24] mega: feat toggle fuse mount | ||
|
||
--- | ||
Cargo.lock | 6 +- | ||
|
2 changes: 1 addition & 1 deletion
2
scripts/zed-intergration/patches/0009-Fix-dont-restore-previous-workspace.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 69f92bb2dbb1b2facf7b60cb6c6e1c0d211c4f4d Mon Sep 17 00:00:00 2001 | ||
From: Neon <[email protected]> | ||
Date: Tue, 29 Oct 2024 21:08:56 +0800 | ||
Subject: [PATCH 09/14] Fix: dont restore previous workspace | ||
Subject: [PATCH 09/24] Fix: dont restore previous workspace | ||
|
||
--- | ||
crates/project/src/project.rs | 106 ++++++++++++++++++++++ | ||
|
2 changes: 1 addition & 1 deletion
2
scripts/zed-intergration/patches/0010-Fix-checkout-in-project_panel.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From f2551513e804e8f43f6fac39d58befffd9dcda39 Mon Sep 17 00:00:00 2001 | ||
From: Neon <[email protected]> | ||
Date: Wed, 30 Oct 2024 10:53:59 +0800 | ||
Subject: [PATCH 10/14] Fix checkout in project_panel | ||
Subject: [PATCH 10/24] Fix checkout in project_panel | ||
|
||
--- | ||
crates/mega/src/mega.rs | 18 +++++++++- | ||
|
2 changes: 1 addition & 1 deletion
2
scripts/zed-intergration/patches/0011-Add-basic-mega-rest-api-support.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From a880b2c68d47990c8229656313b9dbeb1000b87c Mon Sep 17 00:00:00 2001 | ||
From: Neon <[email protected]> | ||
Date: Sun, 10 Nov 2024 22:19:15 +0800 | ||
Subject: [PATCH 11/14] Add basic mega rest api support | ||
Subject: [PATCH 11/24] Add basic mega rest api support | ||
|
||
--- | ||
Cargo.lock | 30 +++ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 3c45fed1fd917dac0051917d7d9685371f35cd60 Mon Sep 17 00:00:00 2001 | ||
From: Neon <[email protected]> | ||
Date: Tue, 12 Nov 2024 16:56:00 +0800 | ||
Subject: [PATCH 12/14] fix api call logic | ||
Subject: [PATCH 12/24] fix api call logic | ||
|
||
--- | ||
Cargo.lock | 54 +++--- | ||
|
2 changes: 1 addition & 1 deletion
2
scripts/zed-intergration/patches/0013-fix-features-wrongly-opened.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 42916a9fae734c3a0b3dcc8d90f77669378a20c2 Mon Sep 17 00:00:00 2001 | ||
From: Neon <[email protected]> | ||
Date: Tue, 12 Nov 2024 17:55:27 +0800 | ||
Subject: [PATCH 13/14] fix features wrongly opened | ||
Subject: [PATCH 13/24] fix features wrongly opened | ||
|
||
--- | ||
crates/mega_panel/Cargo.toml | 8 ++++++-- | ||
|
2 changes: 1 addition & 1 deletion
2
scripts/zed-intergration/patches/0014-fix-checkout-in-context-menu.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 14806e63bfc717cd17f933fb1aecd6cded410497 Mon Sep 17 00:00:00 2001 | ||
From: Neon <[email protected]> | ||
Date: Tue, 12 Nov 2024 19:12:29 +0800 | ||
Subject: [PATCH 14/14] fix checkout in context menu | ||
Subject: [PATCH 14/24] fix checkout in context menu | ||
|
||
--- | ||
crates/mega/src/mega.rs | 47 ++++++----------------- | ||
|
221 changes: 221 additions & 0 deletions
221
scripts/zed-intergration/patches/0015-fix-reading-mega-settings.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,221 @@ | ||
From 1f25b260f410733580a628a4d116a4d4cfbbc286 Mon Sep 17 00:00:00 2001 | ||
From: Neon <[email protected]> | ||
Date: Sun, 17 Nov 2024 11:59:31 +0800 | ||
Subject: [PATCH 15/24] fix reading mega settings | ||
|
||
--- | ||
crates/mega/src/mega.rs | 46 +++++++++++++++++++++----------- | ||
crates/mega/src/mega_settings.rs | 10 +++---- | ||
2 files changed, 36 insertions(+), 20 deletions(-) | ||
|
||
diff --git a/crates/mega/src/mega.rs b/crates/mega/src/mega.rs | ||
index 41f89a7c1d..b33c487662 100644 | ||
--- a/crates/mega/src/mega.rs | ||
+++ b/crates/mega/src/mega.rs | ||
@@ -26,9 +26,11 @@ use serde::Serialize; | ||
use settings::Settings; | ||
use std::collections::{BTreeMap, BTreeSet, HashSet}; | ||
use std::ffi::OsStr; | ||
+use std::fmt::{Debug, Formatter}; | ||
use std::hash::{DefaultHasher, Hash, Hasher}; | ||
use std::io::Read; | ||
use std::path::PathBuf; | ||
+use std::process::Command; | ||
use std::sync::{Arc, RwLock}; | ||
|
||
mod api; | ||
@@ -49,7 +51,10 @@ struct CheckoutState { | ||
path: PathBuf, | ||
mounted: bool, | ||
} | ||
+ | ||
pub struct Mega { | ||
+ fuse_executable: PathBuf, | ||
+ | ||
fuse_running: bool, | ||
fuse_mounted: bool, | ||
|
||
@@ -65,6 +70,17 @@ pub struct MegaFuse {} | ||
|
||
impl EventEmitter<Event> for Mega {} | ||
|
||
+impl Debug for Mega { | ||
+ fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { | ||
+ write!(f, | ||
+ "fuse_executable: {:?}, mega_url: {}, fuse_url: {}", | ||
+ self.fuse_executable, | ||
+ self.mega_url, | ||
+ self.fuse_url | ||
+ ) | ||
+ } | ||
+} | ||
+ | ||
impl Mega { | ||
pub fn init_settings(cx: &mut AppContext) { | ||
MegaSettings::register(cx); | ||
@@ -75,9 +91,10 @@ impl Mega { | ||
} | ||
|
||
pub fn new(cx: &mut AppContext) -> Self { | ||
- let mount_path = PathBuf::from(MegaSettings::get_global(cx).mount_point.clone()); | ||
+ let mount_path = MegaSettings::get_global(cx).mount_point.clone(); | ||
let mega_url = MegaSettings::get_global(cx).mega_url.clone(); | ||
let fuse_url = MegaSettings::get_global(cx).fuse_url.clone(); | ||
+ let fuse_executable = MegaSettings::get_global(cx).fuse_executable.clone(); | ||
|
||
// To not affected by global proxy settings. | ||
let client = ReqwestClient::new(); | ||
@@ -88,7 +105,9 @@ impl Mega { | ||
None | ||
}; | ||
|
||
- Mega { | ||
+ let mega = Mega { | ||
+ fuse_executable, | ||
+ | ||
fuse_running: false, | ||
fuse_mounted: false, | ||
|
||
@@ -98,7 +117,10 @@ impl Mega { | ||
mega_url, | ||
fuse_url, | ||
http_client: Arc::new(client), | ||
- } | ||
+ }; | ||
+ println!("Mega New: {mega:?}"); | ||
+ | ||
+ mega | ||
} | ||
|
||
pub fn update_status(&mut self, cx: &mut ModelContext<Self>) { | ||
@@ -168,8 +190,7 @@ impl Mega { | ||
let path = PathBuf::from(p); // FIXME is there a better way? | ||
cx.spawn(|mega, mut cx| async move { | ||
let recv = mega.update(&mut cx, |this, cx| { | ||
- let param = PathBuf::from(path); | ||
- this.checkout_path(cx, param) | ||
+ this.checkout_path(cx, path) | ||
}).expect("mega delegate not be dropped"); | ||
|
||
if let Ok(Some(resp)) = recv.await { | ||
@@ -227,7 +248,6 @@ impl Mega { | ||
let (tx, rx) = oneshot::channel(); | ||
let client = self.http_client.clone(); | ||
let uri = format!( | ||
- // FIXME: settings not work, currently | ||
"{base}/api/fs/mount", | ||
base = self.fuse_url | ||
); | ||
@@ -240,7 +260,7 @@ impl Mega { | ||
cx.spawn(|_this, _cx| async move { | ||
if let Ok(mut resp) = client | ||
.post_json( | ||
- "http://127.0.0.1:2725/api/fs/mount", | ||
+ uri.as_str(), | ||
AsyncBody::from(body), | ||
) | ||
.await | ||
@@ -277,7 +297,6 @@ impl Mega { | ||
let (tx, rx) = oneshot::channel(); | ||
let client = self.http_client.clone(); | ||
let uri = format!( | ||
- // FIXME: settings not work, currently | ||
"{base}/api/fs/umount", | ||
base = self.fuse_url | ||
); | ||
@@ -293,7 +312,7 @@ impl Mega { | ||
cx.spawn(|_this, _cx| async move { | ||
if let Ok(mut resp) = client | ||
.post_json( | ||
- "http://127.0.0.1:2725/api/fs/umount", | ||
+ uri.as_str(), | ||
AsyncBody::from(body), | ||
) | ||
.await | ||
@@ -321,7 +340,6 @@ impl Mega { | ||
let (tx, rx) = oneshot::channel(); | ||
let client = self.http_client.clone(); | ||
let uri = format!( | ||
- // FIXME: settings not work, currently | ||
"{base}/api/fs/mpoint", | ||
base = self.fuse_url | ||
); | ||
@@ -329,7 +347,7 @@ impl Mega { | ||
cx.spawn(|_this, _cx| async move { | ||
if let Ok(mut resp) = client | ||
.get( | ||
- "http://127.0.0.1:2725/api/fs/mpoint", | ||
+ uri.as_str(), | ||
AsyncBody::empty(), | ||
false, | ||
) | ||
@@ -358,7 +376,6 @@ impl Mega { | ||
let (tx, rx) = oneshot::channel(); | ||
let client = self.http_client.clone(); | ||
let uri = format!( | ||
- // FIXME: settings not work, currently | ||
"{base}/api/config", | ||
base = self.fuse_url | ||
); | ||
@@ -366,7 +383,7 @@ impl Mega { | ||
cx.spawn(|_this, _cx| async move { | ||
if let Ok(mut resp) = client | ||
.get( | ||
- "http://127.0.0.1:2725/api/config", | ||
+ uri.as_str(), | ||
AsyncBody::empty(), | ||
false, | ||
) | ||
@@ -395,7 +412,6 @@ impl Mega { | ||
let (tx, rx) = oneshot::channel(); | ||
let client = self.http_client.clone(); | ||
let uri = format!( | ||
- // FIXME: settings not work, currently | ||
"{base}/api/config", | ||
base = self.fuse_url | ||
); | ||
@@ -409,7 +425,7 @@ impl Mega { | ||
|
||
cx.spawn(|_this, _cx| async move { | ||
if let Ok(mut resp) = client | ||
- .post_json("http://127.0.0.1:2725/api/config", config.into()) | ||
+ .post_json(uri.as_str(), config.into()) | ||
.await | ||
{ | ||
if resp.status().is_success() { | ||
diff --git a/crates/mega/src/mega_settings.rs b/crates/mega/src/mega_settings.rs | ||
index 82721208a1..bada5ccd80 100644 | ||
--- a/crates/mega/src/mega_settings.rs | ||
+++ b/crates/mega/src/mega_settings.rs | ||
@@ -17,23 +17,23 @@ pub struct MegaSettingsContent { | ||
/// Url to communicate with mega | ||
/// | ||
/// Default: http://localhost:8000 | ||
- pub mega_url: String, | ||
+ pub mega_url: Option<String>, | ||
/// Url to communicate with fuse | ||
/// | ||
/// Default: http://localhost:2725 | ||
- pub fuse_url: String, | ||
+ pub fuse_url: Option<String>, | ||
/// Default mount point for fuse | ||
/// | ||
/// Default: "/" (for now) | ||
- pub mount_point: PathBuf, | ||
+ pub mount_point: Option<PathBuf>, | ||
/// Path for mega executable | ||
/// | ||
/// Default: "mega" (for now) | ||
- pub mega_executable: PathBuf, | ||
+ pub mega_executable: Option<PathBuf>, | ||
/// Path for fuse executable | ||
/// | ||
/// Default: "scorpio" (for now) | ||
- pub fuse_executable: PathBuf, | ||
+ pub fuse_executable: Option<PathBuf>, | ||
} | ||
|
||
impl Settings for MegaSettings { | ||
-- | ||
2.43.0 | ||
|
Oops, something went wrong.
ef90667
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
mega – ./
mega-gitmono.vercel.app
mega-git-main-gitmono.vercel.app
www.gitmega.dev
gitmega.dev