HTTP 探测改为填写网址,缺本机引擎时立刻失败

HTTP 模式不再单独填端口。完整网址沿用其中的协议、端口和路径;只写主机名或 IP 时按 http 和 80 端口。超时默认改为 5000 毫秒。本机找不到或启动不了 netquality-reflector 时直接说明原因,并建议改用远程节点,不再记成一次全部失败。

Co-authored-by: yanjiu0721 <yanjiu0721@users.noreply.github.com>
This commit is contained in:
Cursor Agentandyanjiu0721 committed 2026-11-22 07:56:16 +00:00
1 parent 846e40c023
commit 918ec8f190
20 files changed
+807 -131

No files matched your search

+37
View File
@@ -81,6 +81,43 @@ void main() {
},
);
testWidgets('HTTP mode uses a URL, a 5 second timeout, and no port field', (
tester,
) async {
SharedPreferences.setMockInitialValues({});
tester.view.physicalSize = const Size(1280, 1800);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
await tester.pumpWidget(const NetQualityApp());
await tester.pumpAndSettle();
await tester.ensureVisible(find.byKey(const Key('profile')));
await tester.tap(find.byKey(const Key('profile')));
await tester.pumpAndSettle();
await tester.tap(find.text('HTTP').last);
await tester.pumpAndSettle();
expect(find.byKey(const Key('port-field')), findsNothing);
expect(find.text('HTTP 默认 5000 毫秒'), findsOneWidget);
expect(find.text('5000'), findsWidgets);
expect(
find.text('只填主机名或 IP 时按 http:// 和端口 80。完整网址使用其中的协议、端口和路径。'),
findsOneWidget,
);
expect(find.byKey(const Key('target-field')), findsOneWidget);
await tester.enterText(find.byKey(const Key('timeout-field')), '2000');
await tester.tap(find.byKey(const Key('profile')));
await tester.pumpAndSettle();
await tester.tap(find.text('合作反射 UDP').last);
await tester.pumpAndSettle();
expect(find.byKey(const Key('port-field')), findsOneWidget);
expect(find.text('19091'), findsWidgets);
expect(find.text('2000'), findsOneWidget);
expect(find.text('HTTP 默认 5000 毫秒'), findsNothing);
});
testWidgets('editing a node keeps its id and does not reveal the token', (
tester,
) async {