Skip to content

Commit

Permalink
Added native-tls-alpn + fixed issue when fullscreen on board page
Browse files Browse the repository at this point in the history
tuqqu committed Sep 4, 2024
1 parent 292a27c commit 8f6ce4b
Showing 6 changed files with 614 additions and 415 deletions.
1,006 changes: 599 additions & 407 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ license = "MIT"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
reqwest = { version = "0.11.24", features = ["json"] }
reqwest = { version = "0.12.7", features = ["json", "native-tls-alpn"] }
tokio = { version = "1.36.0", features = ["full"] }
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
1 change: 0 additions & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
@@ -224,7 +224,6 @@ impl App {
self.shown_state.board_list
}

#[allow(dead_code)]
pub(crate) fn shown_thread_list(&mut self) -> bool {
self.shown_state.thread_list
}
6 changes: 3 additions & 3 deletions src/client/mod.rs
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ impl ChanClient {
pub(crate) async fn get_boards(&self) -> ClientResult<Vec<Board>> {
let boards_response: BoardListResponse = self
.client
.get(&self.api.boards())
.get(self.api.boards())
.send()
.await?
.json::<BoardListResponse>()
@@ -36,7 +36,7 @@ impl ChanClient {
pub(crate) async fn get_threads(&self, board: &str, page: u8) -> ClientResult<Vec<Thread>> {
let threads_response: ThreadListResponse = self
.client
.get(&self.api.threads(board, page))
.get(self.api.threads(board, page))
.send()
.await?
.json::<ThreadListResponse>()
@@ -48,7 +48,7 @@ impl ChanClient {
pub(crate) async fn get_thread(&self, board: &str, no: u64) -> ClientResult<Vec<ThreadPost>> {
let thread_response: ThreadResponse = self
.client
.get(&self.api.thread(board, no))
.get(self.api.thread(board, no))
.send()
.await?
.json::<ThreadResponse>()
1 change: 1 addition & 0 deletions src/keybinds/mod.rs
Original file line number Diff line number Diff line change
@@ -90,6 +90,7 @@ define_keybinds! {

/// Error parsing keybind configuration file
#[derive(Debug)]
#[allow(dead_code)]
pub enum KeybindsError {
/// Failed to parse single keybind
Parse {
13 changes: 10 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -64,7 +64,12 @@ fn main() -> Result<(), io::Error> {

let mut boards: Vec<Board> = vec![];
runtime.block_on(async {
boards = client.get_boards().await.unwrap();
let result = client.get_boards().await;

match result {
Ok(data) => boards = data,
Err(_) => panic!("Could not fetch boards"),
};
});

let mut app = App::new(boards, vec![], vec![], &keybinds);
@@ -241,8 +246,10 @@ fn main() -> Result<(), io::Error> {
_ if input == keybinds.fullscreen => {
match selected_field {
SelectedField::BoardList => {
app.toggle_shown_board_list();
selected_field = SelectedField::ThreadList;
if app.shown_thread_list() {
app.toggle_shown_board_list();
selected_field = SelectedField::ThreadList;
}
}
SelectedField::ThreadList => {
if app.shown_thread() {

0 comments on commit 8f6ce4b

Please sign in to comment.