From 7e3ac0cf2c0e4913733886d2cc1fd3425766a69d Mon Sep 17 00:00:00 2001 From: crschnick Date: Sun, 18 Aug 2024 11:24:14 +0000 Subject: [PATCH] Small fixes [stage] --- .../java/io/xpipe/app/browser/file/BrowserFileListComp.java | 4 ++-- .../java/io/xpipe/app/browser/fs/OpenFileSystemCache.java | 6 +++--- dist/changelogs/11.0.md | 1 + .../main/java/io/xpipe/ext/base/browser/ChgrpAction.java | 5 +++-- .../main/java/io/xpipe/ext/base/browser/ChownAction.java | 5 +++-- version | 2 +- 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/browser/file/BrowserFileListComp.java b/app/src/main/java/io/xpipe/app/browser/file/BrowserFileListComp.java index f64cdcba3..b3746c5dd 100644 --- a/app/src/main/java/io/xpipe/app/browser/file/BrowserFileListComp.java +++ b/app/src/main/java/io/xpipe/app/browser/file/BrowserFileListComp.java @@ -136,7 +136,7 @@ public final class BrowserFileListComp extends SimpleComp { table.setFixedCellSize(32.0); var os = fileList.getFileSystemModel().getFileSystem().getShell().orElseThrow().getOsType(); table.widthProperty().subscribe((newValue) -> { - if (os != OsType.WINDOWS) { + if (os != OsType.WINDOWS && os != OsType.MACOS) { ownerCol.setVisible(newValue.doubleValue() > 1000); } var width = getFilenameWidth(table); @@ -441,7 +441,7 @@ public final class BrowserFileListComp extends SimpleComp { if (fileList.getFileSystemModel().getFileSystem() != null) { var shell = fileList.getFileSystemModel().getFileSystem().getShell().orElseThrow(); - if (OsType.WINDOWS.equals(shell.getOsType())) { + if (OsType.WINDOWS.equals(shell.getOsType()) || OsType.MACOS.equals(shell.getOsType())) { modeCol.setVisible(false); ownerCol.setVisible(false); } else { diff --git a/app/src/main/java/io/xpipe/app/browser/fs/OpenFileSystemCache.java b/app/src/main/java/io/xpipe/app/browser/fs/OpenFileSystemCache.java index a818ec015..925bcb119 100644 --- a/app/src/main/java/io/xpipe/app/browser/fs/OpenFileSystemCache.java +++ b/app/src/main/java/io/xpipe/app/browser/fs/OpenFileSystemCache.java @@ -47,20 +47,20 @@ public class OpenFileSystemCache extends ShellControlCache { var lines = sc.command(CommandBuilder.of().add("cat").addFile("/etc/passwd")).readStdoutOrThrow(); lines.lines().forEach(s -> { var split = s.split(":"); - users.put(Integer.parseInt(split[2]), split[0]); + users.putIfAbsent(Integer.parseInt(split[2]), split[0]); }); } private void loadGroups() throws Exception { var sc = model.getFileSystem().getShell().orElseThrow(); - if (sc.getOsType() == OsType.WINDOWS) { + if (sc.getOsType() == OsType.WINDOWS || sc.getOsType() == OsType.MACOS) { return; } var lines = sc.command(CommandBuilder.of().add("cat").addFile("/etc/group")).readStdoutOrThrow(); lines.lines().forEach(s -> { var split = s.split(":"); - groups.put(Integer.parseInt(split[2]), split[0]); + groups.putIfAbsent(Integer.parseInt(split[2]), split[0]); }); } diff --git a/dist/changelogs/11.0.md b/dist/changelogs/11.0.md index d2567a4ae..1fc7c30be 100644 --- a/dist/changelogs/11.0.md +++ b/dist/changelogs/11.0.md @@ -42,6 +42,7 @@ Up until now, if you added a connection that always allocated pty, XPipe would c - Fix script enabled status being wrong after editing an enabled script - Fix download move operation failing when moving a directory that already existed in the downloads folder - Fix some scrollbars are necessarily showing +- There is now support to view and change users/groups in the file browser - External git vault data files are now also encrypted by default - Rework state information display for proxmox VMs - Automatically fill identity file for ssh config wildcard keys as well diff --git a/ext/base/src/main/java/io/xpipe/ext/base/browser/ChgrpAction.java b/ext/base/src/main/java/io/xpipe/ext/base/browser/ChgrpAction.java index 207f67f03..6e9253a4b 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/browser/ChgrpAction.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/browser/ChgrpAction.java @@ -33,13 +33,14 @@ public class ChgrpAction implements BranchAction { @Override public boolean isApplicable(OpenFileSystemModel model, List entries) { - return model.getFileSystem().getShell().orElseThrow().getOsType() != OsType.WINDOWS; + var os = model.getFileSystem().getShell().orElseThrow().getOsType(); + return os != OsType.WINDOWS && os != OsType.MACOS; } @Override public List getBranchingActions(OpenFileSystemModel model, List entries) { return model.getCache().getGroups().entrySet().stream() - .filter(e -> !e.getValue().equals("nogroup") && (e.getKey().equals(0) || e.getKey() >= 1000)) + .filter(e -> !e.getValue().equals("nohome") && !e.getValue().equals("nogroup") && !e.getValue().equals("nobody") && (e.getKey().equals(0) || e.getKey() >= 1000)) .map(e -> e.getValue()).map(s -> (LeafAction) new Chgrp(s)).toList(); } diff --git a/ext/base/src/main/java/io/xpipe/ext/base/browser/ChownAction.java b/ext/base/src/main/java/io/xpipe/ext/base/browser/ChownAction.java index a327d5f4c..93821a459 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/browser/ChownAction.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/browser/ChownAction.java @@ -33,13 +33,14 @@ public class ChownAction implements BranchAction { @Override public boolean isApplicable(OpenFileSystemModel model, List entries) { - return model.getFileSystem().getShell().orElseThrow().getOsType() != OsType.WINDOWS; + var os = model.getFileSystem().getShell().orElseThrow().getOsType(); + return os != OsType.WINDOWS && os != OsType.MACOS; } @Override public List getBranchingActions(OpenFileSystemModel model, List entries) { return model.getCache().getUsers().entrySet().stream() - .filter(e -> !e.getValue().equals("nobody") && (e.getKey().equals(0) || e.getKey() >= 1000)) + .filter(e -> !e.getValue().equals("nohome") && !e.getValue().equals("nobody") && (e.getKey().equals(0) || e.getKey() >= 1000)) .map(e -> e.getValue()).map(s -> (LeafAction) new Chown(s)).toList(); } diff --git a/version b/version index cbc5c7d25..62ad01def 100644 --- a/version +++ b/version @@ -1 +1 @@ -11.0-11 +11.0-12