File tree Expand file tree Collapse file tree
android/app/src/main/java/com/doodkin/screenmcp Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
5466fn 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}
Original file line number Diff line number Diff 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
5466fn 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}
You can’t perform that action at this time.
0 commit comments