Add version check system

This commit is contained in:
Pierre HUBERT 2022-10-18 08:58:36 +02:00
parent 915426849b
commit eea2ecbf63
23 changed files with 204 additions and 26 deletions

78
rust/Cargo.lock generated
View File

@ -940,6 +940,7 @@ dependencies = [
"futures-channel", "futures-channel",
"futures-core", "futures-core",
"futures-util", "futures-util",
"h2",
"http", "http",
"http-body", "http-body",
"httparse", "httparse",
@ -1019,6 +1020,12 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "ipnet"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b"
[[package]] [[package]]
name = "itoa" name = "itoa"
version = "1.0.4" version = "1.0.4"
@ -1421,6 +1428,45 @@ version = "0.6.27"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244"
[[package]]
name = "reqwest"
version = "0.11.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "431949c384f4e2ae07605ccaa56d1d9d2ecdb5cadd4f9577ccfab29f2e5149fc"
dependencies = [
"base64",
"bytes",
"encoding_rs",
"futures-core",
"futures-util",
"h2",
"http",
"http-body",
"hyper",
"hyper-rustls",
"ipnet",
"js-sys",
"log",
"mime",
"once_cell",
"percent-encoding",
"pin-project-lite",
"rustls",
"rustls-pemfile",
"serde",
"serde_json",
"serde_urlencoded",
"tokio",
"tokio-rustls",
"tower-service",
"url",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"webpki-roots",
"winreg",
]
[[package]] [[package]]
name = "ring" name = "ring"
version = "0.16.20" version = "0.16.20"
@ -1530,6 +1576,7 @@ dependencies = [
"futures", "futures",
"log", "log",
"rand", "rand",
"semver",
"serde", "serde",
"serde_json", "serde_json",
"serde_urlencoded", "serde_urlencoded",
@ -1554,6 +1601,7 @@ dependencies = [
"num", "num",
"num-derive", "num-derive",
"num-traits", "num-traits",
"reqwest",
"rustls", "rustls",
"sea_battle_backend", "sea_battle_backend",
"serde_json", "serde_json",
@ -2111,6 +2159,18 @@ dependencies = [
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
[[package]]
name = "wasm-bindgen-futures"
version = "0.4.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d"
dependencies = [
"cfg-if",
"js-sys",
"wasm-bindgen",
"web-sys",
]
[[package]] [[package]]
name = "wasm-bindgen-macro" name = "wasm-bindgen-macro"
version = "0.2.83" version = "0.2.83"
@ -2160,6 +2220,15 @@ dependencies = [
"untrusted", "untrusted",
] ]
[[package]]
name = "webpki-roots"
version = "0.22.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "368bfe657969fb01238bb756d351dcade285e0f6fcbd36dcb23359a5169975be"
dependencies = [
"webpki",
]
[[package]] [[package]]
name = "winapi" name = "winapi"
version = "0.3.9" version = "0.3.9"
@ -2234,6 +2303,15 @@ version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
[[package]]
name = "winreg"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
dependencies = [
"winapi",
]
[[package]] [[package]]
name = "zstd" name = "zstd"
version = "0.11.2+zstd.1.5.2" version = "0.11.2+zstd.1.5.2"

View File

@ -26,6 +26,7 @@ uuid = { version = "1.1.2", features = ["v4"] }
rand = "0.8.5" rand = "0.8.5"
serde_with = "2.0.1" serde_with = "2.0.1"
tokio = { version = "1", features = ["full"] } tokio = { version = "1", features = ["full"] }
semver = "1.0.14"
[dev-dependencies] [dev-dependencies]
#reqwest = { version = "0.11.11", default-features = false, features = ["json", "rustls-tls"] } #reqwest = { version = "0.11.11", default-features = false, features = ["json", "rustls-tls"] }

View File

@ -1,5 +1,8 @@
//! # Project constants //! # Project constants
pub const MIN_REQUIRED_VERSION: &str = "0.1.0";
pub const CURRENT_VERSION: &str = env!("CARGO_PKG_VERSION");
pub const MIN_BOATS_NUMBER: usize = 1; pub const MIN_BOATS_NUMBER: usize = 1;
pub const MAX_BOATS_NUMBER: usize = 10; pub const MAX_BOATS_NUMBER: usize = 10;

View File

@ -4,6 +4,7 @@ pub use game_map::*;
pub use game_rules::*; pub use game_rules::*;
pub use play_config::*; pub use play_config::*;
pub use printable_map::*; pub use printable_map::*;
pub use version::*;
mod boats_layout; mod boats_layout;
mod current_game_status; mod current_game_status;
@ -11,3 +12,4 @@ mod game_map;
mod game_rules; mod game_rules;
mod play_config; mod play_config;
mod printable_map; mod printable_map;
mod version;

View File

@ -0,0 +1,32 @@
//! # Version Info
//!
//! Contains server version requirements information
use crate::consts;
use crate::utils::res_utils::Res;
use semver::Version;
#[derive(serde::Serialize, serde::Deserialize)]
pub struct VersionInfo {
current: String,
min_required: String,
}
impl VersionInfo {
pub fn load_static() -> Self {
Self {
current: consts::CURRENT_VERSION.to_string(),
min_required: consts::MIN_REQUIRED_VERSION.to_string(),
}
}
/// Check if builtin version is compatible with a remote version or not
pub fn is_compatible_with_static_version(&self) -> Res<bool> {
let static_version = Self::load_static();
let local_current = Version::parse(&static_version.current)?;
let min_required = Version::parse(&self.min_required)?;
Ok(min_required <= local_current)
}
}

View File

@ -4,7 +4,7 @@ use actix_web::{web, App, HttpRequest, HttpResponse, HttpServer, Responder};
use actix_web_actors::ws; use actix_web_actors::ws;
use crate::args::Args; use crate::args::Args;
use crate::data::{GameRules, PlayConfiguration}; use crate::data::{GameRules, PlayConfiguration, VersionInfo};
use crate::dispatcher_actor::DispatcherActor; use crate::dispatcher_actor::DispatcherActor;
use crate::human_player_ws::{HumanPlayerWS, StartMode}; use crate::human_player_ws::{HumanPlayerWS, StartMode};
@ -18,7 +18,12 @@ async fn not_found() -> impl Responder {
HttpResponse::NotFound().json("You missed your strike lol") HttpResponse::NotFound().json("You missed your strike lol")
} }
/// Get bot configuration /// Get version information
async fn version_information() -> impl Responder {
HttpResponse::Ok().json(VersionInfo::load_static())
}
/// Get game configuration
async fn game_configuration() -> impl Responder { async fn game_configuration() -> impl Responder {
HttpResponse::Ok().json(PlayConfiguration::default()) HttpResponse::Ok().json(PlayConfiguration::default())
} }
@ -148,6 +153,7 @@ pub async fn start_server(args: Args) -> std::io::Result<()> {
App::new() App::new()
.app_data(web::Data::new(dispatcher_actor.clone())) .app_data(web::Data::new(dispatcher_actor.clone()))
.wrap(cors) .wrap(cors)
.route("/version", web::get().to(version_information))
.route("/config", web::get().to(game_configuration)) .route("/config", web::get().to(game_configuration))
.route("/play/bot", web::get().to(start_bot_play)) .route("/play/bot", web::get().to(start_bot_play))
.route("/play/create_invite", web::get().to(start_create_invite)) .route("/play/create_invite", web::get().to(start_create_invite))

View File

@ -31,3 +31,4 @@ serde_json = "1.0.85"
hostname = "0.3.1" hostname = "0.3.1"
rustls = "0.20.6" rustls = "0.20.6"
hyper-rustls = { version = "0.23.0", features = ["rustls-native-certs"] } hyper-rustls = { version = "0.23.0", features = ["rustls-native-certs"] }
reqwest = { version = "0.11", features = ["json", "rustls-tls"], default-features = false }

View File

@ -20,7 +20,7 @@ pub struct CliArgs {
value_parser, value_parser,
default_value = "https://seabattleapi.communiquons.org" default_value = "https://seabattleapi.communiquons.org"
)] )]
pub remote_server_uri: String, pub remote_server: String,
/// Local server listen address /// Local server listen address
#[clap(short, long, default_value = "127.0.0.1:5679")] #[clap(short, long, default_value = "127.0.0.1:5679")]

