Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

desktop: Change 'socket mode' text to 'TCP Connections' #12316

Merged
merged 1 commit into from
Jul 26, 2023
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
2 changes: 1 addition & 1 deletion core/src/backend/navigator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub enum NavigationMethod {
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum SocketMode {
/// Allows movies to connect to any host using sockets.
Unrestricted,
Allow,

/// Refuse all socket connection requests
Deny,
Expand Down
8 changes: 4 additions & 4 deletions desktop/assets/texts/en-US/settings.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ proxy = Proxy
upgrade-http = Upgrade HTTP to HTTPS
upgrade-http-check = Upgrade

socket-mode = Socket Mode
socket-mode-unrestricted = Unrestricted
socket-mode-ask = Ask
socket-mode-deny = Deny
tcp-connections = TCP Connections
tcp-connections-allow = Allow
tcp-connections-ask = Ask
tcp-connections-deny = Deny

open-url-mode = Open URL Mode
open-url-mode-allow = Allow
Expand Down
2 changes: 1 addition & 1 deletion desktop/src/backends/navigator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ impl NavigatorBackend for ExternalNavigatorBackend {

let future = Box::pin(async move {
match (is_allowed, socket_mode) {
(false, SocketMode::Unrestricted) | (true, _) => {} // the process is allowed to continue. just dont do anything.
(false, SocketMode::Allow) | (true, _) => {} // the process is allowed to continue. just dont do anything.
(false, SocketMode::Deny) => {
// Just fail the connection.
sender
Expand Down
6 changes: 3 additions & 3 deletions desktop/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ pub struct Opt {
#[clap(long = "socket-allow", number_of_values = 1, action = clap::ArgAction::Append)]
pub socket_allow: Vec<String>,

/// Define how to deal with sockets.
#[clap(long = "socket-mode", default_value = "ask")]
pub socket_mode: SocketMode,
/// Define how to deal with TCP Socket connections.
#[clap(long = "tcp-connections", default_value = "ask")]
pub tcp_connections: SocketMode,

/// Replace all embedded HTTP URLs with HTTPS.
#[clap(long, action)]
Expand Down
26 changes: 13 additions & 13 deletions desktop/src/gui/open_dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,28 +155,28 @@ impl OpenDialog {
);
ui.end_row();

ui.label(text(&self.locale, "socket-mode"));
ComboBox::from_id_source("open-file-advanced-options-socket-mode")
.selected_text(match self.options.socket_mode {
SocketMode::Unrestricted => text(&self.locale, "socket-mode-unrestricted"),
SocketMode::Ask => text(&self.locale, "socket-mode-ask"),
SocketMode::Deny => text(&self.locale, "socket-mode-deny"),
ui.label(text(&self.locale, "tcp-connections"));
ComboBox::from_id_source("open-file-advanced-options-tcp-connections")
.selected_text(match self.options.tcp_connections {
SocketMode::Allow => text(&self.locale, "tcp-connections-allow"),
SocketMode::Ask => text(&self.locale, "tcp-connections-ask"),
SocketMode::Deny => text(&self.locale, "tcp-connections-deny"),
})
.show_ui(ui, |ui| {
ui.selectable_value(
&mut self.options.socket_mode,
SocketMode::Unrestricted,
text(&self.locale, "socket-mode-unrestricted"),
&mut self.options.tcp_connections,
SocketMode::Allow,
text(&self.locale, "tcp-connections-allow"),
);
ui.selectable_value(
&mut self.options.socket_mode,
&mut self.options.tcp_connections,
SocketMode::Ask,
text(&self.locale, "socket-mode-ask"),
text(&self.locale, "tcp-connections-ask"),
);
ui.selectable_value(
&mut self.options.socket_mode,
&mut self.options.tcp_connections,
SocketMode::Deny,
text(&self.locale, "socket-mode-deny"),
text(&self.locale, "tcp-connections-deny"),
);
});
ui.end_row();
Expand Down
6 changes: 3 additions & 3 deletions desktop/src/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub struct PlayerOptions {
pub force_scale: bool,
pub proxy: Option<Url>,
pub socket_allowed: HashSet<String>,
pub socket_mode: SocketMode,
pub tcp_connections: SocketMode,
pub upgrade_to_https: bool,
pub fullscreen: bool,
pub load_behavior: LoadBehavior,
Expand Down Expand Up @@ -74,7 +74,7 @@ impl From<&Opt> for PlayerOptions {
open_url_mode: value.open_url_mode,
dummy_external_interface: value.dummy_external_interface,
socket_allowed: HashSet::from_iter(value.socket_allow.iter().cloned()),
socket_mode: value.socket_mode,
tcp_connections: value.tcp_connections,
}
}
}
Expand Down Expand Up @@ -116,7 +116,7 @@ impl ActivePlayer {
opt.upgrade_to_https,
opt.open_url_mode,
opt.socket_allowed.clone(),
opt.socket_mode,
opt.tcp_connections,
);

if cfg!(feature = "software_video") {
Expand Down