Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions main/assets/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ html,
body {
-ms-overflow-style: none; /* IE and Edge /
scrollbar-width: none; / Firefox */
overscroll-behavior: none;
}

/* Hide scrollbar for Chrome, Safari and Opera */
Expand Down
13 changes: 8 additions & 5 deletions main/components/LibrarySearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@
<span class="text-sm font-semibold font-display">{{
nav.name
}}</span>
<span class="ml-6 flex h-7 items-center">
<PlusSmallIcon v-if="!open" class="size-6" aria-hidden="true" />
<MinusSmallIcon v-else class="size-6" aria-hidden="true" />
<span class="ml-6 relative flex size-4">
<MinusIcon class="absolute inset-0 size-4" aria-hidden="true" />
<MinusIcon
:class="[ !open ? 'rotate-90' : 'rotate-0', 'transition-all absolute inset-0 size-4']"
aria-hidden="true"
/>
</span>
</DisclosureButton>
</dt>
Expand Down Expand Up @@ -123,8 +126,8 @@ import { Disclosure, DisclosureButton, DisclosurePanel } from "@headlessui/vue";
import {
ArrowPathIcon,
MagnifyingGlassIcon,
MinusSmallIcon,
PlusSmallIcon,
MinusIcon,
PlusIcon,
} from "@heroicons/vue/20/solid";
import { invoke } from "@tauri-apps/api/core";
import {
Expand Down
1 change: 1 addition & 0 deletions src-tauri/Cargo.lock

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

2 changes: 1 addition & 1 deletion src-tauri/games/src/library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use remote::{
auth::generate_authorization_header,
error::RemoteAccessError,
requests::generate_url,
utils::{DROP_CLIENT_ASYNC, DROP_CLIENT_SYNC},
utils::DROP_CLIENT_ASYNC
};
use serde::{Deserialize, Serialize};
use std::fs::remove_dir_all;
Expand Down
1 change: 1 addition & 0 deletions src-tauri/remote/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ edition = "2024"
[dependencies]
async-trait = "0.1.89"
bitcode = "0.6.7"
bytes = "1.11.0"
chrono = "0.4.42"
client = { path = "../client", version = "0.1.0" }
database = { path = "../database", version = "0.1.0" }
Expand Down
1 change: 0 additions & 1 deletion src-tauri/remote/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![feature(slice_as_array)]
#![feature(slice_concat_trait)]
#![feature(sync_nonpoison)]
#![feature(nonpoison_mutex)]
Expand Down
23 changes: 8 additions & 15 deletions src-tauri/remote/src/server_proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ use http::{
HeaderMap, HeaderValue, Request, Response, StatusCode, Uri, header::USER_AGENT,
uri::PathAndQuery,
};
use log::{error, warn};
use log::{error, info, warn};
use tauri::UriSchemeResponder;

use crate::utils::DROP_CLIENT_SYNC;
use crate::utils::DROP_CLIENT_ASYNC;

pub async fn handle_server_proto_offline_wrapper(
request: Request<Vec<u8>>,
Expand All @@ -29,8 +29,8 @@ pub async fn handle_server_proto_offline(
.expect("Failed to build error response for proto offline"))
}

pub fn handle_server_proto_wrapper(request: Request<Vec<u8>>, responder: UriSchemeResponder) {
match handle_server_proto(request) {
pub async fn handle_server_proto_wrapper(request: Request<Vec<u8>>, responder: UriSchemeResponder) {
match handle_server_proto(request).await {
Ok(r) => responder.respond(r),
Err(e) => {
warn!("Cache error: {e}");
Expand All @@ -45,7 +45,7 @@ pub fn handle_server_proto_wrapper(request: Request<Vec<u8>>, responder: UriSche
}
}

fn handle_server_proto(request: Request<Vec<u8>>) -> Result<Response<Vec<u8>>, StatusCode> {
async fn handle_server_proto(request: Request<Vec<u8>>) -> Result<Response<Vec<u8>>, StatusCode> {
let (remote_uri, web_token) = {
let db_handle = borrow_db_checked();
let auth = match db_handle.auth.as_ref() {
Expand All @@ -67,14 +67,7 @@ fn handle_server_proto(request: Request<Vec<u8>>) -> Result<Response<Vec<u8>>, S
(remote_uri, web_token)
};

let path = request.uri().path();

let mut new_uri = request.uri().clone().into_parts();
new_uri.path_and_query = Some(
PathAndQuery::from_str(path)
.inspect_err(|v| warn!("{:?}", v))
.expect("Failed to parse request path in proto"),
);
new_uri.authority = remote_uri.authority().cloned();
new_uri.scheme = remote_uri.scheme().cloned();
let err_msg = &format!("Failed to build new uri from parts {new_uri:?}");
Expand All @@ -91,11 +84,11 @@ fn handle_server_proto(request: Request<Vec<u8>>) -> Result<Response<Vec<u8>>, S
HeaderValue::from_str(&format!("Bearer {web_token}")).unwrap(),
);

let client = DROP_CLIENT_SYNC.clone();
let response = match client
let response = match DROP_CLIENT_ASYNC
.request(request.method().clone(), new_uri.to_string())
.headers(headers)
.send()
.await
{
Ok(response) => response,
Err(e) => {
Expand All @@ -116,7 +109,7 @@ fn handle_server_proto(request: Request<Vec<u8>>) -> Result<Response<Vec<u8>>, S
}
};

let response_body = match response.bytes() {
let response_body = match response.bytes().await {
Ok(bytes) => bytes,
Err(e) => return Err(e.status().unwrap_or(StatusCode::INTERNAL_SERVER_ERROR)),
};
Expand Down
8 changes: 4 additions & 4 deletions src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ use std::{
sync::nonpoison::Mutex, time::SystemTime,
};

use ::client::{
app_state::AppState, app_status::AppStatus, autostart::sync_autostart_on_startup,
};
use ::client::{app_state::AppState, app_status::AppStatus, autostart::sync_autostart_on_startup};
use ::download_manager::DownloadManagerWrapper;
use ::games::scan::scan_install_dirs;
use ::process::ProcessManagerWrapper;
Expand Down Expand Up @@ -412,7 +410,9 @@ pub fn run() {
});
})
.register_asynchronous_uri_scheme_protocol("server", |_ctx, request, responder| {
handle_server_proto_wrapper(request, responder);
tauri::async_runtime::spawn(async move {
handle_server_proto_wrapper(request, responder).await;
});
})
.on_window_event(|window, event| {
if let WindowEvent::CloseRequested { api, .. } = event {
Expand Down
Loading