aboutsummaryrefslogtreecommitdiff
path: root/src
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 /src
parentfeat(Cargo.toml): bump version (diff)
downloadsydney-3d44b69f72ea3bc25e8f85b0ce5a221ea0017df8.tar.xz
sydney-3d44b69f72ea3bc25e8f85b0ce5a221ea0017df8.zip
feat(main.rs): add outdated checkv0.1.6
Diffstat (limited to 'src')
-rw-r--r--src/main.rs27
1 files changed, 27 insertions, 0 deletions
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,