mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: support uploading image to cloud storage (#4413)
* feat: add object ext * feat: integrate upload image api * feat: support uploading local file to cloud * feat: abstact the CachedNetworkImage as FlowyNetworkImage * ci: fix tauri ci * fix: integration test --------- Co-authored-by: Lucas.Xu <lucas.xu@appflowy.io> Co-authored-by: nathan <nathan@appflowy.io>
This commit is contained in:
@ -36,7 +36,6 @@ futures.workspace = true
|
||||
tokio-stream = { workspace = true, features = ["sync"] }
|
||||
scraper = "0.18.0"
|
||||
lru.workspace = true
|
||||
fxhash = "0.2.1"
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
getrandom = { version = "0.2", features = ["js"]}
|
||||
|
@ -10,8 +10,7 @@ use collab_document::blocks::DocumentData;
|
||||
use collab_document::document::Document;
|
||||
use collab_document::document_data::default_document_data;
|
||||
use collab_entity::CollabType;
|
||||
use flowy_storage::ObjectIdentity;
|
||||
use flowy_storage::ObjectValue;
|
||||
use flowy_storage::object_from_disk;
|
||||
use lru::LruCache;
|
||||
use parking_lot::Mutex;
|
||||
use tokio::io::AsyncWriteExt;
|
||||
@ -257,18 +256,9 @@ impl DocumentManager {
|
||||
workspace_id: String,
|
||||
local_file_path: &str,
|
||||
) -> FlowyResult<String> {
|
||||
let object_value = ObjectValue::from_file(local_file_path).await?;
|
||||
|
||||
let (object_identity, object_value) = object_from_disk(&workspace_id, local_file_path).await?;
|
||||
let storage_service = self.storage_service_upgrade()?;
|
||||
let url = {
|
||||
let hash = fxhash::hash(object_value.raw.as_ref());
|
||||
storage_service
|
||||
.get_object_url(ObjectIdentity {
|
||||
workspace_id: workspace_id.to_owned(),
|
||||
file_id: hash.to_string(),
|
||||
})
|
||||
.await?
|
||||
};
|
||||
let url = storage_service.get_object_url(object_identity).await?;
|
||||
|
||||
// let the upload happen in the background
|
||||
let clone_url = url.clone();
|
||||
|
Reference in New Issue
Block a user