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"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
|
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]]
|
[[package]]
|
||||||
name = "async-stream"
|
name = "async-stream"
|
||||||
version = "0.3.5"
|
version = "0.3.5"
|
||||||
|
|
@ -498,6 +507,12 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "const_panic"
|
||||||
|
version = "0.2.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7782af8f90fe69a4bb41e460abe1727d493403d8b2cc43201a3a3e906b24379f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "convert_case"
|
name = "convert_case"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
|
|
@ -1916,6 +1931,7 @@ name = "librqbit-core"
|
||||||
version = "4.0.1"
|
version = "4.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
"assert_cfg",
|
||||||
"bytes",
|
"bytes",
|
||||||
"data-encoding",
|
"data-encoding",
|
||||||
"directories",
|
"directories",
|
||||||
|
|
@ -1980,6 +1996,7 @@ dependencies = [
|
||||||
name = "librqbit-sha1-wrapper"
|
name = "librqbit-sha1-wrapper"
|
||||||
version = "4.0.0"
|
version = "4.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"assert_cfg",
|
||||||
"crypto-hash",
|
"crypto-hash",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -2034,6 +2051,7 @@ dependencies = [
|
||||||
"librqbit-sha1-wrapper",
|
"librqbit-sha1-wrapper",
|
||||||
"librqbit-upnp",
|
"librqbit-upnp",
|
||||||
"mime_guess",
|
"mime_guess",
|
||||||
|
"network-interface",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"quick-xml 0.36.1",
|
"quick-xml 0.36.1",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
|
|
@ -3051,6 +3069,7 @@ dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"directories",
|
"directories",
|
||||||
|
"gethostname",
|
||||||
"http 1.1.0",
|
"http 1.1.0",
|
||||||
"librqbit",
|
"librqbit",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ tracing-subscriber = { version = "0.3.18", features = ["env-filter", "json"] }
|
||||||
tracing = "0.1"
|
tracing = "0.1"
|
||||||
serde_with = "3.4.0"
|
serde_with = "3.4.0"
|
||||||
parking_lot = "0.12.1"
|
parking_lot = "0.12.1"
|
||||||
|
gethostname = "0.5.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
# this feature is used for production builds or when `devPath` points to the filesystem
|
# this feature is used for production builds or when `devPath` points to the filesystem
|
||||||
|
|
|
||||||
|
|
@ -135,9 +135,6 @@ pub struct RqbitDesktopConfigUpnp {
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub enable_server: bool,
|
pub enable_server: bool,
|
||||||
|
|
||||||
#[serde(default)]
|
|
||||||
pub server_hostname: Option<String>,
|
|
||||||
|
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub server_friendly_name: Option<String>,
|
pub server_friendly_name: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
@ -183,12 +180,6 @@ impl RqbitDesktopConfig {
|
||||||
if self.http_api.listen_addr.ip().is_loopback() {
|
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.")
|
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -122,13 +122,6 @@ async fn api_from_config(
|
||||||
let api = api.clone();
|
let api = api.clone();
|
||||||
let read_only = config.http_api.read_only;
|
let read_only = config.http_api.read_only;
|
||||||
let upnp_router = if config.upnp.enable_server {
|
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
|
let friendly_name = config
|
||||||
.upnp
|
.upnp
|
||||||
.server_friendly_name
|
.server_friendly_name
|
||||||
|
|
@ -136,10 +129,15 @@ async fn api_from_config(
|
||||||
.map(|f| f.trim())
|
.map(|f| f.trim())
|
||||||
.filter(|s| !s.is_empty())
|
.filter(|s| !s.is_empty())
|
||||||
.map(|s| s.to_owned())
|
.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
|
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
|
.await
|
||||||
.context("error starting UPnP server")?;
|
.context("error starting UPnP server")?;
|
||||||
let router = upnp_adapter.take_router()?;
|
let router = upnp_adapter.take_router()?;
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ interface RqbitDesktopConfigUpnp {
|
||||||
disable: boolean;
|
disable: boolean;
|
||||||
|
|
||||||
enable_server: boolean;
|
enable_server: boolean;
|
||||||
server_hostname: string;
|
|
||||||
server_friendly_name: 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."
|
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
|
<FormInput
|
||||||
inputType="text"
|
inputType="text"
|
||||||
label="Friendly name"
|
label="Friendly name"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue