Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39f9984c4f | ||
|
|
9d55731073 | ||
|
|
5638f70d66 |
Generated
+1
-1
@@ -1550,7 +1550,7 @@ checksum = "38bf9645c8b145698bb0b18a4637dcacbc421ea49bef2317e4fd8065a387cf21"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nostr-rs-relay"
|
name = "nostr-rs-relay"
|
||||||
version = "0.8.6"
|
version = "0.8.7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-std",
|
"async-std",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "nostr-rs-relay"
|
name = "nostr-rs-relay"
|
||||||
version = "0.8.6"
|
version = "0.8.7"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["Greg Heartsfield <scsibug@imap.cc>"]
|
authors = ["Greg Heartsfield <scsibug@imap.cc>"]
|
||||||
description = "A relay implementation for the Nostr protocol"
|
description = "A relay implementation for the Nostr protocol"
|
||||||
|
|||||||
@@ -550,6 +550,7 @@ fn query_from_filter(f: &ReqFilter) -> Option<QueryBuilder<Postgres>> {
|
|||||||
|
|
||||||
let mut query = QueryBuilder::new("SELECT e.\"content\", e.created_at FROM \"event\" e WHERE ");
|
let mut query = QueryBuilder::new("SELECT e.\"content\", e.created_at FROM \"event\" e WHERE ");
|
||||||
|
|
||||||
|
// This tracks whether we need to push a prefix AND before adding another clause
|
||||||
let mut push_and = false;
|
let mut push_and = false;
|
||||||
// Query for "authors", allowing prefix matches
|
// Query for "authors", allowing prefix matches
|
||||||
if let Some(auth_vec) = &f.authors {
|
if let Some(auth_vec) = &f.authors {
|
||||||
@@ -747,13 +748,9 @@ fn query_from_filter(f: &ReqFilter) -> Option<QueryBuilder<Postgres>> {
|
|||||||
} else {
|
} else {
|
||||||
query.push("e.hidden != 1::bit(1)");
|
query.push("e.hidden != 1::bit(1)");
|
||||||
}
|
}
|
||||||
|
|
||||||
// never display expired events
|
// never display expired events
|
||||||
if push_and {
|
|
||||||
query.push(" AND ");
|
|
||||||
}
|
|
||||||
query
|
query
|
||||||
.push("(e.expires_at IS NULL OR e.expires_at > ")
|
.push(" AND (e.expires_at IS NULL OR e.expires_at > ")
|
||||||
.push_bind(Utc.timestamp_opt(utils::unix_time() as i64, 0).unwrap()).push(")");
|
.push_bind(Utc.timestamp_opt(utils::unix_time() as i64, 0).unwrap()).push(")");
|
||||||
|
|
||||||
// Apply per-filter limit to this query.
|
// Apply per-filter limit to this query.
|
||||||
|
|||||||
+1
-1
@@ -376,7 +376,7 @@ impl NostrRepo for SqliteRepo {
|
|||||||
let mut last_successful_send = Instant::now();
|
let mut last_successful_send = Instant::now();
|
||||||
// execute the query.
|
// execute the query.
|
||||||
// make the actual SQL query (with parameters inserted) available
|
// make the actual SQL query (with parameters inserted) available
|
||||||
conn.trace(Some(|x| {info!("SQL trace: {:?}", x)}));
|
conn.trace(Some(|x| {trace!("SQL trace: {:?}", x)}));
|
||||||
let mut stmt = conn.prepare_cached(&q)?;
|
let mut stmt = conn.prepare_cached(&q)?;
|
||||||
let mut event_rows = stmt.query(rusqlite::params_from_iter(p))?;
|
let mut event_rows = stmt.query(rusqlite::params_from_iter(p))?;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user