Introducing Damus Notedeck: a nostr browser
This splits notedeck into: - notedeck - notedeck_chrome - notedeck_columns The `notedeck` crate is the library that `notedeck_chrome` and `notedeck_columns`, use. It contains common functionality related to notedeck apps such as the NoteCache, ImageCache, etc. The `notedeck_chrome` crate is the binary and ui chrome. It is responsible for managing themes, user accounts, signing, data paths, nostrdb, image caches etc. It will eventually have its own ui which has yet to be determined. For now it just manages the browser data, which is passed to apps via a new struct called `AppContext`. `notedeck_columns` is our columns app, with less responsibility now that more things are handled by `notedeck_chrome` There is still much work left to do before this is a proper browser: - process isolation - sandboxing - etc This is the beginning of a new era! We're just getting started. Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
use crate::{
|
||||
column::Columns,
|
||||
decks::DecksCache,
|
||||
error::{Error, FilterError},
|
||||
filter::{self, FilterState, FilterStates},
|
||||
muted::MuteFun,
|
||||
note::NoteRef,
|
||||
notecache::{CachedNote, NoteCache},
|
||||
error::Error,
|
||||
subscriptions::{self, SubKind, Subscriptions},
|
||||
unknowns::UnknownIds,
|
||||
Result,
|
||||
};
|
||||
|
||||
use notedeck::{
|
||||
filter, CachedNote, FilterError, FilterState, FilterStates, MuteFun, NoteCache, NoteRef,
|
||||
UnknownIds,
|
||||
};
|
||||
|
||||
use std::fmt;
|
||||
use std::sync::atomic::{AtomicU32, Ordering};
|
||||
|
||||
@@ -271,7 +271,9 @@ impl Timeline {
|
||||
let timeline = timelines
|
||||
.get_mut(timeline_idx)
|
||||
.ok_or(Error::TimelineNotFound)?;
|
||||
let sub = timeline.subscription.ok_or(Error::no_active_sub())?;
|
||||
let sub = timeline
|
||||
.subscription
|
||||
.ok_or(Error::App(notedeck::Error::no_active_sub()))?;
|
||||
|
||||
let new_note_ids = ndb.poll_for_notes(sub, 500);
|
||||
if new_note_ids.is_empty() {
|
||||
@@ -535,7 +537,7 @@ fn setup_initial_timeline(
|
||||
"querying nostrdb sub {:?} {:?}",
|
||||
timeline.subscription, timeline.filter
|
||||
);
|
||||
let lim = filters[0].limit().unwrap_or(crate::filter::default_limit()) as i32;
|
||||
let lim = filters[0].limit().unwrap_or(filter::default_limit()) as i32;
|
||||
let notes = ndb
|
||||
.query(&txn, filters, lim)?
|
||||
.into_iter()
|
||||
@@ -607,7 +609,7 @@ fn setup_timeline_nostrdb_sub(
|
||||
let filter_state = timeline
|
||||
.filter
|
||||
.get_any_ready()
|
||||
.ok_or(Error::empty_contact_list())?
|
||||
.ok_or(Error::App(notedeck::Error::empty_contact_list()))?
|
||||
.to_owned();
|
||||
|
||||
setup_initial_timeline(ndb, timeline, note_cache, &filter_state, is_muted)?;
|
||||
@@ -661,7 +663,7 @@ pub fn is_timeline_ready(
|
||||
|
||||
// TODO: into_follow_filter is hardcoded to contact lists, let's generalize
|
||||
match filter {
|
||||
Err(Error::Filter(e)) => {
|
||||
Err(notedeck::Error::Filter(e)) => {
|
||||
error!("got broken when building filter {e}");
|
||||
timeline
|
||||
.filter
|
||||
|
||||
Reference in New Issue
Block a user