-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
172 additions
and
20 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
use std::{env, fs, path::Path}; | ||
|
||
use crate::{error, info, r#type::Type, success, Res}; | ||
|
||
pub async fn install_openasar(release_type: Type, verbose: bool) -> Res<()> { | ||
// create user var & create .dvm dirs | ||
let user = env::var("USER")?; | ||
fs::create_dir_all(format!("/home/{}/.dvm/bin", user))?; | ||
if verbose { | ||
info!("created .dvm dir") | ||
} | ||
|
||
let pascal_pkg = match release_type { | ||
Type::STABLE => "Discord", | ||
Type::PTB => "DiscordPTB", | ||
Type::CANARY => "DiscordCanary", | ||
Type::DEVELOPMENT => "DiscordDevelopment", | ||
}; | ||
|
||
let exists = Path::new(&format!("/home/{}/.dvm/{}", &user, &pascal_pkg)).exists(); | ||
|
||
if !exists { | ||
error!("{} is not installed", release_type); | ||
} | ||
|
||
let asar_file = format!("/home/{}/.dvm/{}/resources/app.asar", user, pascal_pkg); | ||
|
||
fs::rename(&asar_file, format!("{}.bak", &asar_file))?; | ||
info!("renamed app.asar to app.asar.bak (if discord doesn't work after this, rename it back)"); | ||
|
||
let res = reqwest::get("https://github.com/GooseMod/OpenAsar/releases/download/nightly/app.asar") | ||
.await? | ||
.bytes() | ||
.await?; | ||
|
||
fs::write(&asar_file, res)?; | ||
|
||
success!("installed openasar, if discord is open, restart it"); | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
mod install; | ||
mod install_openasar; | ||
mod remove; | ||
mod show; | ||
mod update; | ||
mod run; | ||
|
||
pub use {install::install, remove::remove, show::show, update::update, run::run}; | ||
pub use {install::install, install_openasar::install_openasar, remove::remove, show::show, update::update, run::run}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters