Add initial Avalonia desktop device workbench

This commit is contained in:
tongtong committed 2026-11-12 14:42:42 +08:00
1 parent 3fb894c1a1
commit 87e888af69
12 files changed
+221

No files matched your search

+3
View File
@@ -10,3 +10,6 @@ __pycache__/
*.log *.log
*.env *.env
/config/private/ /config/private/
/desktop/**/bin/
/desktop/**/obj/
+4
View File
@@ -172,3 +172,7 @@ python tests/real_device.py --adb-server 192.168.5.222:5037 --serial 192.168.100
- 当前 WebSocket 关闭会结束整个 TCP 通道,不保留半关闭语义;已覆盖常规双向流量,额外工具的特殊连接语义需单独测试。 - 当前 WebSocket 关闭会结束整个 TCP 通道,不保留半关闭语义;已覆盖常规双向流量,额外工具的特殊连接语义需单独测试。
协议说明见 `docs/protocol.md`。此前的 Python 局域网桥接保留在 `adb_bridge.py`,说明在 `docs/local-bridge.md`,与新三端实现独立。 协议说明见 `docs/protocol.md`。此前的 Python 局域网桥接保留在 `adb_bridge.py`,说明在 `docs/local-bridge.md`,与新三端实现独立。
## 桌面客户端(Avalonia)
设备列表、配置、连接管理、托盘、运行日志及 scrcpy 独立窗口手机控制现已放在 `desktop/`。启动和工具路径配置见 [桌面客户端说明](desktop/README.md)。
+5
View File
@@ -0,0 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup><OutputType>WinExe</OutputType><TargetFramework>net8.0</TargetFramework><Nullable>enable</Nullable><ImplicitUsings>enable</ImplicitUsings></PropertyGroup>
<ItemGroup><PackageReference Include="Avalonia.Desktop" Version="11.3.8"/><PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.8"/><PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0"/></ItemGroup>
<ItemGroup><AvaloniaResource Include="Assets/**"/></ItemGroup></Project>
+3
View File
@@ -0,0 +1,3 @@
<Application xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="Ads.Desktop.App" RequestedThemeVariant="Dark">
<Application.Styles><FluentTheme/></Application.Styles>
</Application>
+40
View File
@@ -0,0 +1,40 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using Avalonia.Media.Imaging;
using CommunityToolkit.Mvvm.Input;
namespace Ads.Desktop;
public partial class App : Application
{
private bool quitting;
public override void Initialize() => AvaloniaXamlLoader.Load(this);
public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
var vm = new MainViewModel();
var window = new MainWindow { DataContext = vm };
desktop.MainWindow = window;
desktop.ShutdownMode = ShutdownMode.OnExplicitShutdown;
void Show() { window.Show(); window.WindowState = WindowState.Normal; window.Activate(); }
var menu = new NativeMenu();
var show = new NativeMenuItem("打开设备工作台"); show.Click += (_, _) => Show(); menu.Items.Add(show);
var quit = new NativeMenuItem("退出并断开连接");
quit.Click += async (_, _) => { quitting = true; await vm.ShutdownAsync(); desktop.Shutdown(); };
menu.Items.Add(quit);
using var stream = Avalonia.Platform.AssetLoader.Open(new Uri("avares://Ads.Desktop/Assets/app.png"));
var tray = new TrayIcon { ToolTipText = "ADS · Android 设备工作台", Icon = new WindowIcon(stream), Menu = menu, Command = new RelayCommand(Show) };
TrayIcon.SetIcons(this, new TrayIcons { tray });
window.Closing += async (_, e) => {
if (quitting) return;
e.Cancel = true;
if (vm.MinimizeToTray) window.Hide();
else { quitting = true; await vm.ShutdownAsync(); desktop.Shutdown(); }
};
desktop.Exit += (_, _) => { tray.Dispose(); vm.Dispose(); };
}
base.OnFrameworkInitializationCompleted();
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

