Skip to content

Commit

Permalink
Merge branch 'main' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
weiqiushi committed May 4, 2023
2 parents 7ead2f7 + 1b7b35b commit 7b6cc7f
Show file tree
Hide file tree
Showing 88 changed files with 3,701 additions and 1,142 deletions.
39 changes: 21 additions & 18 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,24 @@ You can use Ctrl+F to search for specific service version

## [Unreleased]

## [1.0.1.44] - 2022-10-21 [HOTFIX]
- Fix some read_to_end related bugs for error empty content
- Fix operation can stuck due to some timeout problem
- Fix status error caused by concurrent sync states and sync packages in ood-daemon service
- Fix Sqlite concurrent write error in some cases

## [1.0.1.42] - 2022-10-21
### Add
- Add encryption and decryption to the crypto module of the cyfs stack
### Changes
- Increase the minimum rust version to 1.63
- Refactor the logic of dsg-services
- Optimize the uninstall logic of DecApp
- Optimize download logic of Service and DecApp to reduce CPU usage
- bdt performance improve
- Improve the stability of master-slave OOD synchronization
### Fix
- Fix the mount path of data directory in DecApp Service sandbox.
## [1.1.1.82] - 2023-04-15
### Improvements:
Optimize bdt uptime logic when no udp endpoint is available
Protocol stack optimization guessing mime logic
Protocol stack optimization and DecApp related caching logic
Issue #156: AppManager optimizes the uninstall logic of DecApp
Issue #165, #168: Optimization of AppManager's local repo logic
Issue #170: Optimization of AppManager's state repair logic at startup
Issue #196: The -overwrite parameter of ood-installer can control whether to overwrite the original system-config.toml file
Issue #201: Optimize the hash detection logic of the protocol stack chunk reader

### Fixes:
Issue #157: AppManager may not stop the timeout DecApp installation command correctly under Windows
Fix the service execution problem of AppManager in docker mode.
Fixed a status problem when AppManager reports decapp to ood-daemon.
Fixed some problems related to NDN chunk.
Bdt fixed multiple panic
Issue #183, #186, #187: Fixed multiple panics in the protocol stack
Issue #185: Use cyfs-async-h1 to replace the original async-h1 to avoid panic caused by invalid http header
Issue #198: AppManager does not handle the timeout of install command correctly in docker mode.
Fix: AppManager incorrectly set the App status when it received the Install command, resulting in the inability to retry the installation logic after reboot
21 changes: 21 additions & 0 deletions doc/release-notes/release-notes-1.1.1.82.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## [1.1.1.82] - 2023-04-15
### Improvements:
Optimize bdt uptime logic when no udp endpoint is available
Protocol stack optimization guessing mime logic
Protocol stack optimization and DecApp related caching logic
Issue #156: AppManager optimizes the uninstall logic of DecApp
Issue #165, #168: Optimization of AppManager's local repo logic
Issue #170: Optimization of AppManager's state repair logic at startup
Issue #196: The -overwrite parameter of ood-installer can control whether to overwrite the original system-config.toml file
Issue #201: Optimize the hash detection logic of the protocol stack chunk reader

### Fixes:
Issue #157: AppManager may not stop the timeout DecApp installation command correctly under Windows
Fix the service execution problem of AppManager in docker mode.
Fixed a status problem when AppManager reports decapp to ood-daemon.
Fixed some problems related to NDN chunk.
Bdt fixed multiple panic
Issue #183, #186, #187: Fixed multiple panics in the protocol stack
Issue #185: Use cyfs-async-h1 to replace the original async-h1 to avoid panic caused by invalid http header
Issue #198: AppManager does not handle the timeout of install command correctly in docker mode.
Fix: AppManager incorrectly set the App status when it received the Install command, resulting in the inability to retry the installation logic after reboot
35 changes: 35 additions & 0 deletions src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ members = [
"./tools/cyfs-check",
"./tools/sn-updater",
"./tools/cyfs-backup-tool",
"./tools/bdt-tool",

"./meta/browser-meta-spv",
"./meta/cyfs-meta",
Expand Down
2 changes: 2 additions & 0 deletions src/component/cyfs-backup/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ hmac = '0.12'
base58 = '0.2.0'
tide = "0.16"
http-types = "2.12"
surf = { version = '2.3', default-features = false, features = ['h1-client-rustls'] }
futures = "0.3"

[dev-dependencies]
rand = "0.8"
122 changes: 122 additions & 0 deletions src/component/cyfs-backup/src/archive_download/def.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
use cyfs_base::*;

use http_types::Url;
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct RemoteArchiveUrl {
pub base_url: String,
pub file_name: Option<String>,
pub query_string: Option<String>,
}

impl RemoteArchiveUrl {
pub fn parse_url(&self) -> BuckyResult<Url> {
let url = match &self.file_name {
Some(file_name) => {
format!("{}/{}", self.base_url.trim_end_matches('/'), file_name)
}
None => self.base_url.clone(),
};

let mut url = Url::parse(&url).map_err(|e| {
let msg = format!(
"invalid remote archive url format! {}, {}",
self.base_url, e
);
error!("{}", msg);
BuckyError::new(BuckyErrorCode::InvalidFormat, msg)
})?;

if let Some(query) = &self.query_string {
url.set_query(Some(query.as_str()));
}

Ok(url)
}
}

#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum RemoteArchiveInfo {
ZipFile(RemoteArchiveUrl),
Folder(RemoteArchiveUrl),
}

impl RemoteArchiveInfo {
// Supports URLs in two formats
// {base_url}?{query_string}
// {base_url}/${filename}?{query_string}
pub fn parse(url: &str) -> BuckyResult<Self> {
let (base_url, query_string) = match url.split_once("?") {
Some((base_url, query_string)) => (base_url.to_owned(), Some(query_string.to_owned())),
None => (url.to_owned(), None),
};

let ret = match base_url.find("${filename}") {
Some(_) => {
let base_url = base_url.replace("${filename}", "");

let info = RemoteArchiveUrl {
base_url,
file_name: None,
query_string,
};
RemoteArchiveInfo::Folder(info)
}
None => {
let info = RemoteArchiveUrl {
base_url,
file_name: None,
query_string,
};
RemoteArchiveInfo::ZipFile(info)
}
};

Ok(ret)
}
}

#[cfg(test)]
mod test {
use super::RemoteArchiveInfo;

#[test]
fn test_url() {
let url = "http://127.0.0.1:1234/a/b?token=123456";
let info = RemoteArchiveInfo::parse(url).unwrap();
if let RemoteArchiveInfo::ZipFile(info) = info {
assert_eq!(info.base_url, "http://127.0.0.1:1234/a/b");
assert_eq!(info.query_string.as_deref(), Some("token=123456"));
} else {
unreachable!();
}

let url = "http://127.0.0.1:1234/a/b";
let info = RemoteArchiveInfo::parse(url).unwrap();
if let RemoteArchiveInfo::ZipFile(info) = info {
assert_eq!(info.base_url, "http://127.0.0.1:1234/a/b");
assert_eq!(info.query_string, None);
} else {
unreachable!();
}

let url = "http://127.0.0.1:1234/a/b/${filename}?token=123456";
let info = RemoteArchiveInfo::parse(url).unwrap();
if let RemoteArchiveInfo::Folder(info) = info {
assert_eq!(info.base_url, "http://127.0.0.1:1234/a/b/");
assert_eq!(info.query_string.as_deref(), Some("token=123456"));
} else {
unreachable!();
}

let url = "http://127.0.0.1:1234/a/b/${filename}";
let info = RemoteArchiveInfo::parse(url).unwrap();
if let RemoteArchiveInfo::Folder(info) = info {
assert_eq!(info.base_url, "http://127.0.0.1:1234/a/b/");
assert_eq!(info.query_string, None);
} else {
unreachable!();
}
}
}
Loading

0 comments on commit 7b6cc7f

Please sign in to comment.