Skip to content

Commit

Permalink
plutools -> getserve.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
mxve committed May 10, 2024
1 parent feeda2e commit 140228e
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 22 deletions.
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@



# Plutonium Updater CLI [![alt text](https://plutools.pw/assets/img/plutools_64.png)](https://plutools.pw/) [![alt text](http://i.epvpimg.com/2m4qdab.png)](https://discord.gg/SnJQusteNZ)
# Plutonium Updater CLI [![alt text](github_assets/logo.png)](https://plutools.pw/) [![alt text](github_assets/discord.png)](https://discord.gg/SnJQusteNZ)

![](github_assets/preview.gif)

Expand Down Expand Up @@ -85,12 +85,11 @@ or
- Returns latest version number
- ```--no-color```
- Disable colors
- ```--plutools-list```
- List revisions archived by plutools.pw
- ```--plutools <revision>```
- Install revision archived by plutools.pw
- Use ```-f``` when downgrading
- :warning: Third-party hosted binary files :warning:
- ```--archive-list``` | ~~```--plutools-list```~~
- List revisions archived on plutonium-archive.getserve.rs
- ```--archive <revision>``` | ~~```--plutools```~~
- Install revision archived on plutonium-archive.getserve.rs
- Downgrading is not recommended, use an empty directory instead. If downgrading use ```-f```.
- ```--backup```
- Create backup of current version while updating
- ```--manual-backup```
Expand All @@ -116,6 +115,6 @@ or
2. Clone the repo
3. Build
- ```cargo build --release```
4. (Linux/Optional) Strip binary
4. (Linux/Optional) Strip binary
- ```strip target/release/plutonium-updater```
5. Grab binary from ```target/release/plutonium-updater(.exe)```
Binary file added github_assets/discord.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added github_assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ pub struct Args {
#[clap(long)]
pub no_color: bool,

/// List revisions archived by plutools
#[clap(long)]
pub plutools_list: bool,
/// List archived revisions from plutonium-archive.getserve.rs
#[clap(long, alias = "plutools-list")]
pub archive_list: bool,

/// Install revision archived by plutools | WARNING: Third-party hosted files
#[clap(long, default_value = "0")]
pub plutools: String,
/// Install archived revision from plutonium-archive.getserve.rs
#[clap(long, default_value = "0", alias = "plutools")]
pub archive: String,

/// Create backup of current version while updating
#[clap(long)]
Expand Down
18 changes: 10 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ fn copy_if_exists(origin: &Path, destination: &Path) {
// https://stackoverflow.com/a/58063083
fn get_subdirs(dir: &Path) -> Result<Vec<PathBuf>, io::Error> {
Ok(fs::read_dir(dir)?
.into_iter()
.filter(|r| r.is_ok())
.map(|r| r.unwrap().path())
.filter(|r| r.is_dir())
Expand Down Expand Up @@ -128,7 +127,7 @@ fn copy_version(info: &CdnInfo, source_dir: &Path, destination_dir: &Path) {

fn get_archived_revisions() -> Vec<u16> {
let archive_revisions: Vec<u16> = DeJson::deserialize_json(&http::get_body_string(
"https://updater-archive.plutools.pw/revisions.json",
"https://plutonium-archive.getserve.rs/revisions.json",
))
.unwrap();
archive_revisions
Expand All @@ -146,7 +145,10 @@ fn display_archived_revisions() {
fn get_archive_url(revision: u16) -> String {
let archive_revisions = get_archived_revisions();
if archive_revisions.contains(&revision) {
format!("https://updater-archive.plutools.pw/{}/info.json", revision)
format!(
"https://plutonium-archive.getserve.rs/{}/info.json",
revision
)
} else {
panic!("Revision {} is not available in the archive.", revision);
}
Expand Down Expand Up @@ -367,13 +369,13 @@ fn main() {
let args = args::get();
setup_env(args.no_color);

let plutools_revision: u16 = args
.plutools
let archive_revision: u16 = args
.archive
.parse()
.unwrap_or_else(|_| panic!("{}: {}", "Error".bright_red(), "Invalid archived version"));

let cdn = if plutools_revision > 0 {
get_archive_url(plutools_revision)
let cdn = if archive_revision > 0 {
get_archive_url(archive_revision)
} else {
args.cdn_url.to_string()
};
Expand All @@ -400,7 +402,7 @@ fn main() {
}
}

if args.plutools_list {
if args.archive_list {
display_archived_revisions();
std::process::exit(0);
}
Expand Down

0 comments on commit 140228e

Please sign in to comment.