Compare commits
53 Commits
letterbox-
...
letterbox-
| Author | SHA1 | Date | |
|---|---|---|---|
| 29de7c0727 | |||
| 5f6580fa2f | |||
| 5d4732d75d | |||
| a13bac813a | |||
| 85dcc9f7bd | |||
| b696629ad9 | |||
| b9e3128718 | |||
| 88fac4c2bc | |||
| 1fad5ec536 | |||
| 8e7214d531 | |||
| 333c4a3ebb | |||
| b9ba5a3bea | |||
| 2a0989e74d | |||
| e9319dc491 | |||
| 57481a77cd | |||
| 44915cce54 | |||
| 1225483b57 | |||
| daeb8c88a1 | |||
| 8a6b3ff501 | |||
| a6fffeafdc | |||
| d791b4ce49 | |||
| 8a0e4eb441 | |||
| fc84562419 | |||
| 37ebe1ebb3 | |||
| 2d06f070ea | |||
| 527a62069a | |||
| 40afafe1a8 | |||
| e3acf9ae6d | |||
| a68d067a68 | |||
| 5547c65af0 | |||
| b622bb7d7d | |||
| 43efdf18a0 | |||
| c71ab8e9e8 | |||
| 408d6ed8ba | |||
| 1411961e36 | |||
| dfd7ef466c | |||
| 2aa3dfbd0f | |||
| fba10e27cf | |||
| 5417c74f9c | |||
| eb0b0dbe81 | |||
| 561f522658 | |||
| 32d2ffeb3d | |||
| d41946e0a5 | |||
| 61402858f4 | |||
| 17de318645 | |||
| 3aa0144e8d | |||
| f9eafff4c7 | |||
| 4c6d67901d | |||
| e9aa97a089 | |||
| a82b047f75 | |||
| 9a8b44a8df | |||
| a96693004c | |||
| ed9fe11fbf |
@@ -1,4 +1,4 @@
|
||||
on: [push, pull_request]
|
||||
on: [push]
|
||||
|
||||
name: Continuous integration
|
||||
|
||||
|
||||
1084
Cargo.lock
generated
1084
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@ authors = ["Bill Thiede <git@xinu.tv>"]
|
||||
edition = "2021"
|
||||
license = "UNLICENSED"
|
||||
publish = ["xinu"]
|
||||
version = "0.9.7"
|
||||
version = "0.10.8"
|
||||
repository = "https://git.z.xinu.tv/wathiede/letterbox"
|
||||
|
||||
[profile.dev]
|
||||
|
||||
@@ -17,7 +17,7 @@ anyhow = "1.0.79"
|
||||
async-graphql = { version = "7", features = ["log"] }
|
||||
async-graphql-rocket = "7"
|
||||
async-trait = "0.1.81"
|
||||
build-info = "0.0.39"
|
||||
build-info = "0.0.40"
|
||||
cacher = { version = "0.1.0", registry = "xinu" }
|
||||
chrono = "0.4.39"
|
||||
clap = { version = "4.5.23", features = ["derive"] }
|
||||
@@ -30,7 +30,6 @@ lol_html = "2.0.0"
|
||||
mailparse = "0.16.0"
|
||||
maplit = "1.0.2"
|
||||
memmap = "0.7.0"
|
||||
opentelemetry = "0.28.0"
|
||||
regex = "1.11.1"
|
||||
reqwest = { version = "0.12.7", features = ["blocking"] }
|
||||
rocket = { version = "0.5.0-rc.2", features = ["json"] }
|
||||
@@ -48,11 +47,11 @@ 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.7", path = "../notmuch", registry = "xinu" }
|
||||
letterbox-shared = { version = "0.9.7", path = "../shared", registry = "xinu" }
|
||||
letterbox-notmuch = { version = "0.10.8", path = "../notmuch", registry = "xinu" }
|
||||
letterbox-shared = { version = "0.10.8", path = "../shared", registry = "xinu" }
|
||||
|
||||
[build-dependencies]
|
||||
build-info-build = "0.0.39"
|
||||
build-info-build = "0.0.40"
|
||||
|
||||
[features]
|
||||
#default = [ "tantivy" ]
|
||||
|
||||
20
server/migrations/20250330175930_update-nzfinder-link.sql
Normal file
20
server/migrations/20250330175930_update-nzfinder-link.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
-- Bad examples:
|
||||
-- https://nzbfinder.ws/getnzb/d2c3e5a08abadd985dccc6a574122892030b6a9a.nzb&i=95972&r=b55082d289937c050dedc203c9653850
|
||||
-- https://nzbfinder.ws/getnzb?id=45add174-7da4-4445-bf2b-a67dbbfc07fe.nzb&r=b55082d289937c050dedc203c9653850
|
||||
-- https://nzbfinder.ws/api/v1/getnzb?id=82486020-c192-4fa0-a7e7-798d7d72e973.nzb&r=b55082d289937c050dedc203c9653850
|
||||
UPDATE nzb_posts
|
||||
SET link =
|
||||
regexp_replace(
|
||||
regexp_replace(
|
||||
regexp_replace(
|
||||
link,
|
||||
'https://nzbfinder.ws/getnzb/',
|
||||
'https://nzbfinder.ws/api/v1/getnzb?id='
|
||||
),
|
||||
'https://nzbfinder.ws/getnzb',
|
||||
'https://nzbfinder.ws/api/v1/getnzb'
|
||||
),
|
||||
'&r=',
|
||||
'&apikey='
|
||||
)
|
||||
;
|
||||
@@ -318,13 +318,16 @@ impl<'c> Transformer for SlurpContents<'c> {
|
||||
} else {
|
||||
let resp = reqwest::get(link.as_str()).await?;
|
||||
let status = resp.status();
|
||||
if status.is_server_error() || retryable_status.contains(&status) {
|
||||
return Err(TransformError::RetryableHttpStatusError(
|
||||
status,
|
||||
link.to_string(),
|
||||
));
|
||||
if status.is_server_error() {
|
||||
error!("status error for {link}: {status}");
|
||||
return Ok(html.to_string());
|
||||
}
|
||||
if retryable_status.contains(&status) {
|
||||
error!("retryable error for {link}: {status}");
|
||||
return Ok(html.to_string());
|
||||
}
|
||||
if !status.is_success() {
|
||||
error!("unsuccessful for {link}: {status}");
|
||||
return Ok(html.to_string());
|
||||
}
|
||||
let body = resp.text().await?;
|
||||
|
||||
@@ -11,6 +11,6 @@ version.workspace = true
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
build-info = "0.0.39"
|
||||
letterbox-notmuch = { version = "0.9.7", path = "../notmuch", registry = "xinu" }
|
||||
build-info = "0.0.40"
|
||||
letterbox-notmuch = { version = "0.10.8", path = "../notmuch", registry = "xinu" }
|
||||
serde = { version = "1.0.147", features = ["derive"] }
|
||||
|
||||
@@ -9,7 +9,7 @@ repository.workspace = true
|
||||
version.workspace = true
|
||||
|
||||
[build-dependencies]
|
||||
build-info-build = "0.0.39"
|
||||
build-info-build = "0.0.40"
|
||||
|
||||
[dev-dependencies]
|
||||
wasm-bindgen-test = "0.3.33"
|
||||
@@ -28,13 +28,13 @@ graphql_client = "0.14.0"
|
||||
thiserror = "2.0.0"
|
||||
gloo-net = { version = "0.6.0", features = ["json", "serde_json"] }
|
||||
human_format = "1.1.0"
|
||||
build-info = "0.0.39"
|
||||
build-info = "0.0.40"
|
||||
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.7", path = "../shared", registry = "xinu" }
|
||||
letterbox-notmuch = { version = "0.9.7", path = "../notmuch", registry = "xinu" }
|
||||
letterbox-shared = { version = "0.10.8", path = "../shared", registry = "xinu" }
|
||||
letterbox-notmuch = { version = "0.10.8", path = "../notmuch", registry = "xinu" }
|
||||
seed_hooks = { version = "0.4.0", registry = "xinu" }
|
||||
strum_macros = "0.27.1"
|
||||
|
||||
@@ -50,4 +50,6 @@ features = [
|
||||
"MediaQueryList",
|
||||
"Navigator",
|
||||
"Window",
|
||||
"History",
|
||||
"ScrollRestoration",
|
||||
]
|
||||
|
||||
@@ -29,6 +29,12 @@ pub fn unread_query() -> &'static str {
|
||||
pub fn init(url: Url, orders: &mut impl Orders<Msg>) -> Model {
|
||||
let version = letterbox_shared::build_version(bi);
|
||||
info!("Build Info: {}", version);
|
||||
// Disable restoring to scroll position when navigating
|
||||
window()
|
||||
.history()
|
||||
.expect("couldn't get history")
|
||||
.set_scroll_restoration(web_sys::ScrollRestoration::Manual)
|
||||
.expect("failed to set scroll restoration to manual");
|
||||
if url.hash().is_none() {
|
||||
orders.request_url(urls::search(unread_query(), 0));
|
||||
} else {
|
||||
@@ -112,7 +118,7 @@ fn on_url_changed(old: &Url, mut new: Url) -> Msg {
|
||||
|
||||
// `update` describes how to handle each `Msg`.
|
||||
pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
||||
debug!("update({})", msg);
|
||||
info!("update({})", msg);
|
||||
match msg {
|
||||
Msg::Noop => {}
|
||||
Msg::RefreshStart => {
|
||||
@@ -286,7 +292,9 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
||||
)
|
||||
});
|
||||
}
|
||||
Msg::FrontPageResult(Err(e)) => error!("error FrontPageResult: {e:?}"),
|
||||
Msg::FrontPageResult(Err(e)) => {
|
||||
error!("error FrontPageResult: {e:?}");
|
||||
}
|
||||
Msg::FrontPageResult(Ok(graphql_client::Response {
|
||||
data: None,
|
||||
errors: None,
|
||||
@@ -546,6 +554,7 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
||||
web_sys::window().unwrap().scroll_to_with_x_and_y(0., 0.);
|
||||
}
|
||||
Msg::WindowScrolled => {
|
||||
// TODO: model.content_el doesn't go to None like it should when a DOM is recreated and the refrenced element goes away
|
||||
if let Some(el) = model.content_el.get() {
|
||||
let ih = window()
|
||||
.inner_height()
|
||||
@@ -585,7 +594,8 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
||||
model.read_completion_ratio = ratio;
|
||||
}
|
||||
Msg::UpdateServerVersion(version) => {
|
||||
if version != model.versions.client {
|
||||
// Only git versions contain dash, don't autoreload there
|
||||
if !version.contains('-') && version != model.versions.client {
|
||||
warn!(
|
||||
"Server ({}) and client ({}) version mismatch, reloading",
|
||||
version, model.versions.client
|
||||
|
||||
@@ -93,13 +93,13 @@ pub fn view(model: &Model) -> Node<Msg> {
|
||||
} => {
|
||||
if let Some(catchup) = &model.catchup {
|
||||
catchup_view(
|
||||
thread(thread_data, open_messages, &model.content_el),
|
||||
thread(thread_data, open_messages, &model.content_el, true),
|
||||
&catchup.items,
|
||||
model.read_completion_ratio,
|
||||
)
|
||||
} else {
|
||||
normal_view(
|
||||
thread(thread_data, open_messages, &model.content_el),
|
||||
thread(thread_data, open_messages, &model.content_el, false),
|
||||
&model.versions,
|
||||
&model.query,
|
||||
&model.refreshing_state,
|
||||
@@ -114,13 +114,13 @@ pub fn view(model: &Model) -> Node<Msg> {
|
||||
} => {
|
||||
if let Some(catchup) = &model.catchup {
|
||||
catchup_view(
|
||||
news_post(post, &model.content_el),
|
||||
news_post(post, &model.content_el, true),
|
||||
&catchup.items,
|
||||
model.read_completion_ratio,
|
||||
)
|
||||
} else {
|
||||
normal_view(
|
||||
news_post(post, &model.content_el),
|
||||
news_post(post, &model.content_el, false),
|
||||
&model.versions,
|
||||
&model.query,
|
||||
&model.refreshing_state,
|
||||
@@ -198,10 +198,10 @@ fn catchup_view(
|
||||
"p-4",
|
||||
"border-b",
|
||||
"border-gray-500",
|
||||
"bg-black",
|
||||
"bg-black/50",
|
||||
],
|
||||
div![
|
||||
C!["absolute", "right-4", "text-gray-500"],
|
||||
C!["absolute", "top-0", "right-4", "text-gray-500", "p-4"],
|
||||
span![i![C!["fas", "fa-x"]]],
|
||||
ev(Ev::Click, move |_| Msg::CatchupExit)
|
||||
],
|
||||
@@ -210,7 +210,7 @@ fn catchup_view(
|
||||
format!("{} left ", items.iter().filter(|i| !i.seen).count(),)
|
||||
]
|
||||
],
|
||||
div![C!["mt-12", "mb-4"], content],
|
||||
div![C!["mt-12", "mb-20"], content],
|
||||
div![
|
||||
C![
|
||||
"fixed",
|
||||
@@ -223,19 +223,28 @@ fn catchup_view(
|
||||
"p-4",
|
||||
"border-t",
|
||||
"border-gray-500",
|
||||
"bg-black",
|
||||
"bg-black/50",
|
||||
],
|
||||
button![
|
||||
tw_classes::button(),
|
||||
span![i![C!["far", "fa-envelope"]]],
|
||||
span![C!["pl-2"], "Keep unread"],
|
||||
ev(Ev::Click, move |_| Msg::CatchupKeepUnread)
|
||||
ev(Ev::Click, |_| Msg::CatchupKeepUnread)
|
||||
],
|
||||
button![
|
||||
tw_classes::button_with_color("bg-green-800", "hover:bg-neutral-700"),
|
||||
tw_classes::button(),
|
||||
span![i![C!["fas", "fa-house"]]],
|
||||
span![C!["pl-2"], "Go home"],
|
||||
ev(Ev::Click, |_| Msg::MultiMsg(vec![
|
||||
Msg::CatchupExit,
|
||||
Msg::GoToSearchResults
|
||||
]))
|
||||
],
|
||||
button![
|
||||
tw_classes::button_with_color("bg-green-800", "hover:bg-green-700"),
|
||||
span![i![C!["far", "fa-envelope-open"]]],
|
||||
span![C!["pl-2"], "Mark as read"],
|
||||
ev(Ev::Click, move |_| Msg::CatchupMarkAsRead)
|
||||
ev(Ev::Click, |_| Msg::CatchupMarkAsRead)
|
||||
]
|
||||
],
|
||||
reading_progress(read_completion_ratio)
|
||||
@@ -925,6 +934,13 @@ fn render_closed_header(msg: &ShowThreadQueryThreadOnEmailThreadMessages) -> Nod
|
||||
|
||||
fn message_render(msg: &ShowThreadQueryThreadOnEmailThreadMessages, open: bool) -> Node<Msg> {
|
||||
let expand_id = msg.id.clone();
|
||||
let from = match &msg.from {
|
||||
Some(ShowThreadQueryThreadOnEmailThreadMessagesFrom {
|
||||
addr: Some(addr), ..
|
||||
}) => Some(addr.to_string()),
|
||||
_ => None,
|
||||
};
|
||||
let from = from.map(|f| f.replace('.', "-").replace('@', "-"));
|
||||
div![
|
||||
C!["lg:mb-4"],
|
||||
div![
|
||||
@@ -944,7 +960,7 @@ fn message_render(msg: &ShowThreadQueryThreadOnEmailThreadMessages, open: bool)
|
||||
],
|
||||
IF!(open =>
|
||||
div![
|
||||
C!["bg-white", "text-black", "p-4", "min-w-full", "w-0","overflow-x-auto"],
|
||||
C!["bg-white", "text-black", "p-4", "min-w-full", "w-0","overflow-x-auto", from],
|
||||
match &msg.body {
|
||||
ShowThreadQueryThreadOnEmailThreadMessagesBody::UnhandledContentType(
|
||||
ShowThreadQueryThreadOnEmailThreadMessagesBodyOnUnhandledContentType { contents ,content_tree},
|
||||
@@ -1054,6 +1070,7 @@ fn thread(
|
||||
thread: &ShowThreadQueryThreadOnEmailThread,
|
||||
open_messages: &HashSet<String>,
|
||||
content_el: &ElRef<HtmlElement>,
|
||||
catchup_mode: bool,
|
||||
) -> Node<Msg> {
|
||||
// TODO(wathiede): show per-message subject if it changes significantly from top-level subject
|
||||
let subject = if thread.subject.is_empty() {
|
||||
@@ -1086,7 +1103,7 @@ fn thread(
|
||||
C!["p-4", "lg:p-0"],
|
||||
h3![C!["text-xl"], subject],
|
||||
span![removable_tags_chiclet(&thread.thread_id, &tags)],
|
||||
div![
|
||||
IF!(!catchup_mode => div![
|
||||
C!["pt-4", "gap-2", "flex", "justify-around"],
|
||||
div![
|
||||
button![
|
||||
@@ -1124,13 +1141,13 @@ fn thread(
|
||||
Msg::GoToSearchResults
|
||||
])),
|
||||
]]
|
||||
],
|
||||
]),
|
||||
],
|
||||
div![
|
||||
C!["lg:mt-4", "mail-thread"],
|
||||
el_ref(content_el),
|
||||
messages,
|
||||
click_to_top()
|
||||
IF!(!catchup_mode => click_to_top())
|
||||
],
|
||||
/* TODO(wathiede): plumb in orignal id
|
||||
a![
|
||||
@@ -1351,7 +1368,11 @@ 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> {
|
||||
fn news_post(
|
||||
post: &ShowThreadQueryThreadOnNewsPost,
|
||||
content_el: &ElRef<HtmlElement>,
|
||||
catchup_mode: bool,
|
||||
) -> Node<Msg> {
|
||||
let subject = &post.title;
|
||||
set_title(subject);
|
||||
let read_thread_id = post.thread_id.clone();
|
||||
@@ -1382,7 +1403,7 @@ fn news_post(post: &ShowThreadQueryThreadOnNewsPost, content_el: &ElRef<HtmlElem
|
||||
C!["p-4", "lg:p-0"],
|
||||
h3![C!["text-xl"], subject],
|
||||
span![tag(format!("News/{}", post.slug))],
|
||||
div![
|
||||
IF!(!catchup_mode => div![
|
||||
C!["pt-4", "gap-2", "flex", "justify-around"],
|
||||
div![
|
||||
button![
|
||||
@@ -1410,7 +1431,7 @@ fn news_post(post: &ShowThreadQueryThreadOnNewsPost, content_el: &ElRef<HtmlElem
|
||||
],
|
||||
// Placeholder for symmetry with email view that has Spam button
|
||||
div![],
|
||||
],
|
||||
]),
|
||||
],
|
||||
div![
|
||||
C!["lg:mt-4"],
|
||||
@@ -1430,12 +1451,11 @@ fn news_post(post: &ShowThreadQueryThreadOnNewsPost, content_el: &ElRef<HtmlElem
|
||||
raw![&post.body]
|
||||
]
|
||||
],
|
||||
click_to_top(),
|
||||
IF!(!catchup_mode => click_to_top()),
|
||||
]
|
||||
}
|
||||
fn render_news_post_header(post: &ShowThreadQueryThreadOnNewsPost) -> Node<Msg> {
|
||||
let from = &post.site;
|
||||
// TODO: move avatar/favicon stuff to the server side and and come up with a solution for emails
|
||||
let id = post.thread_id.clone();
|
||||
let is_unread = !post.is_read;
|
||||
let url = &post.url;
|
||||
|
||||
@@ -51,6 +51,15 @@ html {
|
||||
margin-left: 2em;
|
||||
}
|
||||
|
||||
.mail-thread .noreply-news-bloomberg-com img.logo-image {
|
||||
width: initial !important;
|
||||
max-width: 100% !important;
|
||||
}
|
||||
.mail-thread .noreply-news-bloomberg-com h2 {
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
/* Hackaday figures have unreadable black on dark grey */
|
||||
.news-post figcaption.wp-caption-text {
|
||||
background-color: initial !important;
|
||||
@@ -66,4 +75,4 @@ html {
|
||||
height: initial !important;
|
||||
overflow: auto !important;
|
||||
position: static !important;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user