Commit Graph
48 Commits
Author SHA1 Message Date
yuanyuanxianganddeepseek-flash 913b74097b Improve: ship release builds without debug info and symbols
linux/CMakeLists.txt forced -g into the global flags regardless of build
type, so even a Release build carried full DWARF: 7.7MB of the 10.3MB
binary was .debug_* material the client never uses at runtime.

Drop the forced -g and default CMAKE_BUILD_TYPE to Release, stripping the
symbol table at link time (-s) so only Debug builds keep symbols. Do the
same for macOS with ld64's -Wl,-x on Release, which drops the 8.3k local
symbols while keeping external ones and the signature ld appends.

linux/ghost drops from 10.3MB to 2.5MB (UPX on top: 0.87MB). Rebuilt
under WSL and verified with readelf: no .debug_*/.symtab/.strtab, BuildID
kept. The macOS change is not verified here; it needs a build on the Mac.

Co-Authored-By: deepseek-flash
2026-11-20 17:40:00 +01:00
yuanyuanxiang 63c7cdf588 Feature: transfer a Go-managed host to the MFC master from the web console
A Go-managed host cannot receive the client upgrade that only the MFC master
can push. Transfer moves its main link there and brings it back after N days;
MFC has no reason to return it.

Transfer is not share: ASSIGN writes the target and drops the current
connection, so the old master sees the host go offline and the new master gets
a normal main link it can remote control and upgrade. While a transfer is live
the client refuses a second transfer and any share, so no host is handed to a
third master that expiry would orphan.

Server: admin-only `transfer_device` WS command, COMMAND_ASSIGN_MASTER +
SHARE_TYPE_YAMA_FOREVER as `host:port:days::transport\0`, byte-compatible with
the MFC dialog. The transport segment is always present (YAMA_TRANSFER_TRANSPORT,
default 0/TCP) because clients keep their current link when it is missing: a
WSS-managed host would otherwise retry WSS against the MFC master's raw TCP
port and never connect. The empty shine segment keeps the host's header
encryption. The button only renders when `device_list.transfer` is present,
which MFC never sends, so no MFC change is needed. devicehistory keeps
transfer_to/transfer_until for the card badge and drops the marker on expiry or
on a fresh login here.

Client: KernelManager.cpp writes the registry and disconnects; ClientDll.cpp
re-reads the registry at the top of every reconnect, so a mid-session transfer
lands on the next round. Expiry is checked before every connect attempt as well
as inside the heartbeat loop, so an unreachable target cannot pin the host to
an expired address until a restart; restoring rebuilds the link captured on
entry (address, header encryption, transport). linux/main.cpp applies the
transfer on the main loop and restores the captured endpoint at expiry; Android
does the same; macOS has neither share nor transfer.
2026-11-20 12:23:08 +01:00
yuanyuanxiang b466f568ab Fix(client): refresh RES_UPTIME on every login so host popup shows the real runtime
双击 Linux 主机浮窗显示「启动信息 2026-11-14 13:33:52 + 1.3h」:日期是对的(进程确实从
11-14 06:33 起一直在跑,期间只有 TCP 重连),错的是时长——真实 6.2d,而 1.3h 正好等于当天
09:05:53 那次重连到双击时刻的间隔。

2cbed0d 加的 RES_UPTIME(登录时刻进程已运行秒数)在 Linux/macOS/Android 里跟着 LOGIN_INFOR
一起在重连循环外只构造一次、重连时原样重发,于是永远停在进程启动那一瞬的 0;服务端做
RES_UPTIME + GetAliveTime(),加出来就只剩「本次连接时长」。Windows 没有这个问题,它的
GetLoginInfo 在连接循环里每次重建。老客户端(build Oct 31 及更早)根本不发这个字段,服务端
退回 szStartTime 字符串、LNX 按北京时间比,反而正确——这就是「老版本显示正常」的原因。

改法:LOGIN_INFOR::SetReserved(index, v) 按 '|' 位置改写单个字段(末尾空槽原样保留、超长
整体放弃、越界拒绝),三个客户端把各自复制粘贴的「拆字段改 [19]」换成一行调用,并新增
RefreshLoginUptime 在每次 SendLoginInfo 前重算 [20](含 Linux 的分组变更重发路径)。

影响:只动登录包的第 21 个字段,结构体布局、字段顺序与协议不变,老主控忽略它。
已部署的旧 build 需重新下发才会恢复正常显示。

验证:SetReserved 用 MSVC 单测(21 字段位置不变、连改两次、空槽保留、补槽、超长与越界
拒绝)。三个客户端本体未编译:本机 WSL 被安全策略拦住、Docker 引擎未启动。
2026-11-20 10:43:17 +01:00
yuanyuanxiangandClaude Code d9fe93ff1e Fix(client): stop Windows share connections immediately on cancel
「取消分享」原来只清 share_list。Windows 的分享实例是同进程里的一个 ClientApp
线程,没有引用可停,连接会一直保持到客户端进程重启;Linux 的分享实例是独立
子进程,取消时直接 stop,两端行为不一致。

- 新增进程内分享实例登记表:起线程前登记 ClientApp 指针、种类与目标 ip:port,
  线程退出时(先摘除后 delete)注销;取消分享时在锁内逐个置 S_CLIENT_EXIT,
  心跳/重连循环约 1 秒内退出并关闭连接。登记项带 stopping 标记,正在退出的
  实例不再被视为可用连接。
- 区分 SHARED_KIND_SHARE / SHARED_KIND_TRANSFER:转移命令末尾贯穿到分享分支
  顺带起的连接标为 TRANSFER,取消分享不动它(取消分享撤销不了转移)。
- 同一目标只保留一条连接:重新分享(换 Shine/传输方式)先停旧实例并等待注销,
  再起新连接;启动时按 ip:port 去重历史 share_list,收到分享命令时也顺手归并
  旧记录;转移目标已有分享实例时不再多连一条(与 Linux SpawnManagedChild 一致)。
- 转移临时连接按 valid_to 自查到期(外层重连循环与内层心跳循环都查),主实例
  到期恢复分支也会停掉它,不再一直挂到进程重启。
- StartClientApp 只在状态不是 S_CLIENT_EXIT 时复位:取消请求可能在登记后、
  线程开跑前落地;SERVER_EXIT/UPDATE 仍照常复位,主控重启后分享实例照旧重连。
  分享实例退出不再置进程级 g_IsAppExit(否则会误伤 FRP 等模块),也不再做
  服务端退出专用的额外等待。
- 转移命令加 IsMainInstance 门禁;Linux 侧只更新注释。

验证:Debug 客户端构建通过;两个自动化 E2E(Debug 服务端 + 假 TCP 目标):
取消分享后连接 1 秒内关闭且主连接仍在线;同目标换 Shine 重新分享时旧连接关闭、
新连接建立,随后取消同样生效。

