Fix desktop to support this
This commit is contained in:
parent
d90c4dabe7
commit
fef068d809
6 changed files with 27 additions and 29 deletions
19
desktop/src-tauri/Cargo.lock
generated
19
desktop/src-tauri/Cargo.lock
generated
|
|
@ -68,6 +68,15 @@ version = "1.0.86"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
|
||||
|
||||
[[package]]
|
||||
name = "assert_cfg"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04e2651f366b7ee3f97729fded1441539b49d5f39eeb05b842689e11e84501b2"
|
||||
dependencies = [
|
||||
"const_panic",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-stream"
|
||||
version = "0.3.5"
|
||||
|
|
@ -498,6 +507,12 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "const_panic"
|
||||
version = "0.2.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7782af8f90fe69a4bb41e460abe1727d493403d8b2cc43201a3a3e906b24379f"
|
||||
|
||||
[[package]]
|
||||
name = "convert_case"
|
||||
version = "0.4.0"
|
||||
|
|
@ -1916,6 +1931,7 @@ name = "librqbit-core"
|
|||
version = "4.0.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"assert_cfg",
|
||||
"bytes",
|
||||
"data-encoding",
|
||||
"directories",
|
||||
|
|
@ -1980,6 +1996,7 @@ dependencies = [
|
|||
name = "librqbit-sha1-wrapper"
|
||||
version = "4.0.0"
|
||||
dependencies = [
|
||||
"assert_cfg",
|
||||
"crypto-hash",
|
||||
]
|
||||
|
||||
|
|
@ -2034,6 +2051,7 @@ dependencies = [
|
|||
"librqbit-sha1-wrapper",
|
||||
"librqbit-upnp",
|
||||
"mime_guess",
|
||||
"network-interface",
|
||||
"parking_lot",
|
||||
"quick-xml 0.36.1",
|
||||
"reqwest",
|
||||
|
|
@ -3051,6 +3069,7 @@ dependencies = [
|
|||
"anyhow",
|
||||
"base64 0.22.1",
|
||||
"directories",
|
||||
"gethostname",
|
||||
"http 1.1.0",
|
||||
"librqbit",
|
||||
"parking_lot",
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ tracing-subscriber = { version = "0.3.18", features = ["env-filter", "json"] }
|
|||
tracing = "0.1"
|
||||
serde_with = "3.4.0"
|
||||
parking_lot = "0.12.1"
|
||||
gethostname = "0.5.0"
|
||||
|
||||
[features]
|
||||
# this feature is used for production builds or when `devPath` points to the filesystem
|
||||
|
|
|
|||
|
|
@ -135,9 +135,6 @@ pub struct RqbitDesktopConfigUpnp {
|
|||
#[serde(default)]
|
||||
pub enable_server: bool,
|
||||
|
||||
#[serde(default)]
|
||||
pub server_hostname: Option<String>,
|
||||
|
||||
#[serde(default)]
|
||||
pub server_friendly_name: Option<String>,
|
||||
}
|
||||
|
|
@ -183,12 +180,6 @@ impl RqbitDesktopConfig {
|
|||
if self.http_api.listen_addr.ip().is_loopback() {
|
||||
anyhow::bail!("if UPnP server is enabled, you need to set HTTP API IP to 0.0.0.0 or at least non-localhost address.")
|
||||
}
|
||||
match self.upnp.server_hostname.as_ref().map(|s| s.trim()) {
|
||||
Some("") | None => {
|
||||
anyhow::bail!("UPnP hostname must be set to non-empty string")
|
||||
}
|
||||
Some(_) => {}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,13 +122,6 @@ async fn api_from_config(
|
|||
let api = api.clone();
|
||||
let read_only = config.http_api.read_only;
|
||||
let upnp_router = if config.upnp.enable_server {
|
||||
let hostname = config
|
||||
.upnp
|
||||
.server_hostname
|
||||
.as_ref()
|
||||
.map(|h| h.trim())
|
||||
.context("empty UPNP hostname")?
|
||||
.to_owned();
|
||||
let friendly_name = config
|
||||
.upnp
|
||||
.server_friendly_name
|
||||
|
|
@ -136,10 +129,15 @@ async fn api_from_config(
|
|||
.map(|f| f.trim())
|
||||
.filter(|s| !s.is_empty())
|
||||
.map(|s| s.to_owned())
|
||||
.unwrap_or_else(|| format!("rqbit@{hostname}"));
|
||||
.unwrap_or_else(|| {
|
||||
format!(
|
||||
"rqbit-desktop@{}",
|
||||
gethostname::gethostname().to_string_lossy()
|
||||
)
|
||||
});
|
||||
|
||||
let mut upnp_adapter = session
|
||||
.make_upnp_adapter(friendly_name, hostname, config.http_api.listen_addr.port())
|
||||
.make_upnp_adapter(friendly_name, config.http_api.listen_addr.port())
|
||||
.await
|
||||
.context("error starting UPnP server")?;
|
||||
let router = upnp_adapter.take_router()?;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ interface RqbitDesktopConfigUpnp {
|
|||
disable: boolean;
|
||||
|
||||
enable_server: boolean;
|
||||
server_hostname: string;
|
||||
server_friendly_name: string;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -293,16 +293,6 @@ export const ConfigModal: React.FC<{
|
|||
help="If enabled, rqbit will advertise the media to supported LAN devices, e.g. TVs."
|
||||
/>
|
||||
|
||||
<FormInput
|
||||
inputType="text"
|
||||
label="[Required] Hostname"
|
||||
name="upnp.server_hostname"
|
||||
value={config.upnp.server_hostname}
|
||||
disabled={!config.upnp.enable_server}
|
||||
onChange={handleInputChange}
|
||||
help="Set this to your LAN IP or hostname resolvable from LAN."
|
||||
/>
|
||||
|
||||
<FormInput
|
||||
inputType="text"
|
||||
label="Friendly name"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue