mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-25 06:18:45 +08:00
feat(server): impl storage runtime (#15181)
#### PR Dependency Tree * **PR #15181** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added an additional storage backend option: asset-pack based storage (provider for avatar, blob, and copilot). * Introduced a dedicated storage runtime with provider capability reporting and expanded object operations (put/head/get/list/delete), including presigned and multipart flows where supported. * Cloudflare R2 `jurisdiction` now uses an explicit default when omitted. * **Bug Fixes** * Broadened avatar access to allow both fs and asset-pack providers. * Improved workspace blob upload completion validation and handling when stored objects are missing or mismatched. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -7,7 +7,7 @@ version = "0.1.0"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
hashcash = ["chrono", "sha3", "rand"]
|
||||
hashcash = ["chrono", "hex", "sha3", "rand"]
|
||||
napi = ["dep:napi"]
|
||||
ydoc-loader = [
|
||||
"assert-json-diff",
|
||||
@@ -22,6 +22,7 @@ ydoc-loader = [
|
||||
[dependencies]
|
||||
assert-json-diff = { workspace = true, optional = true }
|
||||
chrono = { workspace = true, optional = true }
|
||||
hex = { workspace = true, optional = true }
|
||||
nanoid = { workspace = true, optional = true }
|
||||
napi = { workspace = true, optional = true }
|
||||
pulldown-cmark = { workspace = true, optional = true }
|
||||
|
||||
@@ -40,7 +40,7 @@ impl Stamp {
|
||||
// check challenge
|
||||
let mut hasher = Sha3_256::new();
|
||||
hasher.update(self.format().as_bytes());
|
||||
let result = format!("{:x}", hasher.finalize());
|
||||
let result = hex::encode(hasher.finalize());
|
||||
result[..hex_digits] == String::from_utf8(vec![b'0'; hex_digits]).unwrap()
|
||||
} else {
|
||||
false
|
||||
@@ -77,7 +77,7 @@ impl Stamp {
|
||||
let zeros = String::from_utf8(vec![b'0'; hex_digits]).unwrap();
|
||||
loop {
|
||||
hasher.update(format!("{challenge}:{counter:x}").as_bytes());
|
||||
let result = format!("{:x}", hasher.finalize_reset());
|
||||
let result = hex::encode(hasher.finalize_reset());
|
||||
if result[..hex_digits] == zeros {
|
||||
break format!("{counter:x}");
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user