Model: deepseek-flash
Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-19 19:05:04 +01:00
yuanyuanxianganddeepseek-flash 06b93f7bdb Feat(client): complete the macOS feature set (phase 0 and 1)
Phase 0 makes implementations that already existed reachable. macOS now
declares TERMINAL, SCREEN_CLIPBOARD, PROCESS and C2C_RECV_ACK; PROCESS is a
new bit and Linux declares it too. SystemManager was dead code -- its
constructor took a second argument and it did not derive IOCPManager, so the
sub-connection skeleton could never instantiate it -- and now matches the
createHandler/OnReceive contract, so COMMAND_SYSTEM really spawns a
sub-connection (proc_listpids, SIGKILL). DataProcess always gets a NULL user,
so main.mm keeps a g_pMainClient handle and the V2 C2C receiver finally
answers TOKEN_C2C_RECV_RESULT. The server asks for SupportsTerminal() on MAC
for exec_command / terminal_* and for SupportsProcess() for kill_process, so
an old build gets "client is too old" instead of a command nobody answers;
kToolPlatforms and mcp/tools.json follow. http_probe stays win/lnx: the
terminal works on macOS, but the probe uses GNU-only base64 -w.

Phase 1 is POSIX parity. ScreenPreview captures through CGDisplayCreateImage,
scales and ships BGRX for the server to encode, and the capability is only
declared when preflight or a real capture says the display is readable.
ActivityHistory samples the frontmost layer-0 window once a second and prints
the same records as Windows and Linux. COMMAND_SCREEN_KEYFRAME_REQ is now
consumed by Linux (x264 IDR) and macOS (VideoToolbox force keyframe): the
receive thread raises a flag, the capture thread -- which owns the encoder --
consumes it and puts it back if the frame never went out. The macOS quality
level persists in NSUserDefaults because main.mm rewrites config.conf.

Linux client and Debug x64 server rebuild green; check_platform_table PASS.
Not built or run on a Mac.

Co-Authored-By: deepseek-flash
2026-11-14 13:30:50 +01:00
yuanyuanxianganddeepseek-flash 3d87ec6720 Fix(client): detach the receive thread instead of leaking one per connection
CloseHandle and SAFE_CLOSE_HANDLE are empty off Windows, so the POSIX
receive thread is never released: nothing detaches it and nothing joins
it. Every IOCPClient keeps one thread for good, and each screen, file,
shell or log sub-connection constructs a fresh IOCPClient. Once the leak
reaches RLIMIT_NPROC, pthread_create returns EAGAIN, std::thread throws,
and OnServerReceiving's catch(...) swallows it: every command that spawns
a worker goes quiet while COMMAND_SYSTEM keeps working. Observed on a Mac
after six weeks: 2048 threads against a 1333 limit.

Detach the thread right after creation so it is reclaimed when it
returns; the destructor still waits on m_bWorkThread, so nothing else
changes. Also log the pthread_create failure that used to be silent, and
publish S_STOP as the very last write in WorkThreadProc: the destructor
reads it as "thread is gone" and frees this, so the m_bIsRunning that
used to follow it could land in freed memory.

Two smaller fixes on the same sub-connection path:

- common/sub_conn_thread.h never called SetDefaultProto, so sub-connects
  fell back to plaintext TCP whatever g_SETTINGS.protoType said: behind a
  reverse proxy the packet dies before the master (no [ConnAuth] on the
  server, only "waiting for ack timed out" on the client). Android did.
- macos/main.mm and linux/main.cpp log the spawn before starting the
  worker and catch std::system_error, reporting e.code().value() rather
  than errno, which libc++/libstdc++ never set here. The macOS skeleton
  also reports ConnectServer failures and a null createHandler.

Co-Authored-By: deepseek-flash
2026-11-14 11:43:04 +01:00
yuanyuanxianganddeepseek-flash 81f0d6c031 Fix(server,client): keep web terminal alive across heartbeat reconnects
The Go server answered TOKEN_HEARTBEAT with a 33-byte CMD_HEARTBEAT_ACK,
while the Linux and Android clients gate the ACK on 1 + sizeof(HeartbeatACK)
(1025 bytes) and silently drop anything shorter. Their application-level ACK
watchdog therefore never got fed and disconnected the main connection every
60s. Each re-login replaced the whole hub.Device, wiping the screen/shell
sub-conn bindings that ride their own TCP connections, so a web terminal kept
receiving shell output while every keystroke was dropped — the "terminal goes
unresponsive after a while" symptom — and the shell could no longer be torn
down (orphan bash + leaked sockets).

Clients now accept the 32-byte old ACK (Windows already did), and the server
sends the full 1024-byte struct. Hub.Register carries the sub-conn session
state across a re-login, and the disconnect cleanup is pinned to the
connection it belongs to so a stale OnDisconnect cannot tear down a
registration that has already replaced it. A shell sub-conn that can no
longer be bound now tells the viewer instead of leaving the pane waiting.

Verified on aa: RTT restored, zero "Heartbeat ACK timeout" lines, main-conn
port stable; Go build/vet/test pass. Server deploy to the Go host is still
pending, so un-upgraded clients will keep reconnecting until then.

Co-Authored-By: deepseek-flash
2026-11-12 11:03:57 +01:00
yuanyuanxianganddeepseek-flash ac43ad92ef Fix: Harden the Android client connection lifecycle
Five review findings from the screen-preview work, all in the same
connection plumbing.

The main client handle is now a shared_ptr taken through GetMainClient().
ScreenPreviewThread, ActivityReportThread and sendClientMsg run detached
and can outlive ConnectionThread's teardown, so a raw pointer snapshot
could dereference freed memory; the copy they hold now keeps the client
alive until the send is done. sendClientMsg also uses one handle for
both the connected check and the send instead of reading the global
twice.

The reconnect loop now checks its connection generation in every
condition, so a thread that was asked to stop can no longer reconnect
after a quick nativeStop -> nativeInit reset g_bExit and g_running into
"running again", which produced two main connections with the same
client ID.

ActivityReportThread gets the same try/catch and RAII in-flight counter
as the preview thread: an exception used to call std::terminate, and one
failure left the counter above zero, silently dropping every later
get_activity_history.

nativeStop now stops the activity sampler, and Stop() clears m_started
so a service restart can start it again. Sub-connections (remote screen
and client log) now inherit g_SETTINGS.protoType like the main
connection; without it they silently dialed plain TCP even when WS/WSS
was configured.

Verified on the emulator against a local debug server: get_screenshot,
get_activity_history and get_client_log all still answer, and the log
sub-connection completes the TLS handshake.

Co-Authored-By: deepseek-flash
2026-11-11 20:59:10 +01:00
yuanyuanxianganddeepseek-flash 5bb24d714a Fix: Release remotely injected keys the controller never lifted
A browser or native controller can lose a keyup (window blur, tab switch,
browser shortcut, in-app dialog, disconnect). The remote OS then keeps
Ctrl/Shift/Alt down, later keystrokes turn into shortcuts, and only
pressing the modifier again clears it.

The web console now tracks the keys it sent down and releases them on
blur, visibilitychange, pagehide, dialog, control off, device switch and
disconnect; the next keydown/mousedown/wheel reconciles tracked modifiers
against the event's real modifier state. Keys held when the socket drops
are stashed and released once the screen session is confirmed after
reconnect, tagged with the device so they never reach another host. The
Ctrl+V bridge flag is reset wherever its physical keyup can be lost.

The Windows client tracks injected keys by VK + scan code + extended bit
so right-hand modifiers release the key that was pressed, and releases
them on session teardown and reconnect; the Linux agent does the same
on teardown with XTestFakeKeyEvent.

Verified with a 20-scenario headless Chrome harness, group filter
regressions, node --check, go build/vet/test, a Debug client build and
the WSL Linux build. Not exercised against a real controller and host;
the macOS agent is unchanged.

Co-Authored-By: deepseek-flash
2026-11-09 18:11:37 +01:00
yuanyuanxianganddeepseek-flash 2cbed0dcdf Fix: Report process uptime and harden the login reserved list
The "启动信息" elapsed time was computed by subtracting a client-formatted
wall-clock string from the master's own local time. Windows clients send their
local time, Linux/Android/macOS send Beijing time, so a host whose clock runs
ahead of the master (UTC+8 clients on a UTC+1 master, a fast CMOS clock) gave a
negative difference that was clamped to 0s — permanently, for that host.

Add RES_UPTIME to the login reserved list: the client reports its process
uptime in seconds, a difference between two readings of the same clock, so
timezone and clock skew cancel out. The master adds the connection's alive
time to get the current value, and keeps the old string path as the fallback
for clients that do not send the field. That fallback now also treats MAC as
Beijing time, which was simply missed.

AddReserved() now goes through one bounds-checked append. The separator used
to be written without any length check (an overflow aborts the client, which
installs no invalid parameter handler), and an over-long value now leaves an
empty slot instead of dropping its separator, so positional lookups cannot
shift.

Verified with an ASan/UBSan test over the encoding boundaries and Debug builds
of the client and the master. The Linux/Android/macOS clients only append the
same field at the end of the list; they were not compiled here.

Co-Authored-By: deepseek-flash
2026-11-08 21:49:20 +01:00
yuanyuanxianganddeepseek-flash d8048979e3 Feature: Report activity history on Linux clients
Implement COMMAND_QUERY_ACTIVITY -> TOKEN_REPORT_ACTIVITY with two backends
picked at startup. With a desktop, a sampler thread reads the foreground
window every second and books dwell time like the Windows client: under
five seconds is dropped, five idle minutes close the window, the last 500
records stay newest first, each line being "[YYYY-MM-DD HH:MM:SS] [title]
duration". It uses its own ActivityChecker because an Xlib connection
cannot be shared with the heartbeat thread, and it is stopped before main's
locals go away.

A reachable X server is not enough: the window backend is only chosen when
the root window carries _NET_SUPPORTING_WM_CHECK, so Xvfb or a bare X
without an EWMH window manager falls back to the headless backend instead
of sampling a window id that never appears.

