1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
use std::io;
pub mod check;
pub mod downloader;
pub mod router;
#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("Failed to open app version cache file for reading")]
ReadVersionCache(#[source] io::Error),
#[error("Failed to open app version cache file for writing")]
WriteVersionCache(#[source] io::Error),
#[error("Failure in serialization of the version info")]
Serialize(#[source] serde_json::Error),
#[error("Failure in deserialization of the version info")]
Deserialize(#[source] serde_json::Error),
#[error("Failed to check the latest app version")]
Download(#[source] mullvad_api::rest::Error),
#[error("API availability check failed")]
ApiCheck(#[source] mullvad_api::availability::Error),
#[error("Response is missing a valid stable version")]
MissingStable,
#[error("Clearing version check cache due to old version")]
OutdatedVersion,
#[error("Version updater is down")]
VersionUpdaterDown,
#[error("Version router is down")]
VersionRouterClosed,
#[error("Version cache update was aborted")]
UpdateAborted,
}
/// Contains the date of the git commit this was built from
pub const COMMIT_DATE: &str = include_str!(concat!(env!("OUT_DIR"), "/git-commit-date.txt"));
pub fn is_beta_version() -> bool {
mullvad_version::VERSION.contains("beta")
}
pub fn is_dev_version() -> bool {
mullvad_version::VERSION.contains("dev")
}
pub fn log_version() {
log::info!(
"Starting {} - {} {}",
env!("CARGO_PKG_NAME"),
mullvad_version::VERSION,
COMMIT_DATE,
)
}
|