initial hashtag query

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2022-05-09 08:24:26 -07:00
parent cf7cba09bd
commit 0ab1494b1e
4 changed files with 11 additions and 4 deletions

View File

@@ -248,6 +248,7 @@ struct ContentView: View {
thread_open = true
}
case .filter:
break
// TODO: handle filter searches?
}

View File

@@ -15,16 +15,22 @@ struct NostrFilter: Codable {
var since: Int64?
var until: Int64?
var authors: [String]?
var hashtag: [String]? = nil
private enum CodingKeys : String, CodingKey {
case ids
case kinds
case referenced_ids = "#e"
case pubkeys = "#p"
case hashtag = "#hashtag"
case since
case until
case authors
}
public static func filter_hashtag(_ htags: [String]) -> NostrFilter {
return NostrFilter(ids: nil, kinds: nil, referenced_ids: nil, pubkeys: nil, since: nil, until: nil, authors: nil, hashtag: htags)
}
public static var filter_text: NostrFilter {
return filter_kinds([1])

View File

@@ -92,5 +92,9 @@ func decode_nostr_uri(_ s: String) -> NostrLink? {
return
}
if parts.count >= 3 && parts[1] == "hashtag" {
return .filter(NostrFilter.filter_hashtag([parts[2]]))
}
return tag_to_refid(parts).map { .ref($0) }
}