mirror of
https://github.com/damus-io/notedeck.git
synced 2024-09-19 21:26:33 +00:00
app: add accounts to Damus & mock
Signed-off-by: kernelkind <kernelkind@gmail.com> Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
parent
4fc6e225ca
commit
b43ed1a2d1
27
src/app.rs
27
src/app.rs
@ -1,3 +1,4 @@
|
|||||||
|
use crate::account_manager::UserAccount;
|
||||||
use crate::app_creation::setup_cc;
|
use crate::app_creation::setup_cc;
|
||||||
use crate::app_style::user_requested_visuals_change;
|
use crate::app_style::user_requested_visuals_change;
|
||||||
use crate::error::Error;
|
use crate::error::Error;
|
||||||
@ -41,6 +42,7 @@ pub struct Damus {
|
|||||||
|
|
||||||
pub img_cache: ImageCache,
|
pub img_cache: ImageCache,
|
||||||
pub ndb: Ndb,
|
pub ndb: Ndb,
|
||||||
|
pub accounts: Vec<UserAccount>,
|
||||||
|
|
||||||
frame_history: crate::frame_history::FrameHistory,
|
frame_history: crate::frame_history::FrameHistory,
|
||||||
}
|
}
|
||||||
@ -482,6 +484,7 @@ impl Damus {
|
|||||||
timelines,
|
timelines,
|
||||||
textmode: false,
|
textmode: false,
|
||||||
ndb: Ndb::new(data_path.as_ref().to_str().expect("db path ok"), &config).expect("ndb"),
|
ndb: Ndb::new(data_path.as_ref().to_str().expect("db path ok"), &config).expect("ndb"),
|
||||||
|
accounts: Vec::new(),
|
||||||
//compose: "".to_string(),
|
//compose: "".to_string(),
|
||||||
frame_history: FrameHistory::default(),
|
frame_history: FrameHistory::default(),
|
||||||
}
|
}
|
||||||
@ -492,6 +495,30 @@ impl Damus {
|
|||||||
.entry(note_key)
|
.entry(note_key)
|
||||||
.or_insert_with(|| NoteCache::new(note))
|
.or_insert_with(|| NoteCache::new(note))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn mock<P: AsRef<Path>>(data_path: P) -> Self {
|
||||||
|
let mut timelines: Vec<Timeline> = vec![];
|
||||||
|
let _initial_limit = 100;
|
||||||
|
let filter = serde_json::from_str(include_str!("../queries/global.json")).unwrap();
|
||||||
|
timelines.push(Timeline::new(filter));
|
||||||
|
|
||||||
|
let imgcache_dir = data_path.as_ref().join(ImageCache::rel_datadir());
|
||||||
|
let _ = std::fs::create_dir_all(imgcache_dir.clone());
|
||||||
|
|
||||||
|
let mut config = Config::new();
|
||||||
|
config.set_ingester_threads(2);
|
||||||
|
Self {
|
||||||
|
state: DamusState::Initializing,
|
||||||
|
pool: RelayPool::new(),
|
||||||
|
img_cache: ImageCache::new(imgcache_dir),
|
||||||
|
note_cache: HashMap::new(),
|
||||||
|
timelines,
|
||||||
|
textmode: false,
|
||||||
|
ndb: Ndb::new(data_path.as_ref().to_str().expect("db path ok"), &config).expect("ndb"),
|
||||||
|
accounts: Vec::new(),
|
||||||
|
frame_history: FrameHistory::default(),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user