Advance forge NBC worker and Ethereum full nodes
This commit is contained in:
parent
7d84510eac
commit
3402f7dab2
17 changed files with 3066 additions and 414 deletions
|
|
@ -29,9 +29,9 @@ use std::io::{Cursor, Read};
|
|||
use std::net::IpAddr;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::{Child, Command, Stdio};
|
||||
use std::sync::{mpsc, Arc, Mutex as StdMutex};
|
||||
#[cfg(target_os = "macos")]
|
||||
use std::sync::atomic::{AtomicU64, Ordering};
|
||||
use std::sync::{mpsc, Arc, Mutex as StdMutex};
|
||||
use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH};
|
||||
use tauri::path::BaseDirectory;
|
||||
#[cfg(target_os = "macos")]
|
||||
|
|
@ -309,10 +309,7 @@ fn dedupe_source_descriptors(sources: Vec<SourceDescriptor>) -> Vec<SourceDescri
|
|||
by_key.into_values().collect()
|
||||
}
|
||||
|
||||
async fn refresh_public_nbc_discovery_if_needed(
|
||||
state: Arc<Mutex<StreamManager>>,
|
||||
force: bool,
|
||||
) {
|
||||
async fn refresh_public_nbc_discovery_if_needed(state: Arc<Mutex<StreamManager>>, force: bool) {
|
||||
let needs_refresh = {
|
||||
let manager = state.lock().await;
|
||||
force
|
||||
|
|
@ -2712,7 +2709,10 @@ fn discover_nbc_public_guide() -> Result<NbcPublicDiscovery> {
|
|||
} else {
|
||||
Some(current_title.to_string())
|
||||
};
|
||||
let entitlement = item.analytics.as_ref().and_then(|value| value.entitlement.as_deref());
|
||||
let entitlement = item
|
||||
.analytics
|
||||
.as_ref()
|
||||
.and_then(|value| value.entitlement.as_deref());
|
||||
let mut extra_metadata = vec![
|
||||
StreamMetadata {
|
||||
key: "discovery_source".to_string(),
|
||||
|
|
@ -2737,7 +2737,10 @@ fn discover_nbc_public_guide() -> Result<NbcPublicDiscovery> {
|
|||
value: current_program.clone(),
|
||||
});
|
||||
}
|
||||
if let Some(relative_path) = tile.relative_path.as_ref().filter(|value| !value.is_empty())
|
||||
if let Some(relative_path) = tile
|
||||
.relative_path
|
||||
.as_ref()
|
||||
.filter(|value| !value.is_empty())
|
||||
{
|
||||
extra_metadata.push(StreamMetadata {
|
||||
key: "relative_path".to_string(),
|
||||
|
|
@ -3986,7 +3989,10 @@ fn nbc_native_js_eval(window: &WebviewWindow, script: &str) -> Result<String> {
|
|||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
fn nbc_native_snapshot(window: &WebviewWindow, capture_rect: Option<&NbcCaptureRect>) -> Result<Vec<u8>> {
|
||||
fn nbc_native_snapshot(
|
||||
window: &WebviewWindow,
|
||||
capture_rect: Option<&NbcCaptureRect>,
|
||||
) -> Result<Vec<u8>> {
|
||||
let (tx, rx) = mpsc::sync_channel(1);
|
||||
let capture_rect = capture_rect.cloned();
|
||||
window
|
||||
|
|
@ -4016,12 +4022,15 @@ fn nbc_native_snapshot(window: &WebviewWindow, capture_rect: Option<&NbcCaptureR
|
|||
let bitmap = NSBitmapImageRep::imageRepWithData(&tiff)
|
||||
.ok_or_else(|| anyhow!("failed to decode WKWebView snapshot"))?;
|
||||
let properties = NSDictionary::dictionary();
|
||||
bitmap.representationUsingType_properties(
|
||||
NSBitmapImageFileType::JPEG,
|
||||
&properties,
|
||||
)
|
||||
.ok_or_else(|| anyhow!("failed to encode WKWebView snapshot as JPEG"))
|
||||
.map(|jpeg| jpeg.to_vec())
|
||||
bitmap
|
||||
.representationUsingType_properties(
|
||||
NSBitmapImageFileType::JPEG,
|
||||
&properties,
|
||||
)
|
||||
.ok_or_else(|| {
|
||||
anyhow!("failed to encode WKWebView snapshot as JPEG")
|
||||
})
|
||||
.map(|jpeg| jpeg.to_vec())
|
||||
});
|
||||
tiff
|
||||
};
|
||||
|
|
@ -4561,7 +4570,10 @@ fn run_nbc_capture_loop(
|
|||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
fn spawn_nbc_frame_reader_native(app: &AppHandle, source: &StreamSource) -> Result<FramePipeReader> {
|
||||
fn spawn_nbc_frame_reader_native(
|
||||
app: &AppHandle,
|
||||
source: &StreamSource,
|
||||
) -> Result<FramePipeReader> {
|
||||
let origin_url = source_metadata_value(source, "origin_url")
|
||||
.ok_or_else(|| anyhow!("NBC source is missing origin_url metadata"))?
|
||||
.to_string();
|
||||
|
|
@ -4678,7 +4690,11 @@ fn bootstrap_nbc_auth_hidden(
|
|||
None,
|
||||
)?;
|
||||
wait_for_nbc_playback_webview(&window, &session.trace, session.hidden_mode)?;
|
||||
let trace_state = session.trace.lock().map(|state| state.clone()).unwrap_or_default();
|
||||
let trace_state = session
|
||||
.trace
|
||||
.lock()
|
||||
.map(|state| state.clone())
|
||||
.unwrap_or_default();
|
||||
Ok(BootstrapNbcAuthResult {
|
||||
input_url: input_url.clone(),
|
||||
stream_id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue