Skip to content

Commit

Permalink
Release v0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
supdrewin committed Dec 18, 2024
1 parent 828fddf commit 59cdbc4
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ permissions:
contents: write

env:
BINARY: wuwa-beta-downloader.exe
BINARY: wuwa-downloader.exe
CARGO_TERM_COLOR: always

jobs:
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "wuwa-beta-downloader"
version = "0.2.0"
name = "wuwa-downloader"
version = "0.3.0"
authors = ["Alvin Null <[email protected]>"]
edition = "2021"
description = "WuWa Beta Downloader powered by Rust"
description = "WuWa Downloader powered by Rust"
repository = "https://github.com/supdrewin/wuwa-beta-downloader/"
license = "MIT"

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# WuWa Beta Downloader
# WuWa Downloader

### What's this

This is a CLI program aim to download `Wuthering Waves Beta` in parallel!
This is a CLI program aim to download `Wuthering Waves` in parallel!

### How to use

Expand All @@ -11,6 +11,7 @@ Just run the program directly or pass the arguments to program.
- use `--mirror/-m` to specify the index of CDN from list
- use `--threads/-t` to specify the number of download threads
- use `--path/-p` to specify the game download directory
- use `--beta/-b` to download resources from BETA channel
- use `--help/-h` to show the usage of this program
- use `--version/-V` to show the version of this program

Expand Down
14 changes: 10 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::{
};

use base16ct::lower;
use clap::Parser;
use clap::{ArgAction::Count, Parser};
use console::Term;
use futures_util::StreamExt;
use indicatif::{MultiProgress, ProgressBar, ProgressState, ProgressStyle};
Expand All @@ -21,8 +21,11 @@ use tokio::{fs::File, io::AsyncWriteExt, sync::Mutex};
type Result<T> = std::result::Result<T, Box<dyn Error + Send + Sync>>;

#[rustfmt::skip]
const STYLE: &str = "{spinner:.green} {item:40} [{elapsed_precise}] [{bar:40.cyan/blue}] {bytes}/{total_bytes}";
const URL: &str = "https://prod-cn-alicdn-gamestarter.kurogame.com/pcstarter/prod/game/G152/10008_Pa0Q0EMFxukjEqX33pF9Uyvdc8MaGPSz/index.json";
const STYLE: &str = r"{spinner:.green} {item:40} [{elapsed_precise}] [{bar:40.cyan/blue}] {bytes}/{total_bytes}";
const URL: [&str; 2] = [
r"https://prod-cn-alicdn-gamestarter.kurogame.com/pcstarter/prod/game/G152/10003_Y8xXrXk65DqFHEDgApn3cpK5lfczpFx5/index.json",
r"https://prod-cn-alicdn-gamestarter.kurogame.com/pcstarter/prod/game/G152/10008_Pa0Q0EMFxukjEqX33pF9Uyvdc8MaGPSz/index.json",
];

#[derive(Parser)]
#[command(version)]
Expand All @@ -35,6 +38,9 @@ struct Cli {

#[arg(short, long, value_name = "DIR")]
path: Option<PathBuf>,

#[arg(short, long, action = Count)]
beta: usize,
}

#[tokio::main]
Expand All @@ -52,7 +58,7 @@ async fn main() -> Result<()> {

let mut handles = vec![];

let index = reqwest::get(URL).await?.json::<Value>().await?;
let index = reqwest::get(URL[cli.beta]).await?.json::<Value>().await?;

let path = index["default"]["resources"].as_str().unwrap();
let base = index["default"]["resourcesBasePath"].as_str().unwrap();
Expand Down

0 comments on commit 59cdbc4

Please sign in to comment.