fc69ae30ab
* feat: depot api downloads * feat: frontend fixes and experimental webview store * feat: sync downloader * feat: cleanup and fixes * feat: encrypted database and fixed resuming * feat: launch option selector * fix: autostart when no options * fix: clippy * fix: clippy x2 * feat: executor launch * feat: executor launch * feat: not installed error handling * feat: better offline handling * feat: dependency popup * fix: cancelation and resuming issues * feat: dedup by platform * feat: new ui for additional components and fix dl manager clog * feat: auto-queue dependencies * feat: depot scanning and ranking * feat: new library fetching stack * In-app store page (Windows + macOS) (#176) * feat: async store loading * feat: fix overscroll behaviour * fix: query params in server protocol * fix: clippy
31 lines
828 B
Rust
31 lines
828 B
Rust
use database::{DB};
|
|
use reqwest_middleware::Error;
|
|
use url::Url;
|
|
|
|
use crate::{
|
|
auth::generate_authorization_header, error::RemoteAccessError, utils::DROP_CLIENT_ASYNC,
|
|
};
|
|
|
|
pub fn generate_url(
|
|
path_components: &[&str],
|
|
query: &[(&str, &str)],
|
|
) -> Result<Url, RemoteAccessError> {
|
|
let path_appended = path_components.join("/");
|
|
let mut base_url = DB.fetch_base_url().join(&path_appended)?;
|
|
{
|
|
let mut queries = base_url.query_pairs_mut();
|
|
for (param, val) in query {
|
|
queries.append_pair(param.as_ref(), val.as_ref());
|
|
}
|
|
}
|
|
Ok(base_url)
|
|
}
|
|
|
|
pub async fn make_authenticated_get(url: Url) -> Result<reqwest::Response, Error> {
|
|
DROP_CLIENT_ASYNC
|
|
.get(url)
|
|
.header("Authorization", generate_authorization_header())
|
|
.send()
|
|
.await
|
|
}
|