@@ -248,6 +248,7 @@ struct ContentView: View {
|
||||
thread_open = true
|
||||
}
|
||||
case .filter:
|
||||
|
||||
break
|
||||
// TODO: handle filter searches?
|
||||
}
|
||||
|
||||
@@ -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])
|
||||
|
||||
@@ -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) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user