+61
View File
@@ -0,0 +1,61 @@
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json;
using Avalonia.Threading;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
namespace Ads.Desktop;
public record Device(string Id,bool Busy) { public string Description=>Busy?"在线 · 已占用":"在线 · 可连接"; }
public partial class MainViewModel:ObservableObject,IDisposable
{
[ObservableProperty] private string server="wss://ads.ttstd.com";
[ObservableProperty] private string token=Environment.GetEnvironmentVariable("ADS_CLIENT_TOKEN")??"";
[ObservableProperty] private string clientPath=FindClient();
[ObservableProperty] private string adbPath="adb";
[ObservableProperty] private string scrcpyPath="scrcpy";
[ObservableProperty] private int port=15555;
[ObservableProperty] private int maxSize=1920;
[ObservableProperty] private int maxFps=60;
[ObservableProperty] private bool audio;
[ObservableProperty] private bool viewOnly;
[ObservableProperty] private bool minimizeToTray=true;
[ObservableProperty] private Device? selectedDevice;
[ObservableProperty] private string status="尚未连接";
[ObservableProperty] private string activeEndpoint="请选择在线设备";
[ObservableProperty] private string notice="填写客户端令牌,然后刷新设备。";
[ObservableProperty] private string deviceSummary="尚未刷新";
public ObservableCollection<Device> Devices {get;}=new();
public ObservableCollection<string> Logs {get;}=new();
private Process? client,scrcpy;
private string? endpoint,activeAdb,activeId;
private bool probing,stopping;
private readonly DispatcherTimer timer;
private readonly HttpClient http=new(new HttpClientHandler{AllowAutoRedirect=false}){Timeout=TimeSpan.FromSeconds(10)};
private static readonly string Folder=Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),"TTSTD","ADS");
private static string FindClient() { var name=OperatingSystem.IsWindows()?"ads-client.exe":"ads-client"; for(var d=new DirectoryInfo(AppContext.BaseDirectory);d!=null;d=d.Parent){var p=Path.Combine(d.FullName,"bin",name);if(File.Exists(p))return p;}return name; }
public MainViewModel() {
try {var p=Path.Combine(Folder,"settings.json"); if(File.Exists(p)){var s=JsonSerializer.Deserialize<Settings>(File.ReadAllText(p));if(s!=null){Server=s.Server;ClientPath=s.Client;AdbPath=s.Adb;ScrcpyPath=s.Scrcpy;Port=s.Port;MaxSize=s.Size;MaxFps=s.Fps;Audio=s.Audio;ViewOnly=s.ViewOnly;MinimizeToTray=s.Tray;}}}catch(Exception e){Log(e.Message);}
timer=new DispatcherTimer{Interval=TimeSpan.FromSeconds(3)};timer.Tick+=async(_,_)=>await ProbeAsync();timer.Start();
}
private void Log(string s)=>Dispatcher.UIThread.Post(()=>{if(Token.Length>0)s=s.Replace(Token,"[REDACTED]");Logs.Add($"{DateTime.Now:HH:mm:ss} {s}");while(Logs.Count>1000)Logs.RemoveAt(0);});
private async Task Guard(Func<Task> f){try{await f();}catch(Exception e){Notice=e.Message;Log(e.Message);}}
private Uri Validate(){if(!Uri.TryCreate(Server,UriKind.Absolute,out var u)||u.Scheme!="wss"||string.IsNullOrEmpty(u.Host)||u.AbsolutePath!="/"||u.Query!=""||u.Fragment!=""||u.UserInfo!="")throw new InvalidOperationException("请输入根路径 WSS 中继地址。");if(Token.Length<32)throw new InvalidOperationException("客户端令牌至少需要 32 个字符。");return u;}
[RelayCommand] private Task RefreshAsync()=>Guard(async()=>{var u=Validate();using var req=new HttpRequestMessage(HttpMethod.Get,new UriBuilder(u){Scheme="https",Path="/v1/devices"}.Uri);req.Headers.Authorization=new AuthenticationHeaderValue("Bearer",Token);using var res=await http.SendAsync(req);res.EnsureSuccessStatusCode();var rows=await res.Content.ReadFromJsonAsync<Device[]>()??[];var id=SelectedDevice?.Id;Devices.Clear();foreach(var d in rows.OrderBy(d=>d.Id))Devices.Add(d);SelectedDevice=Devices.FirstOrDefault(d=>d.Id==id)??Devices.FirstOrDefault();DeviceSummary=$"{Devices.Count} 台在线设备";Notice="设备列表已更新";});
private ProcessStartInfo Info(string exe,IEnumerable<string> args){var i=new ProcessStartInfo(exe){UseShellExecute=false,CreateNoWindow=true,RedirectStandardOutput=true,RedirectStandardError=true};foreach(var a in args)i.ArgumentList.Add(a);foreach(var k in new[]{"ADB_SERVER_SOCKET","ANDROID_ADB_SERVER_ADDRESS","ANDROID_ADB_SERVER_PORT","ADS_CLIENT_TOKEN"})i.Environment.Remove(k);i.Environment["NO_COLOR"]="1";return i;}
private Process Start(ProcessStartInfo i){var p=new Process{StartInfo=i};p.OutputDataReceived+=(_,e)=>{if(e.Data!=null)Log(e.Data);};p.ErrorDataReceived+=(_,e)=>{if(e.Data!=null)Log(e.Data);};try{p.Start();p.BeginOutputReadLine();p.BeginErrorReadLine();return p;}catch{p.Dispose();throw;}}
[RelayCommand] private Task ConnectAsync()=>Guard(async()=>{Validate();var d=SelectedDevice??throw new InvalidOperationException("请选择设备。");if(client!=null)throw new InvalidOperationException("请先断开当前连接。");if(d.Busy)throw new InvalidOperationException("设备已被其他客户端占用。");if(Port is <1024 or >65535)throw new InvalidOperationException("端口范围 1024–65535。");var ep=$"127.0.0.1:{Port}";var i=Info(ClientPath,["--server",Server,"--device",d.Id,"--listen",ep,"--adb",AdbPath]);i.Environment["ADS_CLIENT_TOKEN"]=Token;client=Start(i);endpoint=ep;activeAdb=AdbPath;activeId=d.Id;ActiveEndpoint=$"{d.Id} → {ep}";Status="连接中 · 等待租约与调试授权";await Task.CompletedTask;});
private async Task<string> AdbAsync(params string[] args){using var p=Process.Start(Info(activeAdb??AdbPath,args))??throw new InvalidOperationException("无法启动 ADB");var o=p.StandardOutput.ReadToEndAsync();var e=p.StandardError.ReadToEndAsync();using var c=new CancellationTokenSource(TimeSpan.FromSeconds(8));try{await p.WaitForExitAsync(c.Token);}catch{if(!p.HasExited)p.Kill(true);throw;}var text=await o;var err=await e;if(p.ExitCode!=0)throw new InvalidOperationException("ADB:"+err.Trim());return text;}
private async Task ProbeAsync(){if(probing||stopping||client==null)return;probing=true;var current=client;try{if(current.HasExited){Notice=$"守护程序退出码:{current.ExitCode}";await DisconnectAsync();return;}var text=await AdbAsync("devices");if(client!=current||stopping)return;var row=text.Split('\n').Select(l=>l.Trim().Split((char[]?)null,StringSplitOptions.RemoveEmptyEntries)).FirstOrDefault(a=>a.Length>=2&&a[0]==endpoint);Status=row?[1] switch{"device"=>"已连接 · 可调试 / 控制","unauthorized"=>"等待手机允许 USB 调试","offline"=>"ADB 离线 · 正在恢复",_=>"连接中 · 等待设备 / 租约 / 网络恢复"};}catch(Exception e){Notice=e.Message;}finally{probing=false;}}
[RelayCommand] private Task StartScrcpyAsync()=>Guard(async()=>{if(client==null||client.HasExited||endpoint==null)throw new InvalidOperationException("请先连接设备。");if(scrcpy!=null&&!scrcpy.HasExited)throw new InvalidOperationException("控制窗口已打开。");if(MaxSize is <256 or >8192||MaxFps is <1 or >240)throw new InvalidOperationException("分辨率范围 256–8192,帧率范围 1–240。");var ep=endpoint;var state=await AdbAsync("-s",ep,"get-state");if(state.Trim()!="device"||endpoint!=ep)throw new InvalidOperationException("设备尚未就绪,请先完成手机调试授权。");var args=new List<string>{"--serial",ep,"--force-adb-forward","--window-title",$"ADS · {activeId}","--max-size",MaxSize.ToString(),"--max-fps",MaxFps.ToString()};if(!Audio)args.Add("--no-audio");if(ViewOnly)args.Add("--no-control");scrcpy?.Dispose();var i=Info(ScrcpyPath,args);i.Environment["ADB"]=activeAdb??AdbPath;scrcpy=Start(i);Notice="手机控制已启动,详情见日志。";});
private static async Task StopAsync(Process? p){if(p==null)return;try{if(!p.HasExited){p.Kill(true);await p.WaitForExitAsync();}}finally{p.Dispose();}}
[RelayCommand] private async Task StopScrcpyAsync(){var p=scrcpy;scrcpy=null;await StopAsync(p);}
[RelayCommand] private async Task DisconnectAsync(){if(stopping)return;stopping=true;try{await StopScrcpyAsync();var p=client;client=null;await StopAsync(p);if(endpoint!=null){try{await AdbAsync("disconnect",endpoint);}catch(Exception e){Log(e.Message);}}endpoint=null;activeAdb=null;activeId=null;Status="已断开";ActiveEndpoint="本地 ADB 通道已释放";}finally{stopping=false;}}
private record Settings(string Server,string Client,string Adb,string Scrcpy,int Port,int Size,int Fps,bool Audio,bool ViewOnly,bool Tray);
[RelayCommand] private void Save(){try{Directory.CreateDirectory(Folder);File.WriteAllText(Path.Combine(Folder,"settings.json"),JsonSerializer.Serialize(new Settings(Server,ClientPath,AdbPath,ScrcpyPath,Port,MaxSize,MaxFps,Audio,ViewOnly,MinimizeToTray),new JsonSerializerOptions{WriteIndented=true}));Notice="配置已保存,不包含令牌";}catch(Exception e){Notice=e.Message;}}
[RelayCommand] private void ClearLogs()=>Logs.Clear();
[RelayCommand] private void ExportLogs(){try{Directory.CreateDirectory(Folder);var p=Path.Combine(Folder,$"ads-{DateTime.Now:yyyyMMdd-HHmmss}.log");File.WriteAllLines(p,Logs);Notice="日志已导出:"+p;}catch(Exception e){Notice=e.Message;}}
public async Task ShutdownAsync(){timer.Stop();await DisconnectAsync();}
public void Dispose(){timer.Stop();http.Dispose();foreach(var p in new[]{scrcpy,client}){try{if(p!=null&&!p.HasExited)p.Kill(true);}catch{}p?.Dispose();}}
}
+54
View File
@@ -0,0 +1,54 @@
<Window xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="Ads.Desktop.MainWindow" Title="ADS · Android 设备工作台" Width="1180" Height="820" MinWidth="900" MinHeight="640" Background="#10151F">
<Window.Styles>
<Style Selector="TextBox"><Setter Property="Margin" Value="0,4,0,10"/></Style>
<Style Selector="Button"><Setter Property="Padding" Value="16,10"/><Setter Property="Margin" Value="0,0,8,0"/></Style>
<Style Selector="TextBlock.label"><Setter Property="Foreground" Value="#9CAFC7"/></Style>
</Window.Styles>
<Grid RowDefinitions="Auto,*,Auto" Margin="28">
<Grid ColumnDefinitions="*,Auto" Margin="0,0,0,22">
<StackPanel><TextBlock Text="ANDROID DEVICE STREAMING" Foreground="#66D9C0" FontSize="12" LetterSpacing="3"/><TextBlock Text="设备工作台" FontSize="30" FontWeight="Bold" Margin="0,8,0,4"/><TextBlock Text="远程连接 · 本地调试 · 手机控制" Classes="label"/></StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center"><Button Content="刷新设备" Command="{Binding RefreshCommand}"/><Button Content="保存配置" Command="{Binding SaveCommand}"/></StackPanel>
</Grid>
<TabControl Grid.Row="1">
<TabItem Header="设备与连接">
<Grid ColumnDefinitions="2*,3*" Margin="0,16,0,0">
<Border Background="#192230" CornerRadius="12" Padding="18" Margin="0,0,16,0">
<Grid RowDefinitions="Auto,*,Auto"><TextBlock Text="在线设备" FontSize="18" FontWeight="SemiBold"/>
<ListBox Grid.Row="1" ItemsSource="{Binding Devices}" SelectedItem="{Binding SelectedDevice}" Margin="0,16,0,12" Background="Transparent">
<ListBox.ItemTemplate><DataTemplate><StackPanel Margin="6,10"><TextBlock Text="{Binding Id}" FontSize="17"/><TextBlock Text="{Binding Description}" Foreground="#9CAFC7" Margin="0,6,0,0"/></StackPanel></DataTemplate></ListBox.ItemTemplate>
</ListBox>
<TextBlock Grid.Row="2" Text="{Binding DeviceSummary}" Classes="label" TextWrapping="Wrap"/>
</Grid>
</Border>
<ScrollViewer Grid.Column="1"><StackPanel Spacing="12">
<TextBlock Text="连接管理" FontSize="22" FontWeight="SemiBold"/>
<TextBlock Text="{Binding Status}" Foreground="#66D9C0" FontSize="16" TextWrapping="Wrap"/>
<TextBlock Text="{Binding ActiveEndpoint}" Classes="label"/>
<StackPanel Orientation="Horizontal"><Button Content="连接所选设备" Command="{Binding ConnectCommand}"/><Button Content="断开连接" Command="{Binding DisconnectCommand}"/></StackPanel>
<Border Background="#192230" CornerRadius="12" Padding="20" Margin="0,12,0,0"><StackPanel Spacing="12">
<TextBlock Text="scrcpy 手机控制" FontSize="19" FontWeight="SemiBold"/>
<TextBlock Text="连接成功并完成手机 USB 调试授权后,在独立窗口中显示与操作手机。" TextWrapping="Wrap" Classes="label"/>
<Grid ColumnDefinitions="*,*"><StackPanel><TextBlock Text="最大分辨率"/><TextBox Text="{Binding MaxSize}"/></StackPanel><StackPanel Grid.Column="1" Margin="12,0,0,0"><TextBlock Text="最大帧率"/><TextBox Text="{Binding MaxFps}"/></StackPanel></Grid>
<CheckBox Content="传输手机音频" IsChecked="{Binding Audio}"/>
<CheckBox Content="只看画面(禁止控制输入)" IsChecked="{Binding ViewOnly}"/>
<StackPanel Orientation="Horizontal"><Button Content="打开手机控制" Command="{Binding StartScrcpyCommand}"/><Button Content="停止投屏" Command="{Binding StopScrcpyCommand}"/></StackPanel>
</StackPanel></Border>
<TextBlock Text="提示:unauthorized 表示需要在手机上允许调试;设备被占用时需要先释放其他客户端的连接。" TextWrapping="Wrap" Classes="label"/>
</StackPanel></ScrollViewer>
</Grid>
</TabItem>
<TabItem Header="连接配置"><ScrollViewer><StackPanel Margin="4,18" MaxWidth="780" HorizontalAlignment="Stretch">
<TextBlock Text="中继服务器(WSS)"/><TextBox Text="{Binding Server}" Watermark="wss://ads.ttstd.com"/>
<TextBlock Text="客户端令牌(仅当前进程使用,不写入配置)"/><TextBox Text="{Binding Token}" PasswordChar="●"/>
<TextBlock Text="ads-client 可执行文件"/><TextBox Text="{Binding ClientPath}"/>
<TextBlock Text="ADB 可执行文件"/><TextBox Text="{Binding AdbPath}"/>
<TextBlock Text="scrcpy 可执行文件(选择官方发行包中的程序)"/><TextBox Text="{Binding ScrcpyPath}"/>
<TextBlock Text="本地 ADB 隧道端口"/><TextBox Text="{Binding Port}"/>
<CheckBox Content="关闭窗口时保留连接并最小化到托盘" IsChecked="{Binding MinimizeToTray}" Margin="0,12"/>
<TextBlock Text="配置修改在下一次连接时生效。令牌也可通过 ADS_CLIENT_TOKEN 环境变量提供。" TextWrapping="Wrap" Classes="label"/>
</StackPanel></ScrollViewer></TabItem>
<TabItem Header="运行日志"><Grid RowDefinitions="Auto,*" Margin="0,16,0,0"><StackPanel Orientation="Horizontal"><Button Content="清空日志" Command="{Binding ClearLogsCommand}"/><Button Content="导出日志" Command="{Binding ExportLogsCommand}"/></StackPanel><ListBox Grid.Row="1" ItemsSource="{Binding Logs}" Margin="0,12,0,0" FontFamily="Cascadia Mono,Consolas" FontSize="12"><ListBox.ItemTemplate><DataTemplate><TextBlock Text="{Binding}" TextWrapping="Wrap"/></DataTemplate></ListBox.ItemTemplate></ListBox></Grid></TabItem>
</TabControl>
<TextBlock Grid.Row="2" Text="{Binding Notice}" Foreground="#A8B7CC" Margin="0,18,0,0" TextWrapping="Wrap"/>
</Grid>
</Window>
+6
View File
@@ -0,0 +1,6 @@
using Avalonia.Controls;
namespace Ads.Desktop;
public partial class MainWindow : Window
{
public MainWindow() { InitializeComponent(); }
}
+7
View File
@@ -0,0 +1,7 @@
using Avalonia;
namespace Ads.Desktop;
internal static class Program
{
[STAThread] public static void Main(string[] args) => BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure<App>().UsePlatformDetect().LogToTrace();
}
+37
View File
@@ -0,0 +1,37 @@
# ADS 桌面客户端
C# / .NET 8 + Avalonia 11 + CommunityToolkit.Mvvm,Windows、Linux、macOS 共用代码。本次在 Windows 构建与启动验证。
## 启动
在 `desktop` 目录运行:
```powershell
dotnet run --project Ads.Desktop -c Release
```
或运行 `desktop/Ads.Desktop/bin/Release/net8.0/Ads.Desktop.exe`。
1. 在“连接配置”填写中继 WSS 根地址和 **客户端令牌**(不是 agent 令牌)。默认 `wss://ads.ttstd.com`;服务器域名与 TLS 必须已部署完成。
2. 设置 ads-client、ADB、scrcpy 的可执行文件路径。开发目录自动查找根目录 `bin/ads-client.exe`;ADB 和 scrcpy 默认使用 PATH。仓库 `adb/`、`scrcpy/` 是源码目录,不能作为可执行文件使用。
3. 刷新设备,选择空闲设备并连接。状态每 3 秒从本机 ADB 检查;未取得租约时显示等待状态,详细错误见日志。
4. 手机允许调试后,点击“打开手机控制”。scrcpy 使用独立窗口,支持鼠标、键盘操作;可设置分辨率、帧率、音频与只读模式。强制 `--force-adb-forward`,避免反向连接无法穿过中继。
5. 关闭窗口默认进入托盘,右键托盘可重新打开或退出。取消托盘选项后关闭窗口会退出。退出会停止本应用启动的 scrcpy、ads-client,并只断开所用 ADB 端点。
请从 scrcpy 官方发行包安装程序及配套 server、DLL 等文件,不要只复制 scrcpy.exe。首次调试必须在手机端授权。
## 边界
UI 使用 `/v1/devices` 的 Bearer 认证接口并管理现有 Rust ads-client 子进程,不承担 ADB 数据转发,也未新增本机 HTTP 管理 API。一次管理一个远程连接;断线重连由 ads-client 负责。完全退出 UI 后不保留后台守护进程。连接配置修改在下次连接生效。
令牌仅保存在内存,通过 `ADS_CLIENT_TOKEN` 子进程环境变量传递,可在启动 UI 前设置该环境变量。配置保存在系统 LocalApplicationData 下 `TTSTD/ADS/settings.json`,不包含令牌。日志最多保留 1000 条,可导出到同目录;不自动落盘。
托盘需要桌面环境支持;Linux 桌面可能需要 AppIndicator。未在 Linux/macOS 或真实手机上验收此 UI。真实投屏仍需远程 agent 在线、手机 TCP ADB 已开启且本机密钥获得手机授权。
## 发布
```powershell
dotnet publish Ads.Desktop -c Release -r win-x64 --self-contained true -o ../bin/desktop-win-x64
```
将对应平台的 ads-client 放到 PATH,或在设置指定绝对路径,同时安装 ADB 与 scrcpy。
+1
View File
@@ -0,0 +1 @@
{"sdk":{"version":"8.0.428","rollForward":"latestPatch"}}