mirror of
https://github.com/localsend/localsend.git
synced 2026-06-23 04:10:07 +00:00
feat: use ComputerName instead of hostname on macOS (#2729)
This commit is contained in:
@@ -351,8 +351,13 @@ class SettingsTab extends StatelessWidget {
|
||||
message: t.settingsTab.network.useSystemName,
|
||||
child: IconButton(
|
||||
onPressed: () async {
|
||||
// Uses dart.io to find the systems hostname
|
||||
final newAlias = Platform.localHostname;
|
||||
final String newAlias;
|
||||
if (Platform.isMacOS) {
|
||||
final result = await Process.run('scutil', ['--get', 'ComputerName']);
|
||||
newAlias = result.stdout.toString().trim();
|
||||
} else {
|
||||
newAlias = Platform.localHostname;
|
||||
}
|
||||
|
||||
vm.aliasController.text = newAlias;
|
||||
await ref.notifier(settingsProvider).setAlias(newAlias);
|
||||
|
||||
Reference in New Issue
Block a user