aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-07-18 03:43:56 +0000
committerFuwn <[email protected]>2022-07-18 03:43:56 +0000
commit3d44b69f72ea3bc25e8f85b0ce5a221ea0017df8 (patch)
tree2b348771a56c292e0f22b6c43db50a2eaf99310f
parentfeat(Cargo.toml): bump version (diff)
downloadsydney-3d44b69f72ea3bc25e8f85b0ce5a221ea0017df8.tar.xz
sydney-3d44b69f72ea3bc25e8f85b0ce5a221ea0017df8.zip
feat(main.rs): add outdated checkv0.1.6
-rw-r--r--Cargo.toml2
-rw-r--r--src/main.rs27
2 files changed, 28 insertions, 1 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 796003c..6c8ee2e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -2,7 +2,7 @@
[package]
name = "sydney"
-version = "0.1.5"
+version = "0.1.6"
authors = ["Fuwn <[email protected]>"]
edition = "2021"
description = "Vim-like, Command-line Gemini Client"
diff --git a/src/main.rs b/src/main.rs
index 77841a9..d04b84a 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -79,6 +79,33 @@ Report bugs to https://github.com/gemrest/sydney/issues"#,
let mut stdout = std::io::stdout();
+ match germ::request::request(
+ &url::Url::parse("gemini://fuwn.me/api/sydney/version").unwrap(),
+ ) {
+ Ok(response) =>
+ if let Some(content) = response.content() {
+ if content > &String::from(env!("CARGO_PKG_VERSION")) {
+ app.error = Some(format!(
+ "Your Sydney version ({}) is outdated. It is recommended that you \
+ update to the newest version ({}).",
+ env!("CARGO_PKG_VERSION"),
+ content,
+ ));
+ }
+ } else {
+ app.error = Some(
+ "Could not check if Sydney has a newer version because the response \
+ had no content. Please try again later."
+ .to_string(),
+ );
+ },
+ Err(error) =>
+ app.error = Some(format!(
+ "Could not check if Sydney has a newer version: {}",
+ error
+ )),
+ }
+
execute!(
stdout,
terminal::EnterAlternateScreen,