web: Rename wsProxy config option to socketProxy
This commit is contained in:
parent
d3765027f0
commit
1bfcc0a670
|
@ -44,5 +44,5 @@ export const DEFAULT_CONFIG: Required<BaseLoadOptions> = {
|
|||
openUrlMode: OpenURLMode.Allow,
|
||||
allowNetworking: NetworkingAccessMode.All,
|
||||
openInNewTab: null,
|
||||
wsProxy: [],
|
||||
socketProxy: [],
|
||||
};
|
||||
|
|
|
@ -248,7 +248,7 @@ export const enum NetworkingAccessMode {
|
|||
None = "none",
|
||||
}
|
||||
|
||||
export interface WebSocketProxy {
|
||||
export interface SocketProxy {
|
||||
host: string;
|
||||
port: number;
|
||||
|
||||
|
@ -536,7 +536,7 @@ export interface BaseLoadOptions {
|
|||
*/
|
||||
openInNewTab?: ((swf: URL) => void) | null;
|
||||
|
||||
wsProxy?: Array<WebSocketProxy>;
|
||||
socketProxy?: Array<SocketProxy>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -244,7 +244,7 @@ where
|
|||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct WebSocketProxy {
|
||||
pub struct SocketProxy {
|
||||
host: String,
|
||||
port: u16,
|
||||
|
||||
|
@ -299,7 +299,7 @@ struct Config {
|
|||
|
||||
allow_networking: NetworkingAccessMode,
|
||||
|
||||
ws_proxy: Vec<WebSocketProxy>,
|
||||
socket_proxy: Vec<SocketProxy>,
|
||||
}
|
||||
|
||||
/// Metadata about the playing SWF file to be passed back to JavaScript.
|
||||
|
@ -553,7 +553,7 @@ impl Ruffle {
|
|||
config.base_url,
|
||||
log_subscriber.clone(),
|
||||
config.open_url_mode,
|
||||
config.ws_proxy,
|
||||
config.socket_proxy,
|
||||
));
|
||||
|
||||
match window.local_storage() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//! Navigator backend for web
|
||||
use crate::WebSocketProxy;
|
||||
use crate::SocketProxy;
|
||||
use async_channel::Receiver;
|
||||
use futures_util::{SinkExt, StreamExt};
|
||||
use gloo_net::websocket::{futures::WebSocket, Message};
|
||||
|
@ -33,7 +33,7 @@ pub struct WebNavigatorBackend {
|
|||
upgrade_to_https: bool,
|
||||
base_url: Option<Url>,
|
||||
open_url_mode: OpenURLMode,
|
||||
websocket_proxies: Vec<WebSocketProxy>,
|
||||
socket_proxies: Vec<SocketProxy>,
|
||||
}
|
||||
|
||||
impl WebNavigatorBackend {
|
||||
|
@ -44,7 +44,7 @@ impl WebNavigatorBackend {
|
|||
base_url: Option<String>,
|
||||
log_subscriber: Arc<Layered<WASMLayer, Registry>>,
|
||||
open_url_mode: OpenURLMode,
|
||||
websocket_proxies: Vec<WebSocketProxy>,
|
||||
socket_proxies: Vec<SocketProxy>,
|
||||
) -> Self {
|
||||
let window = web_sys::window().expect("window()");
|
||||
|
||||
|
@ -86,7 +86,7 @@ impl WebNavigatorBackend {
|
|||
base_url,
|
||||
log_subscriber,
|
||||
open_url_mode,
|
||||
websocket_proxies,
|
||||
socket_proxies,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -369,7 +369,6 @@ impl NavigatorBackend for WebNavigatorBackend {
|
|||
fn connect_socket(
|
||||
&mut self,
|
||||
host: String,
|
||||
|
||||
port: u16,
|
||||
// NOTE: WebSocket does not allow specifying a timeout, so this goes unused.
|
||||
_timeout: Duration,
|
||||
|
@ -378,7 +377,7 @@ impl NavigatorBackend for WebNavigatorBackend {
|
|||
sender: Sender<SocketAction>,
|
||||
) {
|
||||
let Some(proxy) = self
|
||||
.websocket_proxies
|
||||
.socket_proxies
|
||||
.iter()
|
||||
.find(|x| x.host == host && x.port == port)
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue