Skip to content

Commit 7b6cc7f

Browse files
committed
Merge branch 'main' into beta
2 parents 7ead2f7 + 1b7b35b commit 7b6cc7f

88 files changed

Lines changed: 3701 additions & 1142 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,24 @@ You can use Ctrl+F to search for specific service version
66

77
## [Unreleased]
88

9-
## [1.0.1.44] - 2022-10-21 [HOTFIX]
10-
- Fix some read_to_end related bugs for error empty content
11-
- Fix operation can stuck due to some timeout problem
12-
- Fix status error caused by concurrent sync states and sync packages in ood-daemon service
13-
- Fix Sqlite concurrent write error in some cases
14-
15-
## [1.0.1.42] - 2022-10-21
16-
### Add
17-
- Add encryption and decryption to the crypto module of the cyfs stack
18-
### Changes
19-
- Increase the minimum rust version to 1.63
20-
- Refactor the logic of dsg-services
21-
- Optimize the uninstall logic of DecApp
22-
- Optimize download logic of Service and DecApp to reduce CPU usage
23-
- bdt performance improve
24-
- Improve the stability of master-slave OOD synchronization
25-
### Fix
26-
- Fix the mount path of data directory in DecApp Service sandbox.
9+
## [1.1.1.82] - 2023-04-15
10+
### Improvements:
11+
Optimize bdt uptime logic when no udp endpoint is available
12+
Protocol stack optimization guessing mime logic
13+
Protocol stack optimization and DecApp related caching logic
14+
Issue #156: AppManager optimizes the uninstall logic of DecApp
15+
Issue #165, #168: Optimization of AppManager's local repo logic
16+
Issue #170: Optimization of AppManager's state repair logic at startup
17+
Issue #196: The -overwrite parameter of ood-installer can control whether to overwrite the original system-config.toml file
18+
Issue #201: Optimize the hash detection logic of the protocol stack chunk reader
19+
20+
### Fixes:
21+
Issue #157: AppManager may not stop the timeout DecApp installation command correctly under Windows
22+
Fix the service execution problem of AppManager in docker mode.
23+
Fixed a status problem when AppManager reports decapp to ood-daemon.
24+
Fixed some problems related to NDN chunk.
25+
Bdt fixed multiple panic
26+
Issue #183, #186, #187: Fixed multiple panics in the protocol stack
27+
Issue #185: Use cyfs-async-h1 to replace the original async-h1 to avoid panic caused by invalid http header
28+
Issue #198: AppManager does not handle the timeout of install command correctly in docker mode.
29+
Fix: AppManager incorrectly set the App status when it received the Install command, resulting in the inability to retry the installation logic after reboot
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## [1.1.1.82] - 2023-04-15
2+
### Improvements:
3+
Optimize bdt uptime logic when no udp endpoint is available
4+
Protocol stack optimization guessing mime logic
5+
Protocol stack optimization and DecApp related caching logic
6+
Issue #156: AppManager optimizes the uninstall logic of DecApp
7+
Issue #165, #168: Optimization of AppManager's local repo logic
8+
Issue #170: Optimization of AppManager's state repair logic at startup
9+
Issue #196: The -overwrite parameter of ood-installer can control whether to overwrite the original system-config.toml file
10+
Issue #201: Optimize the hash detection logic of the protocol stack chunk reader
11+
12+
### Fixes:
13+
Issue #157: AppManager may not stop the timeout DecApp installation command correctly under Windows
14+
Fix the service execution problem of AppManager in docker mode.
15+
Fixed a status problem when AppManager reports decapp to ood-daemon.
16+
Fixed some problems related to NDN chunk.
17+
Bdt fixed multiple panic
18+
Issue #183, #186, #187: Fixed multiple panics in the protocol stack
19+
Issue #185: Use cyfs-async-h1 to replace the original async-h1 to avoid panic caused by invalid http header
20+
Issue #198: AppManager does not handle the timeout of install command correctly in docker mode.
21+
Fix: AppManager incorrectly set the App status when it received the Install command, resulting in the inability to retry the installation logic after reboot

src/Cargo.lock

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ members = [
5454
"./tools/cyfs-check",
5555
"./tools/sn-updater",
5656
"./tools/cyfs-backup-tool",
57+
"./tools/bdt-tool",
5758

5859
"./meta/browser-meta-spv",
5960
"./meta/cyfs-meta",

src/component/cyfs-backup/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ hmac = '0.12'
4545
base58 = '0.2.0'
4646
tide = "0.16"
4747
http-types = "2.12"
48+
surf = { version = '2.3', default-features = false, features = ['h1-client-rustls'] }
49+
futures = "0.3"
4850

4951
[dev-dependencies]
5052
rand = "0.8"
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
use cyfs_base::*;
2+
3+
use http_types::Url;
4+
use serde::{Deserialize, Serialize};
5+
6+
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
7+
pub struct RemoteArchiveUrl {
8+
pub base_url: String,
9+
pub file_name: Option<String>,
10+
pub query_string: Option<String>,
11+
}
12+
13+
impl RemoteArchiveUrl {
14+
pub fn parse_url(&self) -> BuckyResult<Url> {
15+
let url = match &self.file_name {
16+
Some(file_name) => {
17+
format!("{}/{}", self.base_url.trim_end_matches('/'), file_name)
18+
}
19+
None => self.base_url.clone(),
20+
};
21+
22+
let mut url = Url::parse(&url).map_err(|e| {
23+
let msg = format!(
24+
"invalid remote archive url format! {}, {}",
25+
self.base_url, e
26+
);
27+
error!("{}", msg);
28+
BuckyError::new(BuckyErrorCode::InvalidFormat, msg)
29+
})?;
30+
31+
if let Some(query) = &self.query_string {
32+
url.set_query(Some(query.as_str()));
33+
}
34+
35+
Ok(url)
36+
}
37+
}
38+
39+
#[derive(Clone, Debug, Serialize, Deserialize)]
40+
pub enum RemoteArchiveInfo {
41+
ZipFile(RemoteArchiveUrl),
42+
Folder(RemoteArchiveUrl),
43+
}
44+
45+
impl RemoteArchiveInfo {
46+
// Supports URLs in two formats
47+
// {base_url}?{query_string}
48+
// {base_url}/${filename}?{query_string}
49+
pub fn parse(url: &str) -> BuckyResult<Self> {
50+
let (base_url, query_string) = match url.split_once("?") {
51+
Some((base_url, query_string)) => (base_url.to_owned(), Some(query_string.to_owned())),
52+
None => (url.to_owned(), None),
53+
};
54+
55+
let ret = match base_url.find("${filename}") {
56+
Some(_) => {
57+
let base_url = base_url.replace("${filename}", "");
58+
59+
let info = RemoteArchiveUrl {
60+
base_url,
61+
file_name: None,
62+
query_string,
63+
};
64+
RemoteArchiveInfo::Folder(info)
65+
}
66+
None => {
67+
let info = RemoteArchiveUrl {
68+
base_url,
69+
file_name: None,
70+
query_string,
71+
};
72+
RemoteArchiveInfo::ZipFile(info)
73+
}
74+
};
75+
76+
Ok(ret)
77+
}
78+
}
79+
80+
#[cfg(test)]
81+
mod test {
82+
use super::RemoteArchiveInfo;
83+
84+
#[test]
85+
fn test_url() {
86+
let url = "http://127.0.0.1:1234/a/b?token=123456";
87+
let info = RemoteArchiveInfo::parse(url).unwrap();
88+
if let RemoteArchiveInfo::ZipFile(info) = info {
89+
assert_eq!(info.base_url, "http://127.0.0.1:1234/a/b");
90+
assert_eq!(info.query_string.as_deref(), Some("token=123456"));
91+
} else {
92+
unreachable!();
93+
}
94+
95+
let url = "http://127.0.0.1:1234/a/b";
96+
let info = RemoteArchiveInfo::parse(url).unwrap();
97+
if let RemoteArchiveInfo::ZipFile(info) = info {
98+
assert_eq!(info.base_url, "http://127.0.0.1:1234/a/b");
99+
assert_eq!(info.query_string, None);
100+
} else {
101+
unreachable!();
102+
}
103+
104+
let url = "http://127.0.0.1:1234/a/b/${filename}?token=123456";
105+
let info = RemoteArchiveInfo::parse(url).unwrap();
106+
if let RemoteArchiveInfo::Folder(info) = info {
107+
assert_eq!(info.base_url, "http://127.0.0.1:1234/a/b/");
108+
assert_eq!(info.query_string.as_deref(), Some("token=123456"));
109+
} else {
110+
unreachable!();
111+
}
112+
113+
let url = "http://127.0.0.1:1234/a/b/${filename}";
114+
let info = RemoteArchiveInfo::parse(url).unwrap();
115+
if let RemoteArchiveInfo::Folder(info) = info {
116+
assert_eq!(info.base_url, "http://127.0.0.1:1234/a/b/");
117+
assert_eq!(info.query_string, None);
118+
} else {
119+
unreachable!();
120+
}
121+
}
122+
}

0 commit comments

Comments
 (0)