feat: split settings into category pages and add an about page

- the settings screen is now an index: 通用 → 聊天, 外观 → 主题 / 宠物,
  帮助与关于 → 关于; each row opens its own page, the controls moved
  there unchanged
- 关于 shows the app version, the server's OpenCode (/api/info) and
  OpenChamber (/api/version) versions with a refresh, and the open-source
  licenses, listed per package with their full text on tap
- the app version is read from the platform at startup
  (package_info_plus), so pubspec.yaml is the only place it is written;
  the pairing/relay handshake now sends it too instead of a constant that
  had drifted
This commit is contained in:
blumia committed 2026-11-25 12:39:48 +08:00
1 parent 00564fe94b
commit 2185054aab
11 files changed
+736 -192

No files matched your search

+18
View File
@@ -122,6 +122,24 @@ class Client {
return Session.fromJson(r['data'] as Map<String, dynamic>);
}
/// The versions behind the server. Each endpoint is optional: an older
/// server answers neither, and the about page then says it could not tell.
Future<ServerVersions> serverVersions() async {
var opencode = '';
var openchamber = '';
try {
final info = await _json('GET', '/api/info');
final v = info['version'];
if (v is String) opencode = v;
} catch (_) {}
try {
final version = await _json('GET', '/api/version');
final v = version['openchamberVersion'];
if (v is String) openchamber = v;
} catch (_) {}
return ServerVersions(opencode: opencode, openchamber: openchamber);
}
Future<Set<String>> activeSessions() async {
final r = await _json('GET', '/api/session/active');
final data = r['data'] as Map<String, dynamic>? ?? {};
+9
View File
@@ -1093,3 +1093,12 @@ List<String> generatedImagePaths(ContentPart part) {
}
return out;
}
/// What the server says it runs: OpenCode itself (`/api/info`) and the
/// OpenChamber web layer in front of it (`/api/version`). Either may be
/// empty on older servers.
class ServerVersions {
final String opencode;
final String openchamber;
const ServerVersions({this.opencode = '', this.openchamber = ''});
}
+4 -2
View File
@@ -19,13 +19,15 @@ class RelayTransport implements Transport {
required String serverId,
required Map<String, dynamic> hostKey,
String? grant,
String version = appVersion,
String? version,
}) : _tunnel = RelayTunnel(
relayUrl: relayUrl,
serverId: serverId,
hostKey: hostKey,
grant: grant,
appVersion: version,
// Read at construction: the version is known once the app has
// started, which is after this default would have been fixed.
appVersion: version ?? appVersion,
);
@override