Skip to content

Commit 8f3d0e2

Browse files
committed
fix: add local_mode config fields to Mac/Linux, fix Android companion object
- Mac/Linux config.rs: add local_mode_key and local_mode_port fields (required for local_server.rs to compile) - Android: merge duplicate companion object into single block (Kotlin only allows one companion object per class)
1 parent e352ce8 commit 8f3d0e2

3 files changed

Lines changed: 30 additions & 5 deletions

File tree

android/app/src/main/java/com/doodkin/screenmcp/WebSocketClient.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class WebSocketClient(
3131
private const val TAG = "WebSocketClient"
3232
private const val MAX_RECONNECT_DELAY_MS = 30_000L
3333
private const val MAX_RECONNECT_ATTEMPTS = 10
34+
const val DEFAULT_SCALE_WIDTH = 1456.0
35+
const val DEFAULT_SCALE_HEIGHT = 819.0
3436
}
3537

3638
private var webSocket: WebSocket? = null
@@ -265,11 +267,6 @@ class WebSocketClient(
265267
}
266268
}
267269

268-
companion object {
269-
const val DEFAULT_SCALE_WIDTH = 1456.0
270-
const val DEFAULT_SCALE_HEIGHT = 819.0
271-
}
272-
273270
/** Scale coordinates from screenshot space to actual screen space using max_width/max_height params. */
274271
private fun scaleX(x: Double, params: JSONObject?, dm: android.util.DisplayMetrics): Float {
275272
val mw = params?.optDouble("max_width", DEFAULT_SCALE_WIDTH) ?: DEFAULT_SCALE_WIDTH

linux/src/config.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@ pub struct Config {
4949
/// API server URL for open source server mode
5050
#[serde(default)]
5151
pub opensource_api_url: String,
52+
53+
/// Local mode API key (empty = disabled)
54+
#[serde(default)]
55+
pub local_mode_key: String,
56+
57+
/// Local mode HTTP port
58+
#[serde(default = "default_local_mode_port")]
59+
pub local_mode_port: u16,
60+
}
61+
62+
fn default_local_mode_port() -> u16 {
63+
6767
5264
}
5365

5466
fn default_api_url() -> String {
@@ -78,6 +90,8 @@ impl Default for Config {
7890
opensource_server_enabled: false,
7991
opensource_user_id: String::new(),
8092
opensource_api_url: String::new(),
93+
local_mode_key: String::new(),
94+
local_mode_port: default_local_mode_port(),
8195
}
8296
}
8397
}

mac/src/config.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@ pub struct Config {
4949
/// API server URL for open source server
5050
#[serde(default)]
5151
pub opensource_api_url: String,
52+
53+
/// Local mode API key (empty = disabled)
54+
#[serde(default)]
55+
pub local_mode_key: String,
56+
57+
/// Local mode HTTP port
58+
#[serde(default = "default_local_mode_port")]
59+
pub local_mode_port: u16,
60+
}
61+
62+
fn default_local_mode_port() -> u16 {
63+
6767
5264
}
5365

5466
fn default_api_url() -> String {
@@ -78,6 +90,8 @@ impl Default for Config {
7890
opensource_server_enabled: false,
7991
opensource_user_id: String::new(),
8092
opensource_api_url: String::new(),
93+
local_mode_key: String::new(),
94+
local_mode_port: default_local_mode_port(),
8195
}
8296
}
8397
}

0 commit comments

Comments
 (0)