Skip to content

Commit 7964eab

Browse files
Fix #53 and #52, and much better list -v
1 parent c4bd136 commit 7964eab

File tree

7 files changed

+125
-107
lines changed

7 files changed

+125
-107
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ jobs:
117117
- GNU Linux (x64 linux gnu)
118118
- macOS Apple Silicon (aarch64 darwin)
119119
- macOS Intel (x64 darwin)
120-
- GNU Windows, e.g. cygwin (x64 windows gnu)
121-
- MSVC Windows (x64 windows msvc)
120+
- GNU Windows, i.e. Cygwin/MinGW (x64 windows gnu)
121+
- Windows (x64 windows msvc)
122122
123123
You can install these by downloading and unzipping the appropriate asset, and moving the executable to ~/bin or any other binary folder in your path.
124124
- name: Update no-gui AUR package

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog for Ferium
22

3+
## `v3.28.3`
4+
5+
- Update to Libium 1.14
6+
- This fixes [#53](https://github.com/theRookieCoder/ferium/issues/53)
7+
- Update Releases description
8+
- Update the way the GitHub PAT is applied to the API
9+
- This fixes [#52](https://github.com/theRookieCoder/ferium/issues/52)
10+
- Significantly improved verbose listing to be more colourful, consistent, and informative
11+
312
## `v3.28.2`
413

514
- Update to Libium 1.12

Cargo.lock

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ferium"
3-
version = "3.28.2"
3+
version = "3.28.3"
44
edition = "2021"
55
authors = ["Ilesh Thiada (theRookieCoder) <[email protected]>", "薛詠謙 (KyleUltimate)", "Daniel Hauck (SolidTux)"]
66
description = "Ferium is a CLI program for managing Minecraft mods from Modrinth, CurseForge, and Github Releases"
@@ -22,7 +22,7 @@ default = ["gui"]
2222
gui = ["libium/gui"]
2323

2424
[dependencies]
25-
tokio = { version = "1.18", default-features = false, features = ["rt-multi-thread", "macros", "time"] }
25+
tokio = { version = "1.18", default-features = false, features = ["rt-multi-thread", "macros"] }
2626
reqwest = { version = "0.11", default-features = false, features = ["rustls-tls"] }
2727
octocrab = { version = "0.16", default-features = false, features = ["rustls"] }
2828
clap = { version = "3.1", features = ["derive"] }
@@ -33,7 +33,7 @@ itertools = "0.10"
3333
fs_extra = "1.2"
3434
colored = "2.0"
3535
ferinth = "2.2"
36-
libium = "1.12"
36+
libium = "1.14"
3737
anyhow = "1.0"
3838
online = "3.0"
3939
semver = "1.0"

src/main.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use ferinth::Ferinth;
1010
use furse::Furse;
1111
use lazy_static::lazy_static;
1212
use libium::config;
13+
use octocrab::OctocrabBuilder;
1314
use std::sync::Arc;
1415
use subcommands::{add, upgrade};
1516
use tokio::{fs::create_dir_all, io::AsyncReadExt, runtime, spawn};
@@ -39,13 +40,14 @@ fn main() {
3940
}
4041

4142
async fn actual_main(cli_app: Ferium) -> Result<()> {
42-
let github = {
43-
let mut builder = octocrab::OctocrabBuilder::new();
44-
if let Some(token) = cli_app.github_token {
45-
builder = builder.personal_token(token);
46-
}
47-
octocrab::initialise(builder)
48-
}?;
43+
let github = Arc::new(
44+
cli_app
45+
.github_token
46+
.map_or_else(OctocrabBuilder::new, |token| {
47+
OctocrabBuilder::new().personal_token(token)
48+
})
49+
.build()?,
50+
);
4951
let modrinth = Arc::new(Ferinth::new());
5052
let curseforge = Arc::new(Furse::new(env!(
5153
"CURSEFORGE_API_KEY",

src/subcommands/add.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::{THEME, TICK};
2-
use anyhow::Result;
2+
use anyhow::{anyhow, Result};
33
use dialoguer::Confirm;
44
use ferinth::structures::version_structs::DependencyType;
55
use ferinth::Ferinth;
@@ -23,13 +23,13 @@ pub async fn github(
2323
)
2424
.await?;
2525
upgrade::get_latest_compatible_asset(
26-
repo_handler,
26+
&repo_handler.releases().list().send().await?.items,
2727
&profile.game_version,
2828
&profile.mod_loader,
2929
should_check_game_version,
3030
should_check_mod_loader,
3131
)
32-
.await?;
32+
.ok_or_else(|| anyhow!("Repository does not release mods compatible with your profile"))?;
3333
println!("{} ({})", *TICK, repo.name);
3434
Ok(())
3535
}
@@ -51,14 +51,13 @@ pub async fn modrinth(
5151
)
5252
.await?;
5353
let latest_version = upgrade::get_latest_compatible_version(
54-
modrinth.clone(),
55-
&project.id,
54+
&modrinth.list_versions(&project.id).await?,
5655
&profile.game_version,
5756
&profile.mod_loader,
5857
should_check_game_version,
5958
should_check_mod_loader,
6059
)
61-
.await?
60+
.ok_or_else(|| anyhow!("Mod is not compatible with your profile"))?
6261
.1;
6362
println!("{} ({})", *TICK, project.title);
6463
for dependency in &latest_version.dependencies {
@@ -115,14 +114,13 @@ pub async fn curseforge(
115114
)
116115
.await?;
117116
let latest_file = upgrade::get_latest_compatible_file(
118-
curseforge.clone(),
119-
project.id,
117+
curseforge.get_mod_files(project.id).await?,
120118
&profile.game_version,
121119
&profile.mod_loader,
122120
should_check_game_version,
123121
should_check_mod_loader,
124122
)
125-
.await?
123+
.ok_or_else(|| anyhow!("Mod is not compatible with your profile"))?
126124
.0;
127125
println!("{} ({})", *TICK, project.name);
128126
for dependency in &latest_file.dependencies {

0 commit comments

Comments
 (0)