Skip to content

Commit eb2cc58

Browse files
feat(desktop): explore random port for IPv6 compat (hoppscotch#5311)
This attempts to resolve app startup failures on Linux systems where IPv6 is disabled at the kernel level by replacing the dual-stack port selection logic with network interface discovery. Closes FE-912 Closes hoppscotch#4962
1 parent 7e10445 commit eb2cc58

File tree

4 files changed

+34
-15
lines changed

4 files changed

+34
-15
lines changed

packages/hoppscotch-common/src/components.d.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,7 @@ declare module 'vue' {
211211
IconLucideArrowUpRight: typeof import('~icons/lucide/arrow-up-right')['default']
212212
IconLucideBrush: typeof import('~icons/lucide/brush')['default']
213213
IconLucideCheckCircle: typeof import('~icons/lucide/check-circle')['default']
214-
IconLucideChevronDown: typeof import('~icons/lucide/chevron-down')['default']
215214
IconLucideChevronRight: typeof import('~icons/lucide/chevron-right')['default']
216-
IconLucideChevronUp: typeof import('~icons/lucide/chevron-up')['default']
217215
IconLucideCircleCheck: typeof import('~icons/lucide/circle-check')['default']
218216
IconLucideGlobe: typeof import('~icons/lucide/globe')['default']
219217
IconLucideHelpCircle: typeof import('~icons/lucide/help-circle')['default']
@@ -223,6 +221,7 @@ declare module 'vue' {
223221
IconLucideListEnd: typeof import('~icons/lucide/list-end')['default']
224222
IconLucideMinus: typeof import('~icons/lucide/minus')['default']
225223
IconLucidePlusCircle: typeof import('~icons/lucide/plus-circle')['default']
224+
IconLucideRss: typeof import('~icons/lucide/rss')['default']
226225
IconLucideSearch: typeof import('~icons/lucide/search')['default']
227226
IconLucideTriangleAlert: typeof import('~icons/lucide/triangle-alert')['default']
228227
IconLucideUsers: typeof import('~icons/lucide/users')['default']

packages/hoppscotch-desktop/src-tauri/Cargo.lock

Lines changed: 25 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/hoppscotch-desktop/src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ tauri-plugin-appload = { git = "https://github.com/CuriousCorrelation/tauri-plug
3333
tauri-plugin-relay = { git = "https://github.com/CuriousCorrelation/tauri-plugin-relay", rev = "0147ac1bb29d3b88d6652432a482bd86f0174506" }
3434
axum = "0.8.1"
3535
tower-http = { version = "0.6.2", features = ["cors"] }
36-
portpicker = "0.1.1"
36+
random-port = "0.1.1"
3737
tokio = "1.43.0"
3838
tauri-plugin-process = "2.2.0"
3939
file-rotate = "0.8.0"

packages/hoppscotch-desktop/src-tauri/src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ use tauri_plugin_appload::VendorConfigBuilder;
99
use tauri_plugin_deep_link::DeepLinkExt;
1010
use tauri_plugin_window_state::StateFlags;
1111

12+
use random_port::{PortPicker, Protocol};
13+
1214
pub const HOPPSCOTCH_DESKTOP_IDENTIFIER: &'static str = "io.hoppscotch.desktop";
1315
static SERVER_PORT: OnceLock<u16> = OnceLock::new();
1416

@@ -40,7 +42,11 @@ fn quit_app(app: tauri::AppHandle) -> Result<(), String> {
4042
pub fn run() {
4143
tauri::Builder::default()
4244
.setup(|app| {
43-
let server_port = portpicker::pick_unused_port().expect("Cannot find unused port");
45+
let server_port: u16 = PortPicker::new()
46+
.protocol(Protocol::Tcp)
47+
.port_range(15000..=25000)
48+
.pick()
49+
.expect("Cannot find unused port");
4450
tracing::info!("Selected server port: {}", server_port);
4551
SERVER_PORT
4652
.set(server_port)

0 commit comments

Comments
 (0)