feat: linux support

This commit is contained in:
xkeyC
2025-12-23 22:40:05 +08:00
parent 66ead87d47
commit bba2dbd360
20 changed files with 514 additions and 472 deletions

View File

@@ -71,8 +71,8 @@ pub async fn get_rsi_launcher_asar_data(asar_path: &str) -> anyhow::Result<RsiLa
let mut main_js_content: Vec<u8> = Vec::new();
asar.files().iter().for_each(|v| {
let (path, file) = v;
let path_string = path.clone().into_os_string().into_string().unwrap();
if path_string.starts_with("app\\static\\js\\main.") && path_string.ends_with(".js") {
let path_string = path.clone().into_os_string().into_string().unwrap().replace("\\", "/");
if path_string.starts_with("app/static/js/main.") && path_string.ends_with(".js") {
main_js_path = path_string;
main_js_content = file.data().to_vec();
}

View File

@@ -12,12 +12,16 @@ use tao::dpi::{LogicalPosition, LogicalSize};
use tao::event::{Event, WindowEvent};
use tao::event_loop::{ControlFlow, EventLoop, EventLoopBuilder};
use tao::platform::run_return::EventLoopExtRunReturn;
use tao::window::{Icon, Window, WindowBuilder};
use wry::{NewWindowResponse, PageLoadEvent, WebView, WebViewBuilder};
#[cfg(target_os = "windows")]
use tao::platform::windows::EventLoopBuilderExtWindows;
#[cfg(target_os = "linux")]
use tao::platform::unix::EventLoopBuilderExtUnix;
use crate::api::webview_api::{
WebViewCommand, WebViewConfiguration, WebViewEvent, WebViewNavigationState,
};
@@ -263,14 +267,10 @@ fn run_webview_loop(
is_closed: Arc<AtomicBool>,
) {
// Create event loop with any_thread support for non-main thread execution
#[cfg(target_os = "windows")]
let mut event_loop: EventLoop<UserEvent> = EventLoopBuilder::with_user_event()
.with_any_thread(true)
.build();
#[cfg(not(target_os = "windows"))]
let mut event_loop: EventLoop<UserEvent> = EventLoopBuilder::with_user_event().build();
let proxy = event_loop.create_proxy();
// Load window icon from embedded ICO file