Skip to content

Commit 3658e80

Browse files
committed
update row directs to gh releases page
1 parent c7319ea commit 3658e80

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"cSpell.words": [
33
"caniuse",
4+
"concat",
45
"datetime",
56
"quicklook",
67
"robjtede",

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "alfred-caniuse-rs"
3-
version = "0.1.0"
3+
version = "0.1.2"
44
authors = ["Rob Ede <[email protected]>"]
55
edition = "2018"
66
license = "MIT"
@@ -17,5 +17,5 @@ ureq = { version = "2", features = ["json"] }
1717
zstd = "0.6"
1818

1919
[profile.release]
20-
lto = true
21-
opt-level = "z"
20+
# lto = true
21+
# opt-level = "z"

src/update.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ use serde::{Deserialize, Serialize};
1111
use crate::cache::cache_dir;
1212

1313
const DAY_IN_SECS: u64 = 3600 * 24;
14-
const LATEST_ZIP_URL: &str =
15-
"https://github.com/robjtede/alfred-caniuse-rs/releases/latest/download/package.zip";
14+
const LATEST_URL: &str = "https://github.com/robjtede/alfred-caniuse-rs/releases";
15+
const LATEST_ZIP_PATH: &str = "/latest/download/package.zip";
1616
const SELF_VERSION: &str = env!("CARGO_PKG_VERSION");
1717
const UPDATE_CHECK_FILENAME: &str = "update-check.json";
1818

1919
/// Returning None means no action to take.
2020
pub fn self_update_check_item() -> Option<alfred::Item<'static>> {
2121
self_update_check().map(|url| {
2222
alfred::ItemBuilder::new("A workflow update is available.")
23-
.subtitle("Press enter to update.")
23+
.subtitle("Press enter to go to download page.")
2424
.arg(url)
2525
.into_item()
2626
})
@@ -35,7 +35,7 @@ fn self_update_check() -> Option<&'static str> {
3535
Ok(NeedsCheck::No) => return None,
3636

3737
// cached file shows that self is outdated so skip API lookup
38-
Ok(NeedsCheck::KnownOutdated) => return Some(LATEST_ZIP_URL),
38+
Ok(NeedsCheck::KnownOutdated) => return Some(LATEST_URL),
3939

4040
Err(err) => {
4141
eprintln!("update check cache failed: {}", err);
@@ -49,7 +49,7 @@ fn self_update_check() -> Option<&'static str> {
4949

5050
// ignore errors from fetching for cases when no internet connection is available
5151
match self_update_check_inner() {
52-
Ok(true) => return Some(LATEST_ZIP_URL),
52+
Ok(true) => return Some(LATEST_URL),
5353
Ok(false) => {
5454
eprintln!("no update available");
5555
}
@@ -128,7 +128,8 @@ fn self_update_check_inner() -> eyre::Result<bool> {
128128
.timeout(std::time::Duration::from_secs(1))
129129
.build();
130130

131-
let res = client.get(LATEST_ZIP_URL).call()?;
131+
let url = [LATEST_URL, LATEST_ZIP_PATH].concat();
132+
let res = client.get(&url).call()?;
132133
let latest_url = res
133134
.header("location")
134135
.ok_or_else(|| eyre!("no location header in update check response"))?;

0 commit comments

Comments
 (0)