Updated dependencies. Fixed errors
703
Cargo.lock
generated
32
Cargo.toml
|
|
@ -4,35 +4,35 @@ version = "5.0.0"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
once_cell = "1.3.1"
|
once_cell = "1.19"
|
||||||
native-windows-gui = { version = "1.0.4", features = [
|
native-windows-gui = { version = "1", features = [
|
||||||
"high-dpi",
|
"high-dpi",
|
||||||
"notice",
|
"notice",
|
||||||
"tray-notification",
|
"tray-notification",
|
||||||
"menu",
|
"menu",
|
||||||
] }
|
] }
|
||||||
native-windows-derive = "1.0.3"
|
native-windows-derive = "1"
|
||||||
winapi = { version = "0.3.9", features = [
|
winapi = { version = "0.3.9", features = [
|
||||||
"libloaderapi",
|
"libloaderapi",
|
||||||
"handleapi",
|
"handleapi",
|
||||||
"wincon",
|
"wincon",
|
||||||
"winuser",
|
"winuser",
|
||||||
|
"namedpipeapi"
|
||||||
] }
|
] }
|
||||||
webview2 = "0.1.0"
|
webview2 = "0.1.4"
|
||||||
webview2-sys = "0.1.0-beta.1"
|
webview2-sys = "0.1.1"
|
||||||
libmpv = "2.0.1"
|
libmpv-sirno = "2.0.2-fork.1"
|
||||||
libmpv-sys = "3.1.0"
|
libmpv-sys-sirno = "2.0.0-fork.1"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
clap = { version = "3.1.12", features = ["derive", "unicode"] }
|
clap = { version = "4", features = ["derive", "unicode"] }
|
||||||
open = "2"
|
open = "5"
|
||||||
urlencoding = "2.1.0"
|
urlencoding = "2"
|
||||||
bitflags = "1.2.1"
|
bitflags = "2"
|
||||||
win32job = "1"
|
win32job = "2"
|
||||||
parse-display = "0.5.1"
|
parse-display = "0.9"
|
||||||
flume = "0.10.9"
|
flume = "0.11"
|
||||||
kernel32-sys = "0.2"
|
whoami = "1.5"
|
||||||
whoami = "1.2.1"
|
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
winres = "0.1"
|
winres = "0.1"
|
||||||
|
|
|
||||||
17
build.rs
|
|
@ -7,6 +7,23 @@ fn main() {
|
||||||
let copyright = format!("Copyright © {} Smart Code OOD", now.year());
|
let copyright = format!("Copyright © {} Smart Code OOD", now.year());
|
||||||
let exe_name = format!("{}.exe", env::var("CARGO_PKG_NAME").unwrap());
|
let exe_name = format!("{}.exe", env::var("CARGO_PKG_NAME").unwrap());
|
||||||
let mut res = winres::WindowsResource::new();
|
let mut res = winres::WindowsResource::new();
|
||||||
|
res.set_manifest(r#"
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||||
|
<dependency>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity
|
||||||
|
type="win32"
|
||||||
|
name="Microsoft.Windows.Common-Controls"
|
||||||
|
version="6.0.0.0"
|
||||||
|
processorArchitecture="*"
|
||||||
|
publicKeyToken="6595b64144ccf1df"
|
||||||
|
language="*"
|
||||||
|
/>
|
||||||
|
</dependentAssembly>
|
||||||
|
</dependency>
|
||||||
|
</assembly>
|
||||||
|
"#);
|
||||||
res.set("FileDescription", "Freedom to Stream");
|
res.set("FileDescription", "Freedom to Stream");
|
||||||
res.set("LegalCopyright", ©right);
|
res.set("LegalCopyright", ©right);
|
||||||
res.set("OriginalFilename", &exe_name);
|
res.set("OriginalFilename", &exe_name);
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 106 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 102 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 151 KiB After Width: | Height: | Size: 201 KiB |
BIN
mpv.dll
|
|
@ -1,18 +1,12 @@
|
||||||
pub mod app;
|
pub mod app;
|
||||||
pub use app::MainWindow;
|
pub use app::MainWindow;
|
||||||
pub mod stremio_wevbiew;
|
pub mod stremio_wevbiew;
|
||||||
pub use stremio_wevbiew::WebView;
|
|
||||||
pub mod stremio_player;
|
pub mod stremio_player;
|
||||||
pub use stremio_player::Player;
|
|
||||||
pub mod stremio_server;
|
pub mod stremio_server;
|
||||||
pub use stremio_server::StremioServer;
|
|
||||||
pub mod ipc;
|
pub mod ipc;
|
||||||
pub use ipc::{Channel, RPCRequest, RPCResponse, RPCResponseData, RPCResponseDataTransport};
|
pub use ipc::RPCResponse;
|
||||||
pub mod systray;
|
pub mod systray;
|
||||||
pub use systray::SystemTray;
|
|
||||||
pub mod splash;
|
pub mod splash;
|
||||||
pub use splash::SplashImage;
|
|
||||||
pub mod window_helper;
|
pub mod window_helper;
|
||||||
pub use window_helper::WindowStyle;
|
|
||||||
pub mod named_pipe;
|
pub mod named_pipe;
|
||||||
pub use named_pipe::{PipeClient, PipeServer};
|
pub use named_pipe::{PipeClient, PipeServer};
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,27 @@
|
||||||
// Based on
|
// Based on
|
||||||
// https://gitlab.com/tbsaunde/windows-named-pipe/-/blob/f4fd29191f0541f85f818885275dc4573d4059ec/src/lib.rs
|
// https://gitlab.com/tbsaunde/windows-named-pipe/-/blob/f4fd29191f0541f85f818885275dc4573d4059ec/src/lib.rs
|
||||||
|
|
||||||
use kernel32::{
|
// use kernel32::{
|
||||||
CloseHandle, ConnectNamedPipe, CreateFileW, CreateNamedPipeW, DisconnectNamedPipe,
|
// CloseHandle, ConnectNamedPipe, CreateFileW, CreateNamedPipeW, DisconnectNamedPipe,
|
||||||
FlushFileBuffers, ReadFile, WaitNamedPipeW, WriteFile,
|
// FlushFileBuffers, ReadFile, WaitNamedPipeW, WriteFile,
|
||||||
};
|
// };
|
||||||
use std::ffi::OsStr;
|
use std::ffi::{OsStr, OsString};
|
||||||
use std::ffi::OsString;
|
|
||||||
use std::io::{self, Read, Write};
|
use std::io::{self, Read, Write};
|
||||||
use std::os::windows::prelude::OsStrExt;
|
use std::os::windows::prelude::OsStrExt;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use winapi::shared::minwindef::{DWORD, LPCVOID, LPVOID};
|
use winapi::shared::minwindef::{DWORD, LPCVOID, LPVOID};
|
||||||
use winapi::shared::winerror;
|
use winapi::shared::winerror;
|
||||||
use winapi::um::fileapi::OPEN_EXISTING;
|
use winapi::um::fileapi::OPEN_EXISTING;
|
||||||
use winapi::um::handleapi::INVALID_HANDLE_VALUE;
|
use winapi::um::fileapi::{CreateFileW, FlushFileBuffers, ReadFile, WriteFile};
|
||||||
|
use winapi::um::handleapi::{CloseHandle, INVALID_HANDLE_VALUE};
|
||||||
|
use winapi::um::namedpipeapi::{
|
||||||
|
ConnectNamedPipe, CreateNamedPipeW, DisconnectNamedPipe, WaitNamedPipeW,
|
||||||
|
};
|
||||||
use winapi::um::winbase::{
|
use winapi::um::winbase::{
|
||||||
FILE_FLAG_FIRST_PIPE_INSTANCE, PIPE_ACCESS_DUPLEX, PIPE_READMODE_BYTE, PIPE_TYPE_BYTE,
|
FILE_FLAG_FIRST_PIPE_INSTANCE, PIPE_ACCESS_DUPLEX, PIPE_READMODE_BYTE, PIPE_TYPE_BYTE,
|
||||||
PIPE_UNLIMITED_INSTANCES, PIPE_WAIT,
|
PIPE_UNLIMITED_INSTANCES, PIPE_WAIT,
|
||||||
};
|
};
|
||||||
use winapi::um::winnt::{FILE_ATTRIBUTE_NORMAL, GENERIC_READ, GENERIC_WRITE, HANDLE};
|
use winapi::um::winnt::{FILE_ATTRIBUTE_NORMAL, GENERIC_READ, GENERIC_WRITE, HANDLE};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct PipeClient {
|
pub struct PipeClient {
|
||||||
is_server: bool,
|
is_server: bool,
|
||||||
|
|
@ -33,7 +35,7 @@ impl PipeClient {
|
||||||
let u16_slice = os_str.encode_wide().collect::<Vec<u16>>();
|
let u16_slice = os_str.encode_wide().collect::<Vec<u16>>();
|
||||||
|
|
||||||
unsafe { WaitNamedPipeW(u16_slice.as_ptr(), 0) };
|
unsafe { WaitNamedPipeW(u16_slice.as_ptr(), 0) };
|
||||||
let handle = unsafe {
|
let handle: *mut winapi::ctypes::c_void = unsafe {
|
||||||
CreateFileW(
|
CreateFileW(
|
||||||
u16_slice.as_ptr(),
|
u16_slice.as_ptr(),
|
||||||
GENERIC_READ | GENERIC_WRITE,
|
GENERIC_READ | GENERIC_WRITE,
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ pub mod player;
|
||||||
pub use player::Player;
|
pub use player::Player;
|
||||||
pub mod communication;
|
pub mod communication;
|
||||||
pub use communication::{
|
pub use communication::{
|
||||||
BoolProp, CmdVal, FpProp, InMsg, InMsgArgs, InMsgFn, IntProp, MpvCmd, PlayerEnded, PlayerError,
|
CmdVal, InMsg, InMsgArgs, InMsgFn, PlayerEnded,
|
||||||
PlayerEvent, PlayerProprChange, PlayerResponse, PropKey, PropVal, StrProp,
|
PlayerEvent, PlayerProprChange, PlayerResponse, PropKey, PropVal,
|
||||||
};
|
};
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod communication_tests;
|
mod communication_tests;
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ impl StremioServer {
|
||||||
let job = Job::create().expect("Cannont create job");
|
let job = Job::create().expect("Cannont create job");
|
||||||
let mut info = job.query_extended_limit_info().expect("Cannont get info");
|
let mut info = job.query_extended_limit_info().expect("Cannont get info");
|
||||||
info.limit_kill_on_job_close();
|
info.limit_kill_on_job_close();
|
||||||
job.set_extended_limit_info(&mut info).ok();
|
job.set_extended_limit_info(&info).ok();
|
||||||
job.assign_current_process().ok();
|
job.assign_current_process().ok();
|
||||||
loop {
|
loop {
|
||||||
let child = Command::new("./stremio-runtime")
|
let child = Command::new("./stremio-runtime")
|
||||||
|
|
|
||||||
|
|
@ -94,30 +94,25 @@ impl PartialUi for WebView {
|
||||||
tx_web.clone().send(ipc::RPCResponse::response_message(Some(json!(["app-error", format!("Cannot load WEB UI at '{}'", &endpoint)])))).ok();
|
tx_web.clone().send(ipc::RPCResponse::response_message(Some(json!(["app-error", format!("Cannot load WEB UI at '{}'", &endpoint)])))).ok();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
webview
|
webview.execute_script(r##"
|
||||||
.add_script_to_execute_on_document_created(
|
try{console.log('Shell JS injected');if(window.self === window.top) {
|
||||||
r##"
|
|
||||||
try{if(window.self === window.top) {
|
|
||||||
window.qt={webChannelTransport:{send:window.chrome.webview.postMessage}};
|
window.qt={webChannelTransport:{send:window.chrome.webview.postMessage}};
|
||||||
window.chrome.webview.addEventListener('message',ev=>window.qt.webChannelTransport.onmessage(ev));
|
window.chrome.webview.addEventListener('message',ev=>window.qt.webChannelTransport.onmessage(ev));
|
||||||
window.onload=()=>{try{initShellComm();}catch(e){window.chrome.webview.postMessage('{"id":1,"args":["app-error","'+e.message+'"]}')}};
|
window.onload=()=>{try{initShellComm();}catch(e){window.chrome.webview.postMessage('{"id":1,"args":["app-error","'+e.message+'"]}')}};
|
||||||
}}catch(e){}
|
}}catch(e){}
|
||||||
"##,
|
"##, |_| Ok(())).expect("Cannot add script to webview");
|
||||||
|_| Ok(()),
|
|
||||||
)
|
|
||||||
.ok();
|
|
||||||
webview.add_web_message_received(move |_w, msg| {
|
webview.add_web_message_received(move |_w, msg| {
|
||||||
let msg = msg.try_get_web_message_as_string()?;
|
let msg = msg.try_get_web_message_as_string()?;
|
||||||
tx_web.send(msg).ok();
|
tx_web.send(msg).ok();
|
||||||
Ok(())
|
Ok(())
|
||||||
}).ok();
|
}).expect("Cannot add web message received");
|
||||||
webview.add_new_window_requested(move |_w, msg| {
|
webview.add_new_window_requested(move |_w, msg| {
|
||||||
if let Some(file) = msg.get_uri().ok().and_then(|str| {decode(str.as_str()).ok().map(Cow::into_owned)}) {
|
if let Some(file) = msg.get_uri().ok().and_then(|str| {decode(str.as_str()).ok().map(Cow::into_owned)}) {
|
||||||
tx_drag_drop.send(ipc::RPCResponse::response_message(Some(json!(["dragdrop" ,[file]])))).ok();
|
tx_drag_drop.send(ipc::RPCResponse::response_message(Some(json!(["dragdrop" ,[file]])))).ok();
|
||||||
msg.put_handled(true).ok();
|
msg.put_handled(true).ok();
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}).ok();
|
}).expect("Cannot add D&D handler");
|
||||||
|
|
||||||
WebView::resize_to_window_bounds_and_show(Some(&controller), Some(hwnd));
|
WebView::resize_to_window_bounds_and_show(Some(&controller), Some(hwnd));
|
||||||
controller_clone
|
controller_clone
|
||||||
|
|
@ -128,7 +123,7 @@ impl PartialUi for WebView {
|
||||||
});
|
});
|
||||||
if let Err(e) = result {
|
if let Err(e) = result {
|
||||||
nwg::modal_fatal_message(
|
nwg::modal_fatal_message(
|
||||||
&parent,
|
parent,
|
||||||
"Failed to Create WebView2 Environment",
|
"Failed to Create WebView2 Environment",
|
||||||
&format!("{}", e),
|
&format!("{}", e),
|
||||||
);
|
);
|
||||||
|
|
@ -170,6 +165,7 @@ impl PartialUi for WebView {
|
||||||
use nwg::Event as E;
|
use nwg::Event as E;
|
||||||
match evt {
|
match evt {
|
||||||
E::OnPaint => {
|
E::OnPaint => {
|
||||||
|
// TODO: somehow debounce this
|
||||||
WebView::resize_to_window_bounds_and_show(self.controller.get(), handle.hwnd());
|
WebView::resize_to_window_bounds_and_show(self.controller.get(), handle.hwnd());
|
||||||
}
|
}
|
||||||
E::OnWindowMinimize => {
|
E::OnWindowMinimize => {
|
||||||
|
|
|
||||||