Files
flutter_opencode_client/lib/data/model/server/custom.dart
GT610 3c592baf2c fix: Use latest dartssh2 and add a switch for temperature between celsius and millicelsius (#1095)
* refactor(sftp): Optimize file download logic and SSH command execution handling

Replace manual chunked downloads with a more concise `sftp.download` method
Consistently use `utf8.decode` to process SSH command output

Remove redundant code and comments, and simplify the logic

* chore: Update `dartssh2` submodule

* feat (Temperature Display): Added an option to switch between degrees Celsius and millicelsius

Allows users to switch temperature units in server settings, resolving the issue of incorrect temperature display on some devices

* chore: Add a participnt

* fix(sftp): Fixed a resource leak issue during file downloads and SSH command execution

Ensured that remote and local file handles are properly closed during file downloads to prevent resource leaks. Additionally, improved error handling during SSH command execution to ensure that all streams are either successfully completed or properly handled in the event of an error.
2026-04-01 11:27:58 +08:00

76 lines
1.8 KiB
Dart

import 'package:json_annotation/json_annotation.dart';
part 'custom.g.dart';
@JsonSerializable(includeIfNull: false)
final class ServerCustom {
// @HiveField(0)
// final String? temperature;
final String? pveAddr;
final bool pveIgnoreCert;
final String? pvePwd;
/// {"title": "cmd"}
final Map<String, String>? cmds;
final String? preferTempDev;
final bool tempIsCelsius;
final String? logoUrl;
/// The device name of the network interface displayed in the home server card.
final String? netDev;
/// The directory where the script is stored.
final String? scriptDir;
const ServerCustom({
//this.temperature,
this.pveAddr,
this.pveIgnoreCert = false,
this.pvePwd,
this.cmds,
this.preferTempDev,
this.tempIsCelsius = false,
this.logoUrl,
this.netDev,
this.scriptDir,
});
factory ServerCustom.fromJson(Map<String, dynamic> json) => _$ServerCustomFromJson(json);
Map<String, dynamic> toJson() => _$ServerCustomToJson(this);
@override
bool operator ==(Object other) {
return other is ServerCustom &&
//other.temperature == temperature &&
other.pveAddr == pveAddr &&
other.pveIgnoreCert == pveIgnoreCert &&
other.pvePwd == pvePwd &&
other.cmds == cmds &&
other.preferTempDev == preferTempDev &&
other.tempIsCelsius == tempIsCelsius &&
other.logoUrl == logoUrl &&
other.netDev == netDev &&
other.scriptDir == scriptDir;
}
@override
int get hashCode =>
//temperature.hashCode ^
pveAddr.hashCode ^
pveIgnoreCert.hashCode ^
pvePwd.hashCode ^
cmds.hashCode ^
preferTempDev.hashCode ^
tempIsCelsius.hashCode ^
logoUrl.hashCode ^
netDev.hashCode ^
scriptDir.hashCode;
}