View File

@ -3,12 +3,13 @@ use crate::server;
use futures::stream::{SplitSink, SplitStream}; use futures::stream::{SplitSink, SplitStream};
use futures::{SinkExt, StreamExt}; use futures::{SinkExt, StreamExt};
use hyper_rustls::ConfigBuilderExt; use hyper_rustls::ConfigBuilderExt;
use sea_battle_backend::data::GameRules; use sea_battle_backend::data::*;
use sea_battle_backend::human_player_ws::{ClientMessage, ServerMessage}; use sea_battle_backend::human_player_ws::{ClientMessage, ServerMessage};
use sea_battle_backend::server::{ use sea_battle_backend::server::{
AcceptInviteQuery, BotPlayQuery, CreateInviteQuery, PlayRandomQuery, AcceptInviteQuery, BotPlayQuery, CreateInviteQuery, PlayRandomQuery,
}; };
use sea_battle_backend::utils::res_utils::{boxed_error, Res}; use sea_battle_backend::utils::res_utils::{boxed_error, Res};
use std::error::Error;
use std::fmt::Display; use std::fmt::Display;
use std::sync::mpsc::TryRecvError; use std::sync::mpsc::TryRecvError;
use std::sync::{mpsc, Arc}; use std::sync::{mpsc, Arc};
@ -18,6 +19,11 @@ use tokio_tungstenite::{MaybeTlsStream, WebSocketStream};
type WsStream = WebSocketStream<MaybeTlsStream<TcpStream>>; type WsStream = WebSocketStream<MaybeTlsStream<TcpStream>>;
pub enum GetRemoteVersionError {
ConnectionFailed,
Other(Box<dyn Error>),
}
/// Connection client /// Connection client
/// ///
/// This structure acts as a wrapper around websocket connection that handles automatically parsing /// This structure acts as a wrapper around websocket connection that handles automatically parsing
@ -28,6 +34,24 @@ pub struct Client {
} }
impl Client { impl Client {
/// Get remote server version
pub async fn get_server_version() -> Result<VersionInfo, GetRemoteVersionError> {
let url = format!("{}/version", cli_args().remote_server);
log::debug!("Getting remote information from {} ...", url);
let res = match reqwest::get(url).await {
Ok(r) => r,
Err(e) if e.is_timeout() || e.is_connect() => {
return Err(GetRemoteVersionError::ConnectionFailed)
}
Err(e) => return Err(GetRemoteVersionError::Other(Box::new(e))),
};
res.json()
.await
.map_err(|e| GetRemoteVersionError::Other(Box::new(e)))
}
/// Start to play against a bot /// Start to play against a bot
/// ///
/// When playing against a bot, local server is always used /// When playing against a bot, local server is always used
@ -51,7 +75,7 @@ impl Client {
/// Start to play against a random player /// Start to play against a random player
pub async fn start_random_play<D: Display>(player_name: D) -> Res<Self> { pub async fn start_random_play<D: Display>(player_name: D) -> Res<Self> {
Self::connect_url( Self::connect_url(
&cli_args().remote_server_uri, &cli_args().remote_server,
&format!( &format!(
"/play/random?{}", "/play/random?{}",
serde_urlencoded::to_string(&PlayRandomQuery { serde_urlencoded::to_string(&PlayRandomQuery {
@ -66,7 +90,7 @@ impl Client {
/// Start a play by creating an invite /// Start a play by creating an invite
pub async fn start_create_invite<D: Display>(rules: &GameRules, player_name: D) -> Res<Self> { pub async fn start_create_invite<D: Display>(rules: &GameRules, player_name: D) -> Res<Self> {
Self::connect_url( Self::connect_url(
&cli_args().remote_server_uri, &cli_args().remote_server,
&format!( &format!(
"/play/create_invite?{}", "/play/create_invite?{}",
serde_urlencoded::to_string(&CreateInviteQuery { serde_urlencoded::to_string(&CreateInviteQuery {
@ -82,7 +106,7 @@ impl Client {
/// Start a play by accepting an invite /// Start a play by accepting an invite
pub async fn start_accept_invite<D: Display>(code: String, player_name: D) -> Res<Self> { pub async fn start_accept_invite<D: Display>(code: String, player_name: D) -> Res<Self> {
Self::connect_url( Self::connect_url(
&cli_args().remote_server_uri, &cli_args().remote_server,
&format!( &format!(
"/play/accept_invite?{}", "/play/accept_invite?{}",
serde_urlencoded::to_string(&AcceptInviteQuery { serde_urlencoded::to_string(&AcceptInviteQuery {

View File

@ -2,7 +2,7 @@ extern crate core;
pub mod cli_args; pub mod cli_args;
pub mod client; pub mod client;
pub mod constants; pub mod consts;
pub mod server; pub mod server;
pub mod ui_screens; pub mod ui_screens;
pub mod ui_widgets; pub mod ui_widgets;

View File

@ -18,7 +18,7 @@ use sea_battle_backend::consts::{
use sea_battle_backend::data::GameRules; use sea_battle_backend::data::GameRules;
use sea_battle_backend::utils::res_utils::Res; use sea_battle_backend::utils::res_utils::Res;
use sea_battle_cli_player::cli_args::{cli_args, TestDevScreen}; use sea_battle_cli_player::cli_args::{cli_args, TestDevScreen};
use sea_battle_cli_player::client::Client; use sea_battle_cli_player::client::{Client, GetRemoteVersionError};
use sea_battle_cli_player::server::run_server; use sea_battle_cli_player::server::run_server;
use sea_battle_cli_player::ui_screens::configure_game_rules::GameRulesConfigurationScreen; use sea_battle_cli_player::ui_screens::configure_game_rules::GameRulesConfigurationScreen;
use sea_battle_cli_player::ui_screens::game_screen::GameScreen; use sea_battle_cli_player::ui_screens::game_screen::GameScreen;
@ -35,10 +35,10 @@ async fn run_dev<B: Backend>(
d: TestDevScreen, d: TestDevScreen,
) -> Result<(), Box<dyn Error>> { ) -> Result<(), Box<dyn Error>> {
let res = match d { let res = match d {
TestDevScreen::Popup => popup_screen::PopupScreen::new("Welcome there!!") TestDevScreen::Popup => PopupScreen::new("Welcome there!!")
.show(terminal)? .show(terminal)?
.as_string(), .as_string(),
TestDevScreen::Input => input_screen::InputScreen::new("What it your name ?") TestDevScreen::Input => InputScreen::new("What it your name ?")
.set_title("A custom title") .set_title("A custom title")
.show(terminal)? .show(terminal)?
.as_string(), .as_string(),
@ -50,9 +50,9 @@ async fn run_dev<B: Backend>(
TestDevScreen::SelectBotType => select_bot_type_screen::SelectBotTypeScreen::default() TestDevScreen::SelectBotType => select_bot_type_screen::SelectBotTypeScreen::default()
.show(terminal)? .show(terminal)?
.as_string(), .as_string(),
TestDevScreen::SelectPlayMode => select_play_mode_screen::SelectPlayModeScreen::default() TestDevScreen::SelectPlayMode => {
.show(terminal)? SelectPlayModeScreen::default().show(terminal)?.as_string()
.as_string(), }
TestDevScreen::SetBoatsLayout => { TestDevScreen::SetBoatsLayout => {
let rules = GameRules { let rules = GameRules {
boats_can_touch: true, boats_can_touch: true,
@ -64,7 +64,7 @@ async fn run_dev<B: Backend>(
.as_string() .as_string()
} }
TestDevScreen::ConfigureGameRules => { TestDevScreen::ConfigureGameRules => {
configure_game_rules::GameRulesConfigurationScreen::new(GameRules::default()) GameRulesConfigurationScreen::new(GameRules::default())
.show(terminal)? .show(terminal)?
.as_string() .as_string()
} }
@ -99,6 +99,8 @@ async fn run_app<B: Backend>(terminal: &mut Terminal<B>) -> Res {
return run_dev(terminal, d).await; return run_dev(terminal, d).await;
} }
let mut checked_online_compatibility = false;
let mut rules = GameRules::default(); let mut rules = GameRules::default();
let mut username = "".to_string(); let mut username = "".to_string();
@ -107,6 +109,30 @@ async fn run_app<B: Backend>(terminal: &mut Terminal<B>) -> Res {
let choice = SelectPlayModeScreen::default().show(terminal)?; let choice = SelectPlayModeScreen::default().show(terminal)?;
if let ScreenResult::Ok(c) = choice { if let ScreenResult::Ok(c) = choice {
// Check compatibility
if c.is_online_play_mode() && !checked_online_compatibility {
PopupScreen::new("🖥 Checking remote server version...").show_once(terminal)?;
let valid_version = match Client::get_server_version().await {
Ok(v) => v.is_compatible_with_static_version().unwrap_or(false),
Err(GetRemoteVersionError::ConnectionFailed) => {
PopupScreen::new("❌ Could not connect to remote server!")
.show(terminal)?;
continue;
}
Err(GetRemoteVersionError::Other(e)) => {
log::error!("Could not load remote server information! {:?}", e);
false
}
};
if !valid_version {
PopupScreen::new("❌ Unfortunately, it seems that your version of Sea Battle Cli player is too old to be used online...\n\nPlease update it before trying to play online...").show(terminal)?;
continue;
}
checked_online_compatibility = true;
}
if c.need_player_name() && username.is_empty() { if c.need_player_name() && username.is_empty() {
username = query_player_name(terminal)?; username = query_player_name(terminal)?;
} }

View File

@ -16,7 +16,7 @@ use tui::{Frame, Terminal};
use sea_battle_backend::data::GameRules; use sea_battle_backend::data::GameRules;
use crate::constants::{HIGHLIGHT_COLOR, TICK_RATE}; use crate::consts::{HIGHLIGHT_COLOR, TICK_RATE};
use crate::ui_screens::popup_screen::show_screen_too_small_popup; use crate::ui_screens::popup_screen::show_screen_too_small_popup;
use crate::ui_screens::select_bot_type_screen::SelectBotTypeScreen; use crate::ui_screens::select_bot_type_screen::SelectBotTypeScreen;
use crate::ui_screens::utils::centered_rect_size; use crate::ui_screens::utils::centered_rect_size;

View File

@ -9,7 +9,7 @@ use tui::text::*;
use tui::widgets::*; use tui::widgets::*;
use tui::{Frame, Terminal}; use tui::{Frame, Terminal};
use crate::constants::*; use crate::consts::*;
use crate::ui_screens::utils::centered_rect_size; use crate::ui_screens::utils::centered_rect_size;
use crate::ui_screens::ScreenResult; use crate::ui_screens::ScreenResult;
use crate::ui_widgets::button_widget::ButtonWidget; use crate::ui_widgets::button_widget::ButtonWidget;

View File

@ -16,7 +16,7 @@ use sea_battle_backend::utils::res_utils::Res;
use sea_battle_backend::utils::time_utils::time; use sea_battle_backend::utils::time_utils::time;
use crate::client::Client; use crate::client::Client;
use crate::constants::*; use crate::consts::*;
use crate::ui_screens::confirm_dialog_screen::confirm; use crate::ui_screens::confirm_dialog_screen::confirm;
use crate::ui_screens::popup_screen::{show_screen_too_small_popup, PopupScreen}; use crate::ui_screens::popup_screen::{show_screen_too_small_popup, PopupScreen};
use crate::ui_screens::set_boats_layout_screen::SetBoatsLayoutScreen; use crate::ui_screens::set_boats_layout_screen::SetBoatsLayoutScreen;

View File

@ -10,7 +10,7 @@ use tui::layout::*;
use tui::widgets::*; use tui::widgets::*;
use tui::{Frame, Terminal}; use tui::{Frame, Terminal};
use crate::constants::*; use crate::consts::*;
use crate::ui_screens::utils::*; use crate::ui_screens::utils::*;
use crate::ui_screens::ScreenResult; use crate::ui_screens::ScreenResult;
use crate::ui_widgets::button_widget::ButtonWidget; use crate::ui_widgets::button_widget::ButtonWidget;

View File

@ -9,7 +9,7 @@ use tui::text::*;
use tui::widgets::*; use tui::widgets::*;
use tui::{Frame, Terminal}; use tui::{Frame, Terminal};
use crate::constants::*; use crate::consts::*;
use crate::ui_screens::utils::centered_rect_size; use crate::ui_screens::utils::centered_rect_size;
use crate::ui_screens::ScreenResult; use crate::ui_screens::ScreenResult;
use crate::ui_widgets::button_widget::ButtonWidget; use crate::ui_widgets::button_widget::ButtonWidget;

View File

@ -11,7 +11,7 @@ use tui::{Frame, Terminal};
use sea_battle_backend::data::{BotDescription, BotType, PlayConfiguration}; use sea_battle_backend::data::{BotDescription, BotType, PlayConfiguration};
use crate::constants::{HIGHLIGHT_COLOR, TICK_RATE}; use crate::consts::{HIGHLIGHT_COLOR, TICK_RATE};
use crate::ui_screens::utils::centered_rect_size; use crate::ui_screens::utils::centered_rect_size;
use crate::ui_screens::ScreenResult; use crate::ui_screens::ScreenResult;

View File

@ -1,7 +1,7 @@
use std::io; use std::io;
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
use crate::constants::{HIGHLIGHT_COLOR, TICK_RATE}; use crate::consts::{HIGHLIGHT_COLOR, TICK_RATE};
use crate::ui_screens::utils::centered_rect_size; use crate::ui_screens::utils::centered_rect_size;
use crate::ui_screens::ScreenResult; use crate::ui_screens::ScreenResult;
use crossterm::event; use crossterm::event;
@ -33,6 +33,11 @@ impl SelectPlayModeResult {
pub fn need_custom_rules(&self) -> bool { pub fn need_custom_rules(&self) -> bool {
self == &SelectPlayModeResult::PlayAgainstBot || self == &SelectPlayModeResult::CreateInvite self == &SelectPlayModeResult::PlayAgainstBot || self == &SelectPlayModeResult::CreateInvite
} }
/// Specify whether a play mode is to be played online or not
pub fn is_online_play_mode(&self) -> bool {
self != &SelectPlayModeResult::PlayAgainstBot && self != &SelectPlayModeResult::Exit
}
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone)]

View File

@ -12,7 +12,7 @@ use tui::{Frame, Terminal};
use sea_battle_backend::data::*; use sea_battle_backend::data::*;
use crate::constants::*; use crate::consts::*;
use crate::ui_screens::confirm_dialog_screen::confirm; use crate::ui_screens::confirm_dialog_screen::confirm;
use crate::ui_screens::popup_screen::show_screen_too_small_popup; use crate::ui_screens::popup_screen::show_screen_too_small_popup;
use crate::ui_screens::utils::{centered_rect_size, centered_text}; use crate::ui_screens::utils::{centered_rect_size, centered_text};

View File

@ -1,6 +1,6 @@
use std::fmt::Display; use std::fmt::Display;
use crate::constants::HIGHLIGHT_COLOR; use crate::consts::HIGHLIGHT_COLOR;
use tui::buffer::Buffer; use tui::buffer::Buffer;
use tui::layout::Rect; use tui::layout::Rect;
use tui::style::{Color, Style}; use tui::style::{Color, Style};

View File

@ -1,4 +1,4 @@
use crate::constants::HIGHLIGHT_COLOR; use crate::consts::HIGHLIGHT_COLOR;
use std::fmt::Display; use std::fmt::Display;
use tui::buffer::Buffer; use tui::buffer::Buffer;
use tui::layout::Rect; use tui::layout::Rect;

View File

@ -1,6 +1,6 @@
use std::fmt::Display; use std::fmt::Display;
use crate::constants::HIGHLIGHT_COLOR; use crate::consts::HIGHLIGHT_COLOR;
use tui::buffer::Buffer; use tui::buffer::Buffer;
use tui::layout::Rect; use tui::layout::Rect;
use tui::style::*; use tui::style::*;