Compare commits
No commits in common. "32a1115abd1721ff70700154e5d7537237970a63" and "8977f8bab5b312ee349d2eb44cffdc350d5997fc" have entirely different histories.
32a1115abd
...
8977f8bab5
18
Cargo.lock
generated
18
Cargo.lock
generated
@ -910,9 +910,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "console_log"
|
||||
version = "0.1.4"
|
||||
version = "0.1.2"
|
||||
source = "sparse+https://git.z.xinu.tv/api/packages/wathiede/cargo/"
|
||||
checksum = "d36495b7586d34322c3ffcff0e0d9d0b70f3a4ce88a9c199b3d8a01afb1debd7"
|
||||
checksum = "e628484ff9348e6c256644436f215c0a9766867820da8cf161c567db1c877e32"
|
||||
dependencies = [
|
||||
"log",
|
||||
"wasm-bindgen",
|
||||
@ -1620,9 +1620,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "1.1.0"
|
||||
version = "1.0.35"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "11faaf5a5236997af9848be0bef4db95824b1d534ebc64d0f0c6cf3e67bd38dc"
|
||||
checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"miniz_oxide",
|
||||
@ -2965,7 +2965,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "letterbox-notmuch"
|
||||
version = "0.9.4"
|
||||
version = "0.9.3"
|
||||
dependencies = [
|
||||
"itertools 0.14.0",
|
||||
"log",
|
||||
@ -2980,14 +2980,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "letterbox-procmail2notmuch"
|
||||
version = "0.9.4"
|
||||
version = "0.9.3"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "letterbox-server"
|
||||
version = "0.9.4"
|
||||
version = "0.9.3"
|
||||
dependencies = [
|
||||
"ammonia",
|
||||
"anyhow",
|
||||
@ -3030,7 +3030,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "letterbox-shared"
|
||||
version = "0.9.4"
|
||||
version = "0.9.3"
|
||||
dependencies = [
|
||||
"build-info",
|
||||
"letterbox-notmuch",
|
||||
@ -3039,7 +3039,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "letterbox-web"
|
||||
version = "0.9.4"
|
||||
version = "0.9.3"
|
||||
dependencies = [
|
||||
"build-info",
|
||||
"build-info-build",
|
||||
|
||||
@ -8,7 +8,7 @@ authors = ["Bill Thiede <git@xinu.tv>"]
|
||||
edition = "2021"
|
||||
license = "UNLICENSED"
|
||||
publish = ["xinu"]
|
||||
version = "0.9.4"
|
||||
version = "0.9.3"
|
||||
repository = "https://git.z.xinu.tv/wathiede/letterbox"
|
||||
|
||||
[profile.dev]
|
||||
|
||||
@ -48,8 +48,8 @@ urlencoding = "2.1.3"
|
||||
#xtracing = { path = "../../xtracing" }
|
||||
#xtracing = { git = "http://git-private.h.xinu.tv/wathiede/xtracing.git" }
|
||||
xtracing = { version = "0.3.0", registry = "xinu" }
|
||||
letterbox-notmuch = { version = "0.9.4", path = "../notmuch", registry = "xinu" }
|
||||
letterbox-shared = { version = "0.9.4", path = "../shared", registry = "xinu" }
|
||||
letterbox-notmuch = { version = "0.9.3", path = "../notmuch", registry = "xinu" }
|
||||
letterbox-shared = { version = "0.9.3", path = "../shared", registry = "xinu" }
|
||||
|
||||
[build-dependencies]
|
||||
build-info-build = "0.0.39"
|
||||
|
||||
@ -12,5 +12,5 @@ version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
build-info = "0.0.39"
|
||||
letterbox-notmuch = { version = "0.9.4", path = "../notmuch", registry = "xinu" }
|
||||
letterbox-notmuch = { version = "0.9.3", path = "../notmuch", registry = "xinu" }
|
||||
serde = { version = "1.0.147", features = ["derive"] }
|
||||
|
||||
@ -33,8 +33,8 @@ wasm-bindgen = "=0.2.100"
|
||||
uuid = { version = "1.13.1", features = [
|
||||
"js",
|
||||
] } # direct dep to set js feature, prevents Rng issues
|
||||
letterbox-shared = { version = "0.9.4", path = "../shared", registry = "xinu" }
|
||||
letterbox-notmuch = { version = "0.9.4", path = "../notmuch", registry = "xinu" }
|
||||
letterbox-shared = { version = "0.9.3", path = "../shared", registry = "xinu" }
|
||||
letterbox-notmuch = { version = "0.9.3", path = "../notmuch", registry = "xinu" }
|
||||
seed_hooks = { version = "0.4.0", registry = "xinu" }
|
||||
strum_macros = "0.27.1"
|
||||
|
||||
|
||||
@ -18,9 +18,6 @@ fn main() {
|
||||
#[cfg(debug_assertions)]
|
||||
console_error_panic_hook::set_once();
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
let lvl = Level::Debug;
|
||||
#[cfg(not(debug_assertions))]
|
||||
let lvl = Level::Info;
|
||||
console_log::init_with_level(lvl).expect("failed to initialize console logging");
|
||||
// Mount the `app` to the element with the `id` "app".
|
||||
|
||||
@ -32,13 +32,13 @@ pub fn init(url: Url, orders: &mut impl Orders<Msg>) -> Model {
|
||||
if url.hash().is_none() {
|
||||
orders.request_url(urls::search(unread_query(), 0));
|
||||
} else {
|
||||
orders.request_url(url);
|
||||
orders.notify(subs::UrlRequested::new(url));
|
||||
};
|
||||
orders.stream(streams::window_event(Ev::Resize, |_| Msg::OnResize));
|
||||
// TODO(wathiede): only do this while viewing the index? Or maybe add a new message that force
|
||||
// 'notmuch new' on the server periodically?
|
||||
orders.stream(streams::interval(30_000, || Msg::RefreshStart));
|
||||
orders.subscribe(Msg::OnUrlChanged);
|
||||
orders.subscribe(on_url_changed);
|
||||
orders.stream(streams::window_event(Ev::Scroll, |_| Msg::WindowScrolled));
|
||||
|
||||
build_info::build_info!(fn bi);
|
||||
@ -54,21 +54,24 @@ pub fn init(url: Url, orders: &mut impl Orders<Msg>) -> Model {
|
||||
server: None,
|
||||
},
|
||||
catchup: None,
|
||||
last_url: Url::current(),
|
||||
}
|
||||
}
|
||||
|
||||
fn on_url_changed(old: &Url, mut new: Url) -> Msg {
|
||||
let did_change = *old != new;
|
||||
fn on_url_changed(uc: subs::UrlChanged) -> Msg {
|
||||
let mut url = uc.0;
|
||||
let href = document().location().unwrap().href().unwrap();
|
||||
let origin = document().location().unwrap().origin().unwrap();
|
||||
let current_url = &href[origin.len()..];
|
||||
let did_change = current_url != url.to_string();
|
||||
let mut messages = Vec::new();
|
||||
if did_change {
|
||||
messages.push(Msg::ScrollToTop)
|
||||
}
|
||||
info!(
|
||||
"url changed\nold '{old}'\nnew '{new}', history {}",
|
||||
"url changed\nold '{current_url}'\nnew '{url}', history {}",
|
||||
history().length().unwrap_or(0)
|
||||
);
|
||||
let hpp = new.remaining_hash_path_parts();
|
||||
let hpp = url.remaining_hash_path_parts();
|
||||
let msg = match hpp.as_slice() {
|
||||
["t", tid] => Msg::ShowThreadRequest {
|
||||
thread_id: tid.to_string(),
|
||||
@ -139,7 +142,7 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
||||
orders.perform_cmd(async move { Msg::Refresh });
|
||||
}
|
||||
Msg::Refresh => {
|
||||
orders.request_url(Url::current());
|
||||
orders.perform_cmd(async move { on_url_changed(subs::UrlChanged(Url::current())) });
|
||||
}
|
||||
Msg::Reload => {
|
||||
window()
|
||||
@ -147,10 +150,6 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
||||
.reload()
|
||||
.expect("failed to reload window");
|
||||
}
|
||||
Msg::OnUrlChanged(new_url) => {
|
||||
orders.send_msg(on_url_changed(&model.last_url, new_url.0.clone()));
|
||||
model.last_url = new_url.0;
|
||||
}
|
||||
Msg::OnResize => (),
|
||||
|
||||
Msg::NextPage => {
|
||||
@ -677,7 +676,6 @@ pub struct Model {
|
||||
pub content_el: ElRef<HtmlElement>,
|
||||
pub versions: Version,
|
||||
pub catchup: Option<Catchup>,
|
||||
pub last_url: Url,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -743,8 +741,6 @@ pub enum Msg {
|
||||
Refresh,
|
||||
// Tell the client to reload whole page from server
|
||||
Reload,
|
||||
// TODO: add GoToUrl
|
||||
OnUrlChanged(subs::UrlChanged),
|
||||
// Window has changed size
|
||||
OnResize,
|
||||
// Tell the server to update state
|
||||
|
||||
@ -1048,7 +1048,6 @@ fn render_attachements(
|
||||
]
|
||||
}
|
||||
|
||||
// TODO: add cathup_mode:bool and hide elements when true
|
||||
#[topo::nested]
|
||||
fn thread(
|
||||
thread: &ShowThreadQueryThreadOnEmailThread,
|
||||
@ -1349,8 +1348,6 @@ pub fn view_tags(tags: &Option<Vec<Tag>>) -> Node<Msg> {
|
||||
]
|
||||
]
|
||||
}
|
||||
|
||||
// TODO: add cathup_mode:bool and hide elements when true
|
||||
fn news_post(post: &ShowThreadQueryThreadOnNewsPost, content_el: &ElRef<HtmlElement>) -> Node<Msg> {
|
||||
let subject = &post.title;
|
||||
set_title(subject);
|
||||
@ -1543,6 +1540,7 @@ fn reading_progress(ratio: f64) -> Node<Msg> {
|
||||
]
|
||||
}
|
||||
pub fn view_versions(versions: &Version) -> Node<Msg> {
|
||||
debug!("versions {versions:?}");
|
||||
aside![
|
||||
C!["p-2"],
|
||||
p![C!["uppercase", "font-bold"], "Versions"],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user