Without a desktop the answer is computed on demand: logins from
"last -n 100 -F" plus bash/zsh history of root and /home/*, tagged [登录] or
[命令] after a [来源] header. Both halves are merged and sorted by
timestamp; three fifths of the budget goes to logins and reboot records are
capped at ten, since a WSL or container writes one reboot per start.
activity_commands=0 drops the command half.

A single detached thread builds and sends it, only while the main link is up.

The MCP gate now admits Linux for get_activity_history and documents both
shapes. test/unit/linux covers the parsers, ordering and UTF-8 truncation;
15 cases pass.

Co-Authored-By: deepseek-flash
2026-11-08 15:22:09 +01:00
yuanyuanxianganddeepseek-flash 2a97471b51 Feature: Share a Linux host to another master
Add COMMAND_SHARE (SHARE_TYPE_YAMA) with the Windows semantics: the
record goes into share_list and a second connection is opened to the
target master while the main link stays where it is. main()'s connection
state is all global, so each record is served by a forked
"--share <entry>" child that reuses the whole login, heartbeat and
command path; the parent only starts, tracks and reaps them.
COMMAND_SHARE_CANCEL clears the list and stops the children right away
(Linux can; Windows does it on the next start).

Transfer now opens its connection immediately too, matching the Windows
fallthrough that spawns a shared instance, and that temporary connection
is dropped once the main link has actually moved to the target or when
the transfer expires.

common/host_endpoint.h holds the ip/port/shine/transport word list the
two commands share; common/host_share.h holds the share payload,
share_list encoding and the per-master dedup.

Config writes now take a cross-process flock and replace the file by
rename. The parent and every child write the same config.conf from their
own snapshot, and a truncating overwrite could drop the other side's
keys. Children ignore the commands that only mean something on the main
link: share, transfer, upgrade, TLS anchor and group.

Verified in WSL against fake masters: share start, cancel and restore,
re-sharing with a different transport, share plus transfer on one master,
and the transfer child disappearing after the main link moved.

Co-Authored-By: deepseek-flash
2026-11-07 23:21:44 +01:00
yuanyuanxianganddeepseek-flash 3b3aed50e5 Feature: Transfer a Linux host to another master
The Linux client ignored COMMAND_ASSIGN_MASTER, so a host could not be
moved to a different controller the way the Windows client allows. The
payload is host:port:days:shine[:transport]; the parsing, record
encoding and address application live in a shared header so a macOS
client can reuse them unchanged.

An assignment only rewrites the connection target. The running session
stays up and the next reconnect - a dropped link or a restart - goes to
the new master, matching the Windows behaviour. The target and its
expiry are stored in a single "transfer" config key, while the address
the process started with is kept in memory only: the config's own
master/port entries are never overwritten, so restarting mid-transfer
still has the original to fall back to. When the expiry passes the
client restores that address, clears the key and reconnects.

Malformed payloads and zero-day assignments are rejected outright. The
way back depends on an expiry time, so honouring a permanent move would
strand a host on an address it cannot leave.

Give the POSIX connect() a timeout as well (non-blocking connect plus
poll, 10 seconds). A blocking connect waiting for SYN retransmission
froze the main loop for about two minutes when the port was filtered,
delaying both heartbeats and the expiry restore. The transfer state is
initialised after daemonize() for the same reason it is logged: logging
before the double fork can leave the child deadlocked on the logger
mutex.

Co-Authored-By: deepseek-flash
2026-11-07 21:35:15 +01:00
yuanyuanxianganddeepseek-flash 0b22d5e870 Feature: Remember the fullscreen and remote-cursor view state on Linux clients
The Linux client always reported zero for ScreenSettings.FullScreen and
RemoteCursor and dropped CMD_FULL_SCREEN / CMD_REMOTE_CURSOR on the
floor, so a controller could never reopen a host in the state it was
left in. The Windows client has done both for a while.

Store both fields in ~/.config/ghost/config.conf next to QualityLevel,
report them through the TOKEN_BITMAPINFO ScreenSettings, and update them
whenever the controller toggles either option. The controller already
applies the reported FullScreen in OnInitDialog, so no protocol or
master-side change is required.

CustomCursor is deliberately not persisted: Linux clients never send
cursor images, so the flag would be inert.

Co-Authored-By: deepseek-flash
2026-11-07 19:52:21 +01:00
yuanyuanxiang e99092ca70 Release v1.4.2 2026-10-31 18:24:54 +01:00
yuanyuanxianganddeepseek-flash 46f4bf2dfb Fix: Make the WebSocket transport reachable and bounded on every platform
The POSIX clients were built without a connection config - Linux, macOS and
Android all construct IOCPClient without the injected CONNECT_ADDRESS - so
ConnectServer saw protoType -1 and quietly dialled the master port in plain
TCP. Setting protoType to WS in their settings did nothing and logged nothing,
and since CLIENT_CAP_PROTO_SWITCH is Windows-only the server could not move
them either. Give the client a SetDefaultProto() for that construction path
and call it from all three mains before the reconnect loop, with a one-shot
log when neither a conn nor a default protocol is available so the silent
fallback becomes visible next time.

Bound what a peer can make the client read. ReadHeader accepted the 8-byte
extended length and rejected only the sign bit, so a frame length of nearly
2^63 kept the connection streaming into a frame that would never end - alive
but never delivering another packet. Cap single frames at 256 MB, the same
value ServerWsSession already applies to client frames, and drop the
connection past it; real traffic is far below that.

Stop Reset() from writing the receive thread's frame state. Disconnect() can
run from the heartbeat or command thread, not just the receive thread, so
Reset() now only flips the atomic ready flag and a new ResetFrames() clears
m_remaining, m_masked and m_maskPos from Handshake() alone, before the
receive thread starts reading the socket. Those fields keep a single owner
without adding a lock to the receive hot path.

Finish a dead WS session instead of leaving it to the keepalive timer. When
the session had closed but wsState was still WS_Ready, sends were dropped and
nothing woke the pending recv, so a peer that closed and then went quiet held
the context for the 3-minute keepalive. shutdown() the socket there so the
recv returns zero bytes and the normal -2 teardown runs; RemoveStaleContext
would deadlock against the caller's own IoRefCount and can hand back a reused
context.

That shutdown only finishes the connection if a zero-byte read still tears it
down, and on the plain path it no longer did. DispatchPlain answers an empty
buffer with "handled", so a peer's FIN left the connection in CLOSE_WAIT
until keepalive - holding an IOCP context, a pending WSARecv and a rate-limit
slot - where the pre-WS code called ParseReceivedData and tore down at once.
Restore that teardown on the TLS_Plain branch, matching the other two. Checked
against a Debug server: a plain socket that half-closes used to sit in
CLOSE_WAIT with the peer's recv timing out, and now disappears immediately
with recv returning zero.

Two smaller cleanups from the same review. Give the WS upgrade its own prefix
buffer (wsPreClassify) instead of borrowing the TLS sniffer's, which was
serially reused for two state machines and read as if it were one. And stop
deriving the build dialog's protoType from the combo box index: items now
carry the protocol value as item data, keyed off the index AddString returns,
so inserting an option in the middle can no longer write the wrong number into
the generated client without any error. ApplyProtoSwitch loses its bool
return, which contradicted its own side effects and was ignored by every
caller.

Co-Authored-By: deepseek-flash
2026-10-30 19:15:14 +01:00
yuanyuanxianganddeepseek-flash 56a937fabb Fix: Three blocking defects found by the MCP tool survey
The survey in docs/Mcp_Test_Report_2026-10-29.md turned up three P0s, each
of which stopped a whole capability rather than degrading it. Two of them
were the same mistake: the input schema promised something the output
schema then rejected. The third was an output with no size limit, plus a
client that never implemented the command at all.

Batch calls could never succeed. A call carrying ids[] goes through
BuildBatchCall, which returns {tool, total, succeeded, failed, skipped,
results[]}; every tool declares only the single-host shape. The client
validates structuredContent against that declaration, so any batch call
failed with -32602: data must have required property 'host' - the input
schema advertises ids, the output schema kills it. Tools/call cannot fix
this one call at a time, so ApplyBatchOutputSchema runs at the end of
tools/list, next to ApplyToolAnnotations, and rewrites the schema of every
tool in the batch list to {type: object, anyOf: [single, batch]}. Placing
it at the end is what makes it cover all three registration points
(inline, McpMachine, McpChat) and any tool added later. IsBatchReadOnlyTool
moved from McpServer.cpp to McpInternal.cpp for the same reason: the list
is now read by tools/call and tools/list, and the two must not drift.

list_registry failed whenever path was omitted. The root-key branch
returns keys only, while the output schema listed values in required as
well, so the first usage the documentation describes - omit path, get the
five root keys - could not work. values is no longer required and the
schema says it is absent in that branch. The root branch also returns
path: "" now, so both branches carry the same field set and callers need
not branch.

get_client_log was unusable on both platforms, for two unrelated reasons.
Windows returned the whole 1000-line ring buffer, 90,473 characters, over
the client's result limit: fetched, then not deliverable. Linux and macOS
timed out because their clients never handled COMMAND_QUERY_LOG at all -
only client/ClientLogManager.cpp does - so TOKEN_REPORT_LOG never arrived.
Adding a limit alone would have left Linux broken; fixing the client alone
would have left Windows over the limit.

The server now takes limit (default 200, max 2000) and filter, and reads
backwards from the end: troubleshooting wants the last thing that happened,
not the first line after boot. A 64 KB byte budget sits under the line
count, because one line can be a stack dump; when the final line alone
exceeds it, the tail is returned and truncated says so. Responses carry
lines_total, lines_matched, lines_returned and truncated. The timeout
message now names the likely cause and two ways around it instead of
saying only "Timeout waiting for client log".

The POSIX clients get common/ClientLogHandler.h, a counterpart to the
Windows CClientLogManager, and one line each in linux/main.cpp and
macos/main.mm. It must open a sub-connection: MessageHandle's
TOKEN_REPORT_LOG branch takes the first packet and then calls CancelIO on
that connection, so answering on the main connection would close the main
connection and drop the client offline.

Verified against a server built at 21:17:21 with both clients rebuilt. A
batch get_host_detail over the two A6 records returns succeeded=2 with
per-host data; host_list_processes with ids returns 2 of 2, which exercises
the McpMachine registration point rather than the inline one; a mixed
Windows/Linux batch of get_client_log returns 2 of 2. list_registry with
no path returns the five root keys and path ""; with a path it still
returns its values. get_client_log on Windows goes from 1000 lines to 200
with truncated=true, and limit=3 with filter=ConnAuth yields 28 matched and
3 returned. On Ubuntu 24.04 it returns logs at all, and the client's own
log shows Enter ClientLogThread, TOKEN_REPORT_LOG, then Leave about a
second later when the server cancels the connection - paired, no leak.

The connector still caches an old input schema for get_client_log, so
limit and filter are rejected locally until it reconnects; the defaults
already cover the P0, and this is the same cache problem as the
copy_files_c2c.overwrite entry in the report's P1 list.

docs/Mcp_Design.md section 18 records the implementation and the reasoning;
section 7 of the test report carries the verification table.

Co-Authored-By: deepseek-flash
2026-10-29 21:22:43 +01:00
yuanyuanxianganddeepseek-flash dc4fd792f6 Feature: Implement the Linux screen preview response
The Linux client now answers COMMAND_SCREEN_PREVIEW_REQ, so a host with
an X11 desktop gets a thumbnail when it is double-clicked in the online
list, a frame in the list's Preview column, and an image from the MCP
get_screenshot tool. Previously only Windows clients advertised the
capability and Linux hosts showed "预览不可用" after a four second wait.

The client does not encode JPEG. Stock desktops ship libjpeg.so.8 whose
struct layout is the distribution's ABI (JPEG_LIB_VERSION 80), while the
in-tree jpeglib.h is libjpeg-turbo 3.1.1 (62), and libturbojpeg is not
installed by default; dlopening the system library against that header
fails with "Wrong JPEG library version: library is 80, caller expects
62". Instead the client sends raw pixels in a new screen preview format,
SCREEN_PREVIEW_FMT_BGRX: top-down rows of B,G,R,X with no row padding,
already scaled to the requested width. The server re-encodes to JPEG at
the single ingress point, so the preview popup, the list thumbnail cache
and the MCP tool keep consuming JPEG only.

Capture follows the path ScreenHandler already uses: root window copied
into an offscreen pixmap with an IncludeInferiors GC, then XGetImage,
which avoids BadMatch under compositing window managers. The X11 type
declarations and the dlopen loader moved out of ScreenHandler.h into
linux/X11Loader.h so both users share one dlsym table. The full-size
image is never materialized: a box filter reads straight from the
XImage rows (honouring bytes_per_line) into the output buffer, scales to
maxWidth without upscaling, and clamps the height to 1080 so a portrait
4K desktop cannot produce a 26 MB packet. Rows and columns come out
even, which they are for JPEG anyway.

The capability bit is now honest about the runtime. LOGIN_INFOR grows
DefaultCaps()/SetCaps(), and the client recomputes the bits before every
login and re-login: CLIENT_CAP_SCREEN_PREVIEW is set only when DISPLAY is
present and the X server actually opens. A headless host therefore gets
-32005 "Host does not support screen preview" from MCP instead of a
timeout, and a host whose session appears after boot picks it up on the
next reconnect. Requests are handled on a detached worker thread behind
a single-flight guard (matching the Windows client), so a slow XGetImage
never stalls the receive thread and a burst of requests degrades to "no
preview" rather than queueing. If the worker thread cannot be created,
the guard is released again, so one failure cannot leave every later
request rejected as busy until the client restarts.

The MCP design note claimed the capability was declared by Windows only,
and the get_screenshot tool description said the same; both now say what
the code does (Windows always, Linux when a display is reachable).

Server side, NormalizeScreenPreviewPacket runs in MessageHandle before
the MCP handoff and the PostMessage to the UI thread. It validates that
width/height are within the values the server itself can ask for and
that bytes equals width*height*4, converts with a stack Gdiplus::Bitmap
over the packet's own pixels (no copy, and no DEBUG_NEW trouble), and
rewrites the header to JPEG. The encoder output is read back by seeking
the stream rather than GlobalSize, so the packet carries no heap-block
padding after the EOI marker. Malformed packets are dropped; failure
statuses pass through untouched so the existing code can report them.

Tested against a Debug server with the WSL Ubuntu 24.04 build as the
client. get_screenshot returned valid JPEGs at max_width 480 (480x142,
1.7 KB) and 1920 (1920x570, 17.9 KB), repeatably; the list showed a
thumbnail for the GUI client and N/A for a second copy started without
DISPLAY, which also answered -32005. The box filter and the BGRX to JPEG
conversion were checked separately with quadrant fixtures: the browser
over the synthetic B,G,R,X buffer recovers red/green/blue/white in the
right channels and the downscale averages, handles non-integer ratios
and row padding, and rejects 24bpp and upscaling. The captured frames
come out black under WSLg because Xwayland keeps no root pixmap there;
that is the compositor, not this code, and Xorg sessions capture
normally.

Co-Authored-By: deepseek-flash
2026-10-29 18:12:15 +01:00
6bfa4294cc Feature: Switch a Linux client's transport TLS at runtime
The server's TLS menu already wrote the trust anchor into the Windows
client's registry and expected a restart. The Linux client grew the same
command handling (166/167) but, like Windows, only read the anchor once at
startup, so enabling or disabling TLS still meant restarting it. Both
handlers now take effect immediately.

TlsChannelLinux.cpp no longer initialises through std::call_once. The
process-level state (context, enabled, load error) lives behind a mutex and
TlsReload() rebuilds it from whatever anchor file is on disk, so
TlsEnabled() reflects the new transport as soon as the anchor is written or
removed. In-flight sessions survive the swap because SSL_new increments the
SSL_CTX reference count; the unit test pins that down by keeping an
established TLS connection open across a reload that frees the old context.
A reload that hits a bad anchor keeps the previous state and only logs: one
bad push should not brick a working client, and the next start is still
fail-closed. The pushed PEM is parsed before it is written for the same
reason -- a corrupt anchor on disk would lock the client out of the server
with no way to correct it remotely.

Only a real transport flip (plaintext <-> TLS) asks for a reconnect. An
anchor swap alone, as in a certificate rotation, leaves the current session
alone and applies to the next connection. The receive thread never closes
the socket itself; it sets g_needReconnect and the main heartbeat loop
disconnects so the outer reconnect loop can re-handshake, matching how the
heartbeat timeout path already works.

IOCPClient now latches the transport per connection (m_useTls) at handshake
time instead of consulting TlsEnabled() on every send and receive. Without
the latch, the second or so between the reload and the reconnect would push
plaintext into an established TLS session, or the reverse, producing
protocol errors for no reason.

RES_TLS (szReserved[19]) is refreshed right before each login, including
the resend after a group change, so the TLS column on the server flips with
the transport instead of showing the value from process start.

The confirmation dialogs now say what each platform does, with translations
in en_US, zh_TW and de_DE; the keys carry the literal \n escape the INI
parser understands.

Ending a sub-connection is not an error. OpenSSL 3 classifies a peer that
closes without close_notify as an unexpected-EOF protocol error, so every
terminal or file transfer session logged an SSL_read failure on the real
servers even though Recv promises 0 for a plain close and neither side sends
close_notify. SSL_OP_IGNORE_UNEXPECTED_EOF restores the intended semantics.

Verified with the reload unit test (RELOAD-OK, covering the in-flight
connection across a context swap, garbage payload rejection and a broken
anchor keeping TLS alive), an abrupt-close test (recv now returns 0 instead
of SOCKET_ERROR) and end to end against a protocol-faithful fake server that
signs MasterSettings with libsign: plaintext login, 166, TLS reconnect with
RES_TLS=1, 167, plaintext reconnect with RES_TLS=0. The Linux client, the
Debug Windows client and the Debug MFC server all build.

The cost is inherent to taking effect immediately: a remote session in
progress is dropped when the transport changes, and the MFC server briefly
shows the client as a duplicate login until the old connection is reaped
and the standby entry is promoted.

Co-Authored-By: deepseek-flash
Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-10-28 14:15:40 +01:00
yuanyuanxianganddeepseek-flash c11df75225 Fix: Report the real runtime instead of a timezone skew in host info
The host info popup showed a constant "7h" runtime for every Linux host.
szStartTime carries no timezone marker and the two sides disagree: the
Windows client sends its own wall clock (client/LoginServer.cpp
getProcessTime), while the Linux and Android clients send Beijing time
unconditionally (linux/main.cpp and common/commands.h ToPekingTimeAsString
hardcode UTC+8). GetElapsedTime then built the base time with CTime as
local time and subtracted it from the local clock, so on any server that
is not at UTC+8 the start time landed in the future; the absolute value
turned that skew into a plausible-looking duration (UTC+1 gives exactly
7h).

GetElapsedTime now picks the reference "now" by client type: LNX and APK
are compared against the current Beijing time, everything else keeps
using the local clock. A start time in the future now clamps to 0 instead
of being mirrored, so a clock disagreement shows as unknown rather than
as a fake runtime.

The Linux client also reported the wrong thing entirely: it sent the
current time at login, not the process start time, so the value was
always about zero whenever the timezones happened to agree. It now
records its own wall clock once at load and reports Beijing time built
from it, matching the semantics of the Windows client. An upgrade forks
a new process, so the counter restarts after an upgrade as expected.

The first implementation read /proc/self/stat starttime plus /proc/stat
btime, which looked like the exact equivalent of the Windows call, but
btime is computed from the wall clock at boot and never corrected when
NTP later steps the clock, so on WSL2 it drifted by 1.8h. Recording the
value in the process itself has no such failure mode.

Verified against a Debug server with a WSL Ubuntu 24.04 client and a
Windows client: the popup now reports "2.3m" for a Linux process started
2.3 minutes earlier (previously 7h), the startup timestamp is the process
load time in Beijing time, and the Windows host still reports 14s right
after it connects.

Co-Authored-By: deepseek-flash
2026-10-27 21:39:31 +01:00
yuanyuanxianganddeepseek-flash 4d2abf34d0 Feature: Support the Tier 1 MCP tools on Linux clients
All of these tools already had a working wire protocol on the Linux
client (SystemManager.h, common/PTYHandler.h, ScreenHandler.h); only the
server-side client-type gates rejected LNX hosts. kill_process,
exec_command, terminal_open/exec/close and remote_open/close/mouse/
keyboard/clipboard now accept LNX and reject only MAC (plus APK where it
applied). No client change, no capability bit.

exec_command and terminal_exec needed platform-aware plumbing because a
POSIX shell understands none of the Windows constructs: the sentinel is
now "PS1=" / the command / "echo __MCP_DONE_<nonce>__$?" over the Linux
PTY, with output decoded as UTF-8. The PS1= line exists because
interactive bash prints its prompt after every line it reads, which
otherwise leaks into stdout; its echo sits ahead of the command echo and
is removed together with it. The Windows ConPTY and legacy non-PTY forms
are unchanged.

The default command whitelist is now platform-specific: identically named
POSIX commands can write files or change system state (find -exec,
sort -o, hostname), so kDefaultCmdWhitelistPosix only lists commands that
stay read-only even with arguments. env is deliberately excluded, since
"env <program>" runs arbitrary programs and would defeat the whitelist
entirely. An explicit McpCmdWhitelist still overrides both platforms. The
forbidden metacharacter set is split the same way: on Linux it covers
& | < > ; backtick and $( / ${ / !, where ! triggers history expansion in
interactive bash. ^ is not a POSIX metacharacter, so read-only commands
like "grep -v ^# /etc/hosts" are accepted on Linux while Windows keeps
rejecting them.

Input injection had to be sent one MSG64 per COMMAND_SCREEN_CONTROL
packet. The protocol allows batching and the Windows client handles it,
but linux/ScreenHandler.h only processes the first message of a packet,
so a batch left key_press stuck down (X11 autorepeat), click
half-pressed and type emitting only its first character. Splitting the
packets is equivalent for Windows, which processes one message at a time
anyway, and keeps already-deployed Linux clients working without an
upgrade.

Verified on a Debug server against a WSL Ubuntu 24.04 client and a
Windows client: exec_command returned real exit codes (0/1/2) with clean
output, -32007/-32008 negatives, and the POSIX-only ^ allowance;
persistent terminals kept cwd and environment, returned 1 for false and
the last exit code for ";" chains, and closed idempotently; kill_process
killed a test process, returned an empty remaining list and skipped
pid 1; remote_open reported 3840x1140, remote_mouse mapped (0.5,0.5) to
(1920,570), xev showed balanced press/release pairs for keys and buttons,
and a Chinese clipboard round-trip came back as UTF-8. The Windows
regression of the same tools was unchanged, including the multi-monitor
gate on remote_open.

Co-Authored-By: deepseek-flash
2026-10-27 21:15:44 +01:00
yuanyuanxianganddeepseek-flash 3a158a241c Feature: Support upload_file and download_file on Linux and macOS hosts
Both tools used to reject LNX/MAC targets outright. The server now gates
on the target client type instead: a POSIX target must pass an absolute
POSIX remote path without a backslash or a ".." segment (-32602
otherwise), while Windows targets keep their exact previous behaviour.

upload_file needed no new client command; the POSIX receiver already
handles COMMAND_SEND_FILE_V2 and derives the destination from the packet
name. It now also reports a real receiver_ack: the upload session
records dstClientID/transferID, and OnC2CRecvResult matches the 176
acknowledgement from Linux targets, so a destination write failure
becomes -32011 and a missing ack (with bytes in flight) becomes -32001.

download_file needed two pieces on the POSIX side, both shared by Linux
and macOS through common/FileTransferV2.h: a FileCompletePacketV2 per
file with a streaming SHA-256 (new self-contained common/sha256_posix.h,
since BCrypt is Windows-only) so the server can count completed files
and verify digests, and a TOKEN_DOWNLOAD_ERROR reply when the requested
paths do not exist or are denied, which the server maps to
-32009/-32010 within milliseconds instead of waiting for the stall
watchdog.

Zero-byte files were lost when uploading to POSIX targets because the
worker sends no data chunk for them and the complete packet carries no
path, so the receiver had nothing to create. The server now injects a
zero-length final chunk for each empty file, only for POSIX targets;
Windows targets keep their existing behaviour.

Also fixes a download completion edge case found while testing: the
client decides entry order, so a directory may arrive after all files
(an empty subdirectory, for example), and the directory branch only
completed when the directory count alone covered totalFiles. The check
is now filesDone + directoryCount >= totalFiles.

Verified end to end against a WSL Linux client and a Windows client:
upload and download of a tree with a 3 MB binary, a Chinese filename, an
empty file and an empty subdirectory all round-trip with matching
SHA-256; the documented error paths (-32602, -32009, -32011, -32001) and
the Windows upload/download/C2C regressions were exercised as well.

Co-Authored-By: deepseek-flash
2026-10-27 20:39:22 +01:00
yuanyuanxianganddeepseek-flash 4146c73657 Feature: Make Linux a copy_files_c2c destination
The C2C file transfer tool required both ends to be Windows clients. A Linux
client can already land the files: the Windows source worker builds every
entry name by plain string concatenation of dst_dir and the relative path, so
a POSIX dst_dir such as /tmp/recv arrives as "/tmp/recv\sub\file", which the
POSIX receiver normalizes to "/" and writes below an absolute path. What was
missing was the server gate and any way to tell whether the writes succeeded.

The server now accepts LNX/MAC destinations instead of rejecting them, and
validates dst_dir by destination type: an absolute Windows path for Windows
targets, an absolute POSIX path without backslashes for POSIX targets. The
paths and dst_dir arguments also reject embedded NULs, and a POSIX dst_dir is
converted to CP936 exactly so unencodable characters fail loudly instead of
silently becoming '?'.

To make receiver_ack meaningful, a Linux client that receives a C2C transfer
now reports what it wrote. It tracks the outcome per transferID, counting a
directory entry, the last chunk of a file and the completion packet of an
empty file as the three ways an item is settled, with done sets so that
source retries and the trailing completion packet never double count. When
every item is settled it sends one C2CSendResultPacket back on its main
connection under the new TOKEN_C2C_RECV_RESULT (176), with the first errno in
the win32err field and the mapped FEV2_* status. A dedicated token is used
instead of reusing 175 because a host can be the destination of one transfer
while being the source of another, and a destination result must never latch
the source side's done flag.

The server waits up to five seconds for that acknowledgement after the source
reports success, and only for destinations advertising the new
CLIENT_CAP_C2C_RECV_ACK capability bit (Linux only, macOS reports nothing).
A failed acknowledgement becomes -32011 with the status, errno and received
file count; a missing acknowledgement stays an error only for transfers that
actually moved bytes, since a transfer of empty files alone gives the
receiver nothing to learn totalFiles from. Windows destinations are unchanged
and skip the wait entirely.

Verified on the debug instance: Windows to Linux (WSL Ubuntu 24.04) with
subdirectories, an empty directory, a Chinese file name and a 3 MB binary
lands with matching SHA-256 and receiver_ack true; a Windows-style dst_dir
returns -32602; an unwritable POSIX destination returns -32011; the existing
Windows to Windows cases still pass with receiver_ack false and the same
latency.

Co-Authored-By: deepseek-flash
2026-10-27 19:22:12 +01:00
yuanyuanxianganddeepseek-flash 4c0e86dcc5 Feature: Upgrade a Linux client from the server
The Linux client is a standalone ELF with no in-memory loader and no
COMMAND_UPDATE handler, so the server's upgrade menu silently did nothing
for an LNX host. It can now push a new binary and have the client replace
and restart itself.

The server grows an LNX branch next to EXE/DLL/SC. It takes the ELF from an
explicit settings.ini LinuxClientPath, then ghost_linux_amd64 in the
program directory, then res\ghost_linux, then IDR_LINUX_GHOST, the copy
the server has always embedded for the client-build dialog, so a server
with nothing on disk can still upgrade; a configured path that cannot be
read is an error rather than a silent fallback. Only x86_64 ELF64 is
accepted. The payload adds a 32-byte MD5 trailer to the existing
[cmd][size:8][payload] layout, which the Windows branches keep unchanged.

linux/ghost in the tree is still the build from before this change and is
not updated here. It has to be refreshed before release: the embedded
default is copied from it at build time, and a stale copy would install a
client with no COMMAND_UPDATE handler, which can never be upgraded
remotely again.

The client verifies the declared size, elf magic, e_machine against its own
ELF header and the MD5 before touching anything, so a miscopied or corrupted
file never lands on disk. It then writes a same-directory temp file with
fsync and 0755 (a running executable cannot be truncated in place), renames
it over its own path atomically, keeps the replaced inode as .old, removes
the PID file, forks a detached child that waits for the old process to exit
and execs the new binary with the original argv, and finally exits with
S_CLIENT_UPDATE. Doing the rename and the exec in that order avoids ETXTBSY,
double connections under one client id, and a new instance that
isAlreadyRunning() would refuse to start.

Any failure (unwritable install directory, bad payload, fork) leaves the
client running on the old version; the reason goes to the client log and to
the server's message log through TOKEN_CLIENT_MSG, which required moving
that struct out of the Windows-only block in common/commands.h.

The shared client source had also stopped compiling off Windows: the
unknown-header diagnostic in IOCPClient::OnServerReceiving printed
TlsEnabled() and m_tls.IsReady() unconditionally, but TlsChannel and m_tls
only exist on Windows. That diagnostic now keeps the TLS details where the
channel exists and prints just the buffer dump everywhere else.

Verified end to end in WSL against the Debug server, foreground and -d
daemon: the PID changes, the installed file matches the pushed MD5, the host
reconnects, and ghost.old holds the previous binary. A read-only install
directory reports "cannot create ...: Permission denied" in the server log
with the client still online. With an invalid file at ghost_linux_amd64 the
server refuses it and names that path, which shows the disk source wins;
with nothing on disk the update goes through from the embedded ELF.

Co-Authored-By: deepseek-flash
2026-10-27 18:25:34 +01:00
yuanyuanxiang 218ee4f43d Feat: TV remote control via D-pad focus navigation using AccessibilityService 2026-06-24 22:31:14 +02:00
yuanyuanxiang 3f662f1ca7 Fix: macOS use quality profile FPS/bitrate, add HW resolution downscaling 2026-06-10 22:40:03 +02:00
yuanyuanxiang 8e5ec20cf2 Fix: Calculate RTT exclude server side UI queue delay time 2026-06-09 10:01:50 +02:00
yuanyuanxiang 1fd431ba76 Fix(logger): preserve queued logs on shutdown; record exit signal 2026-05-27 08:55:14 +02:00
yuanyuanxiang 62e962f216 doc(linux): Add linux client install.sh & uninstall.sh 2026-05-22 22:02:38 +02:00
yuanyuanxiang e264e092f6 Fix(client): harden TCP heartbeat against half-dead connections 2026-05-20 15:22:13 +02:00
yuanyuanxiang cd43caafb2 Fix: Web remote desktop reliability and UX
- Server: clamp web session adaptive quality to H264-only levels (>=Good) in EvaluateQuality and ApplyQualityLevel; Ultra/High (DIFF/RGB565) caused the browser to freeze ~1 min into a session
- Server: move session-type detection to the top of ScreenSpyDlg::OnInitDialog and skip SetWindowPlacement/EnterFullScreen for hidden web sessions, eliminating the MFC dialog flash on web-triggered opens
- Linux client: default QualityLevel from QUALITY_ADAPTIVE to QUALITY_GOOD to match Windows/macOS so the server's adaptive controller doesn't auto-upgrade to non-H264 algorithms
- Web: clear the floating quick-action toolbar on fullscreen exit so its row of buttons (RDP reset / Mouse / Close) doesn't stay pinned to the top of the page
- Web: route F11 to the remote in control mode instead of toggling local fullscreen
- Web: route Esc to the remote in control mode via the Keyboard Lock API instead of exiting native fullscreen
2026-05-19 18:39:16 +02:00
yuanyuanxiang ab7a16bec5 Feature: Support building macOS client via "Build-Dialog" 2026-05-10 19:46:48 +02:00
yuanyuanxiang d46176f4ef Refactor: extract Linux/macOS client shared code into common 2026-05-10 10:15:14 +02:00
yuanyuanxiang a354f1ed86 Improve: Embed Modern Terminal DLL in master's resources
Fix: keep Linux/macOS client alive across server restarts; gate all commands on auth-verified state to neutralize unauthorized servers
2026-05-09 00:43:55 +02:00
yuanyuanxiang f85cc8b86c Fix: Linux client UTF-8 path/active-window garbled on server 2026-05-08 14:03:45 +02:00
yuanyuanxiang bc06fd5af5 Feature: Linux/macOS server-identity gate via libsign.a
fix remote-cursor flicker on Windows controller
2026-05-08 12:39:59 +02:00
yuanyuanxiangandClaude Opus 4.7 ef8165c3b4 Feature: sub-connection auth (TOKEN_CONN_AUTH) with HMAC + clientID binding
Client first packet on every sub-connection signs (clientID || timestamp ||
nonce) and waits for server ack. Server verifies signature and pins clientID
on the sub-connection ctx, eliminating IP-reverse-lookup unreliability for
NAT/localhost scenarios. Sub-conn coverage: Win 12 sites, Linux/macOS 3-4
each. Main connection keeps existing TOKEN_LOGIN flow unchanged.

Includes:
- Protocol structs sized to 512/256 bytes with reserved space for future
  extensions (locale, OS info, session token, etc.)
- 5-min timestamp tolerance (Kerberos-grade replay window)
- 10-sec client wait for cross-pacific / weak-network tolerance
- Fix RemoveFromHostList side-effect ordering: MarkDeviceOffline and
  m_ActiveWndW.erase now only fire when ctx is actually removed from
  m_HostList, preventing sub-conn disconnects from misreporting main as
  offline (regression introduced by auth-set clientID on sub ctx)
- Fix latent bug: IOCPClient::m_conn was never assigned in ctor, leaving
  GetConnectionAddress() always NULL and FileManager V2 transfer's
  srcClientID always 0

Breaking change: new client cannot use sub-features against old server.
New server tolerates legacy clients (no auth). Future tightening can reject
unauthenticated sub-connections via IsAuthenticated() flag.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 00:04:40 +02:00
yuanyuanxiang 2c5b5ad628 Improve: client/server - stable client ID via MachineGuid+path (V2) 2026-05-06 21:32:06 +02:00
yuanyuanxiang 6113b4653d Fix: Resend login info after group change for macOS/Linux clients 2026-05-05 13:35:02 +02:00
yuanyuanxiang 12e2a33062 Fix: Prevent reconnect crash by clearing callback before destruction 2026-05-03 13:16:02 +02:00
yuanyuanxiang a8b0932080 Feature: Implement Linux cursor type detection using XFixes extension 2026-05-03 12:58:29 +02:00
yuanyuanxiang ca37fa419a Feat: Implement H264 for Linux client with dynamic libx264 loading 2026-05-03 12:15:22 +02:00
yuanyuanxiang 36423b1c7c Refactor: Move FileManager to common, add macOS file management support 2026-05-03 10:30:30 +02:00
yuanyuanxiang a3611d9fc1 Feature: Add terminal support for macOS client with shared PTYHandler 2026-05-03 09:33:47 +02:00
yuanyuanxiang 9ae5529458 Fix: Ensure MFC and Web remote desktop sessions are fully independent 2026-05-02 19:16:30 +02:00
yuanyuanxiang 171fa750e5 Feature: Persist group name to config file and include in login info 2026-05-02 19:14:21 +02:00
yuanyuanxiang 7a90d217f3 fix: Missing "linux/lib/libzstd.a" to build Linux client 2026-04-29 19:47:25 +02:00
yuanyuanxiang 5a325a202b Init: Migrate SimpleRemoter (Since v1.3.1) to Gitea 2026-04-19 22:55:21 +02:00