Compare commits

..

5 Commits

5 changed files with 53 additions and 40 deletions

View File

@ -1,29 +1,21 @@
# Drop App
# Drop Desktop Client
Drop app is the companion app for [Drop](https://github.com/Drop-OSS/drop). It uses a Tauri base with Nuxt 3 + TailwindCSS on top of it, so we can re-use components from the web UI.
The Drop Desktop Client is the companion app for [Drop](https://github.com/Drop-OSS/drop). It is the official & intended way to download and play games on your Drop server.
## Running
Before setting up the drop app, be sure that you have a server set up.
The instructions for this can be found on the [Drop Docs](https://docs.droposs.org/docs/guides/quickstart)
## Internals
## Current features
Currently supported are the following features:
- Signin (with custom server)
- Database registering & recovery
- Dynamic library fetching from server
- Installing & uninstalling games
- Download progress monitoring
- Launching / playing games
It uses a Tauri base with Nuxt 3 + TailwindCSS on top of it, so we can re-use components from the web UI.
## Development
Before setting up a development environemnt, be sure that you have a server set up. The instructions for this can be found on the [Drop Docs](https://docs.droposs.org/docs/guides/quickstart).
Install dependencies with `yarn`
Then, install dependencies with `yarn`. This'll install the custom builder's dependencies. Then, check everything works properly with `yarn tauri build`.
Run the app in development with `yarn tauri dev`. NVIDIA users on Linux, use shell script `./nvidia-prop-dev.sh`
Run the app in development with `yarn tauri dev`. NVIDIA users on Linux, use shell script `./nvidia-prop-dev.sh`
To manually specify the logging level, add the environment variable `RUST_LOG=[debug, info, warn, error]` to `yarn tauri dev`:
e.g. `RUST_LOG=debug yarn tauri dev`
## Contributing
Check the original [Drop repo](https://github.com/Drop-OSS/drop/blob/main/CONTRIBUTING.md) for contributing guidelines.
Check out the contributing guide on our Developer Docs: [Drop Developer Docs - Contributing](https://developer.droposs.org/contributing).

View File

@ -486,6 +486,9 @@ fn run_on_tray<T: FnOnce()>(f: T) {
if match std::env::var("NO_TRAY_ICON") {
Ok(s) => s.to_lowercase() != "true",
Err(_) => true,
} || match option_env!("NO_TRAY_ICON") {
Some(s) => s.to_lowercase() != "true",
None => true,
} {
(f)();
}

View File

@ -346,24 +346,19 @@ impl ProcessManager<'_> {
.to_string();
#[cfg(target_os = "windows")]
let mut command = {
use std::os::windows::process::CommandExt;
let mut command = Command::new("cmd");
command.raw_arg(format!("/C \"{}\"", &launch_string));
command.creation_flags(0x08000000);
command
};
#[cfg(unix)]
let mut command = {
let mut command: Command = Command::new("sh");
command.args(vec!["-c", &launch_string]);
command
};
use std::os::windows::process::CommandExt;
#[cfg(target_os = "windows")]
let mut command = Command::new("cmd");
#[cfg(target_os = "windows")]
command.raw_arg(format!("/C \"{}\"", &launch_string));
info!("launching (in {install_dir}): {launch_string}",);
#[cfg(unix)]
let mut command: Command = Command::new("sh");
#[cfg(unix)]
command.args(vec!["-c", &launch_string]);
debug!("final launch string:\n\n{launch_string}\n");
command

View File

@ -1,6 +1,6 @@
use std::{
fs::{self, File},
io::Read,
io::{self, Read},
sync::{LazyLock, Mutex},
time::Duration,
};
@ -22,33 +22,48 @@ struct DropHealthcheck {
app_name: String,
}
static DROP_CERT_BUNDLE: LazyLock<Vec<Certificate>> = LazyLock::new(fetch_certificates);
static DROP_CERT_BUNDLE: LazyLock<Vec<Certificate>> = LazyLock::new(|| {
fetch_certificates().unwrap_or_else(|e| panic!("Failed to fetch certificates with error {}", e))
});
pub static DROP_CLIENT_SYNC: LazyLock<reqwest::blocking::Client> = LazyLock::new(get_client_sync);
pub static DROP_CLIENT_ASYNC: LazyLock<reqwest::Client> = LazyLock::new(get_client_async);
pub static DROP_CLIENT_WS_CLIENT: LazyLock<reqwest::Client> = LazyLock::new(get_client_ws);
fn fetch_certificates() -> Vec<Certificate> {
fn fetch_certificates() -> Result<Vec<Certificate>, io::Error> {
let certificate_dir = DATA_ROOT_DIR.join("certificates");
let mut certs = Vec::new();
match fs::read_dir(certificate_dir) {
match fs::read_dir(&certificate_dir) {
Ok(c) => {
for entry in c {
match entry {
Ok(c) => {
let mut buf = Vec::new();
File::open(c.path()).unwrap().read_to_end(&mut buf).unwrap();
File::open(c.path())?.read_to_end(&mut buf)?;
for cert in Certificate::from_pem_bundle(&buf).unwrap() {
for cert in match Certificate::from_pem_bundle(&buf) {
Ok(certificates) => certificates,
Err(e) => {
warn!("Could not parse pem bundle with error {}. Skipping", e);
continue;
}
} {
certs.push(cert);
}
info!(
"added {} certificate(s) from {}",
certs.len(),
c.file_name().into_string().unwrap()
c.file_name().display().to_string()
);
}
Err(_) => todo!(),
Err(e) => {
warn!(
"Could not open directory entry {} in certificates with error {}",
certificate_dir.display(),
e
);
continue;
}
}
}
}
@ -56,7 +71,7 @@ fn fetch_certificates() -> Vec<Certificate> {
debug!("not loading certificates due to error: {e}");
}
};
certs
Ok(certs)
}
pub fn get_client_sync() -> reqwest::blocking::Client {

View File

@ -38,6 +38,14 @@
},
"wix": null
},
"linux": {
"appimage": {
"bundleMediaFramework": false,
"files": {
"/usr/lib/libayatana-appindicator3.so.1": "/usr/lib/libayatana-appindicator3.so.1"
}
}
},
"icon": [
"icons/32x32.png",
"icons/128x128.png",