Skip to content

Commit

Permalink
Merge branch 'unstable'
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedilger committed Nov 21, 2024
2 parents 262e22a + 84bea65 commit aa72cef
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion gossip-bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ humansize = "2.1"
image = { version = "0.25", features = [ "png", "jpeg" ] }
lazy_static = "1.5"
memoize = "0.4"
nostr-types = { git = "https://github.com/mikedilger/nostr-types", rev = "adcaa6cb63a3ea2770ceee662b05d47e5c9ab1f8", features = [ "speedy" ] }
nostr-types = { git = "https://github.com/mikedilger/nostr-types", rev = "abd6a42020707b19a07379cbe6bc9ff9052477b6", features = [ "speedy" ] }
paste = "1.0"
qrcode = "0.14"
resvg = "0.35.0"
Expand Down
3 changes: 2 additions & 1 deletion gossip-bin/src/notedata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ impl NoteData {
// Compute the content to our needs
let (display_content, error_content) = match event.kind {
EventKind::TextNote => (event.content.trim().to_string(), None),
EventKind::Comment => (event.content.trim().to_string(), None),
EventKind::Repost => ("".to_owned(), embedded_event_error),
EventKind::GenericRepost => ("".to_owned(), None),
EventKind::EncryptedDirectMessage => {
Expand All @@ -194,7 +195,7 @@ impl NoteData {
EventKind::DraftLongFormContent => (event.content.clone(), None),
k => {
if k.is_feed_displayable() {
(event.content.clone(), Some(format!("{:?}", k)))
(event.content.clone(), Some(format!("kind={:?}", k)))
} else {
let mut dc = format!("UNSUPPORTED EVENT KIND {:?}", k);
// support the 'alt' tag of NIP-31:
Expand Down
2 changes: 1 addition & 1 deletion gossip-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ linkify = "0.10"
memmap2 = "0.9"
mime = "0.3"
mime_guess = "2"
nostr-types = { git = "https://github.com/mikedilger/nostr-types", rev = "adcaa6cb63a3ea2770ceee662b05d47e5c9ab1f8", features = [ "speedy" ] }
nostr-types = { git = "https://github.com/mikedilger/nostr-types", rev = "abd6a42020707b19a07379cbe6bc9ff9052477b6", features = [ "speedy" ] }
parking_lot = { version = "0.12", features = [ "arc_lock", "send_guard" ] }
paste = "1.0"
rand = "0.8"
Expand Down
6 changes: 3 additions & 3 deletions gossip-lib/src/blossom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ impl Blossom {
hash: HashOutput,
authorize: bool,
) -> Result<bool, Error> {
let url = format!("{}/{}", base_url, hash);
let url = format!("{}{}", base_url, hash);
let mut req_builder = self.client.head(url);

if authorize {
Expand Down Expand Up @@ -149,7 +149,7 @@ impl Blossom {
hash: HashOutput,
authorize: bool,
) -> Result<Response, Error> {
let url = format!("{}/{}", base_url, hash);
let url = format!("{}{}", base_url, hash);
let mut req_builder = self.client.get(url);

if authorize {
Expand Down Expand Up @@ -193,7 +193,7 @@ impl Blossom {
vec![hash],
)?;

let url = format!("{}/upload", base_url);
let url = format!("{}upload", base_url);
let response = self
.client
.put(url)
Expand Down
23 changes: 23 additions & 0 deletions gossip-lib/src/storage/migrations/m45.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
use crate::error::Error;
use crate::storage::Storage;
use heed::RwTxn;

impl Storage {
pub(super) fn m45_trigger(&self) -> Result<(), Error> {
Ok(())
}

pub(super) fn m45_migrate<'a>(
&'a self,
prefix: &str,
txn: &mut RwTxn<'a>,
) -> Result<(), Error> {
// Info message
tracing::info!("{prefix}: Flagging that relationships need to be rebuilt...");

// Rebuild relationships
self.set_flag_rebuild_relationships_needed(true, Some(txn))?;

Ok(())
}
}
5 changes: 4 additions & 1 deletion gossip-lib/src/storage/migrations/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ mod m41;
mod m42;
mod m43;
mod m44;
mod m45;

use super::Storage;
use crate::error::{Error, ErrorKind};
use heed::RwTxn;

impl Storage {
const MIN_MIGRATION_LEVEL: u32 = 23;
const MAX_MIGRATION_LEVEL: u32 = 44;
const MAX_MIGRATION_LEVEL: u32 = 45;

/// Initialize the database from empty
pub(super) fn init_from_empty(&self) -> Result<(), Error> {
Expand Down Expand Up @@ -132,6 +133,7 @@ impl Storage {
42 => self.m42_trigger()?,
43 => self.m43_trigger()?,
44 => self.m44_trigger()?,
45 => self.m45_trigger()?,
_ => panic!("Unreachable migration level"),
}

Expand Down Expand Up @@ -167,6 +169,7 @@ impl Storage {
42 => self.m42_migrate(&prefix, txn)?,
43 => self.m43_migrate(&prefix, txn)?,
44 => self.m44_migrate(&prefix, txn)?,
45 => self.m45_migrate(&prefix, txn)?,
_ => panic!("Unreachable migration level"),
};

Expand Down
2 changes: 1 addition & 1 deletion gossip-lib/src/storage/types/relationship_by_id2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use speedy::{Readable, Writable};
/// A relationship between events by Ids
#[derive(Clone, Debug, PartialEq, Eq, Readable, Writable)]
pub enum RelationshipById2 {
// NIP-01, NIP-10 replies
// NIP-01, NIP-10 replies, NIP-22 comments
RepliesTo,

// Annotation
Expand Down

0 comments on commit aa72cef

Please sign in to comment.