From 030faaa601bc4dcca29f6346ed5e93dc133cf51a Mon Sep 17 00:00:00 2001 From: crschnick Date: Sun, 25 Aug 2024 23:27:00 +0000 Subject: [PATCH] Various fixes --- .../xpipe/app/browser/file/BrowserFileListComp.java | 6 ++---- .../browser/session/BrowserAbstractSessionModel.java | 2 +- .../io/xpipe/app/comp/store/StoreCreationMenu.java | 8 ++++---- .../io/xpipe/app/ext/DataStoreCreationCategory.java | 1 - .../java/io/xpipe/app/storage/DataStoreEntry.java | 4 ++-- core/src/main/java/io/xpipe/core/process/OsType.java | 11 ++++++++--- .../io/xpipe/core/store/ExpandedLifecycleStore.java | 4 ++-- .../io/xpipe/core/store/SingletonSessionStore.java | 2 +- .../ext/base/service/CustomServiceStoreProvider.java | 3 +-- lang/base/strings/translations_da.properties | 2 +- lang/base/strings/translations_de.properties | 2 +- lang/base/strings/translations_en.properties | 2 +- lang/base/strings/translations_es.properties | 2 +- lang/base/strings/translations_fr.properties | 2 +- lang/base/strings/translations_it.properties | 2 +- lang/base/strings/translations_ja.properties | 2 +- lang/base/strings/translations_nl.properties | 2 +- lang/base/strings/translations_pt.properties | 2 +- lang/base/strings/translations_ru.properties | 2 +- lang/base/strings/translations_tr.properties | 2 +- lang/base/strings/translations_zh.properties | 2 +- 21 files changed, 33 insertions(+), 32 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 3d1a694ce..0a77aa764 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 @@ -194,11 +194,9 @@ public final class BrowserFileListComp extends SimpleComp { ? unix.getGroup() : m.getCache().getGroups().get(unix.getGid()); var uid = String.valueOf( - unix.getUid() != null ? unix.getUid() : m.getCache().getUidForUser(user)) - .replaceAll("000$", "k"); + unix.getUid() != null ? unix.getUid() : m.getCache().getUidForUser(user)); var gid = String.valueOf( - unix.getGid() != null ? unix.getGid() : m.getCache().getGidForGroup(group)) - .replaceAll("000$", "k"); + unix.getGid() != null ? unix.getGid() : m.getCache().getGidForGroup(group)); if (uid.equals(gid)) { return user + " [" + uid + "]"; } diff --git a/app/src/main/java/io/xpipe/app/browser/session/BrowserAbstractSessionModel.java b/app/src/main/java/io/xpipe/app/browser/session/BrowserAbstractSessionModel.java index 980f13871..0a28540ab 100644 --- a/app/src/main/java/io/xpipe/app/browser/session/BrowserAbstractSessionModel.java +++ b/app/src/main/java/io/xpipe/app/browser/session/BrowserAbstractSessionModel.java @@ -37,7 +37,7 @@ public class BrowserAbstractSessionModel> { } } - void closeSync(BrowserSessionTab e) { + public void closeSync(BrowserSessionTab e) { e.close(); synchronized (BrowserAbstractSessionModel.this) { this.sessionEntries.remove(e); diff --git a/app/src/main/java/io/xpipe/app/comp/store/StoreCreationMenu.java b/app/src/main/java/io/xpipe/app/comp/store/StoreCreationMenu.java index 036d6cb9b..7c305c59d 100644 --- a/app/src/main/java/io/xpipe/app/comp/store/StoreCreationMenu.java +++ b/app/src/main/java/io/xpipe/app/comp/store/StoreCreationMenu.java @@ -35,10 +35,8 @@ public class StoreCreationMenu { menu.getItems() .add(category("addScript", "mdi2s-script-text-outline", DataStoreCreationCategory.SCRIPT, "script")); - menu.getItems().add(category("addService", "mdi2c-cloud-braces", DataStoreCreationCategory.SERVICE, null)); - menu.getItems() - .add(category("addTunnel", "mdi2v-vector-polyline-plus", DataStoreCreationCategory.TUNNEL, null)); + .add(category("addTunnel", "mdi2v-vector-polyline-plus", DataStoreCreationCategory.TUNNEL, "customService")); menu.getItems().add(category("addCommand", "mdi2c-code-greater-than", DataStoreCreationCategory.COMMAND, null)); @@ -82,8 +80,10 @@ public class StoreCreationMenu { category); event.consume(); }); + // Ugly sorting var providers = sub.stream() - .sorted((o1, o2) -> -o1.getModuleName().compareTo(o2.getModuleName())) + .sorted((o1, o2) -> category == DataStoreCreationCategory.DESKTOP ? + -o1.getModuleName().compareTo(o2.getModuleName()) : o1.getModuleName().compareTo(o2.getModuleName())) .toList(); for (int i = 0; i < providers.size(); i++) { var dataStoreProvider = providers.get(i); diff --git a/app/src/main/java/io/xpipe/app/ext/DataStoreCreationCategory.java b/app/src/main/java/io/xpipe/app/ext/DataStoreCreationCategory.java index 17c863dd9..a68bac475 100644 --- a/app/src/main/java/io/xpipe/app/ext/DataStoreCreationCategory.java +++ b/app/src/main/java/io/xpipe/app/ext/DataStoreCreationCategory.java @@ -4,7 +4,6 @@ public enum DataStoreCreationCategory { HOST, DATABASE, SHELL, - SERVICE, COMMAND, TUNNEL, SCRIPT, diff --git a/app/src/main/java/io/xpipe/app/storage/DataStoreEntry.java b/app/src/main/java/io/xpipe/app/storage/DataStoreEntry.java index d230267da..c9f195c17 100644 --- a/app/src/main/java/io/xpipe/app/storage/DataStoreEntry.java +++ b/app/src/main/java/io/xpipe/app/storage/DataStoreEntry.java @@ -520,7 +520,7 @@ public class DataStoreEntry extends StorageElement { try { incrementBusyCounter(); notifyUpdate(false, false); - lifecycleStore.initializeValidate(); + lifecycleStore.initializeStore(); } catch (Exception e) { ErrorEvent.fromThrowable(e).handle(); } finally { @@ -536,7 +536,7 @@ public class DataStoreEntry extends StorageElement { try { incrementBusyCounter(); notifyUpdate(false, false); - lifecycleStore.finalizeValidate(); + lifecycleStore.finalizeStore(); } catch (Exception e) { ErrorEvent.fromThrowable(e).handle(); } finally { diff --git a/core/src/main/java/io/xpipe/core/process/OsType.java b/core/src/main/java/io/xpipe/core/process/OsType.java index 259144a42..a6263bd00 100644 --- a/core/src/main/java/io/xpipe/core/process/OsType.java +++ b/core/src/main/java/io/xpipe/core/process/OsType.java @@ -2,6 +2,7 @@ package io.xpipe.core.process; import io.xpipe.core.store.FileNames; +import java.util.ArrayList; import java.util.List; import java.util.Locale; @@ -96,14 +97,18 @@ public interface OsType { @Override public List determineInterestingPaths(ShellControl pc) throws Exception { var home = getUserHomeDirectory(pc); - return List.of( + var list = new ArrayList<>(List.of( home, - FileNames.getParent(home), FileNames.join(home, "Downloads"), FileNames.join(home, "Documents"), "/etc", "/tmp", - "/var"); + "/var")); + var parentHome = FileNames.getParent(home); + if (parentHome != null && !parentHome.equals("/")) { + list.add(3, parentHome); + } + return list; } @Override diff --git a/core/src/main/java/io/xpipe/core/store/ExpandedLifecycleStore.java b/core/src/main/java/io/xpipe/core/store/ExpandedLifecycleStore.java index b3b0d1720..2a723839a 100644 --- a/core/src/main/java/io/xpipe/core/store/ExpandedLifecycleStore.java +++ b/core/src/main/java/io/xpipe/core/store/ExpandedLifecycleStore.java @@ -2,7 +2,7 @@ package io.xpipe.core.store; public interface ExpandedLifecycleStore extends DataStore { - default void initializeValidate() {} + default void initializeStore() {} - default void finalizeValidate() throws Exception {} + default void finalizeStore() throws Exception {} } diff --git a/core/src/main/java/io/xpipe/core/store/SingletonSessionStore.java b/core/src/main/java/io/xpipe/core/store/SingletonSessionStore.java index a2ac66b4a..aa9974ccd 100644 --- a/core/src/main/java/io/xpipe/core/store/SingletonSessionStore.java +++ b/core/src/main/java/io/xpipe/core/store/SingletonSessionStore.java @@ -4,7 +4,7 @@ public interface SingletonSessionStore extends ExpandedLifecycleStore, InternalCacheDataStore, SessionListener { @Override - default void finalizeValidate() throws Exception { + default void finalizeStore() throws Exception { stopSessionIfNeeded(); } diff --git a/ext/base/src/main/java/io/xpipe/ext/base/service/CustomServiceStoreProvider.java b/ext/base/src/main/java/io/xpipe/ext/base/service/CustomServiceStoreProvider.java index 151d1b823..5579736f6 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/service/CustomServiceStoreProvider.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/service/CustomServiceStoreProvider.java @@ -8,7 +8,6 @@ import io.xpipe.app.storage.DataStoreEntry; import io.xpipe.app.util.OptionsBuilder; import io.xpipe.core.store.DataStore; import io.xpipe.core.store.NetworkTunnelStore; - import javafx.beans.property.Property; import javafx.beans.property.SimpleObjectProperty; @@ -18,7 +17,7 @@ public class CustomServiceStoreProvider extends AbstractServiceStoreProvider { @Override public DataStoreCreationCategory getCreationCategory() { - return DataStoreCreationCategory.SERVICE; + return DataStoreCreationCategory.TUNNEL; } @Override diff --git a/lang/base/strings/translations_da.properties b/lang/base/strings/translations_da.properties index 7a0f13737..579899a35 100644 --- a/lang/base/strings/translations_da.properties +++ b/lang/base/strings/translations_da.properties @@ -164,7 +164,7 @@ fixedServiceGroup.displayDescription=Liste over tilgængelige tjenester på et s mappedService.displayName=Service mappedService.displayDescription=Interagere med en tjeneste, der er eksponeret af en container customService.displayName=Service -customService.displayDescription=Tilføj en ekstern serviceport til tunnel til din lokale maskine +customService.displayDescription=Tunneler automatisk en ekstern serviceport til din lokale maskine fixedService.displayName=Service fixedService.displayDescription=Brug en foruddefineret tjeneste noServices=Ingen tilgængelige tjenester diff --git a/lang/base/strings/translations_de.properties b/lang/base/strings/translations_de.properties index bd1b44fdf..62f9d9d2c 100644 --- a/lang/base/strings/translations_de.properties +++ b/lang/base/strings/translations_de.properties @@ -155,7 +155,7 @@ fixedServiceGroup.displayDescription=Liste der verfügbaren Dienste auf einem Sy mappedService.displayName=Dienst mappedService.displayDescription=Interaktion mit einem Dienst, der von einem Container angeboten wird customService.displayName=Dienst -customService.displayDescription=Füge einen Remote Service Port hinzu, um einen Tunnel zu deinem lokalen Rechner zu erstellen +customService.displayDescription=Automatisches Tunneln eines entfernten Service-Ports zu deinem lokalen Rechner fixedService.displayName=Dienst fixedService.displayDescription=Einen vordefinierten Dienst verwenden noServices=Keine verfügbaren Dienste diff --git a/lang/base/strings/translations_en.properties b/lang/base/strings/translations_en.properties index 232c267bf..83532ae40 100644 --- a/lang/base/strings/translations_en.properties +++ b/lang/base/strings/translations_en.properties @@ -153,7 +153,7 @@ fixedServiceGroup.displayDescription=List the available services on a system mappedService.displayName=Service mappedService.displayDescription=Interact with a service exposed by a container customService.displayName=Service -customService.displayDescription=Add a remote service port to tunnel to your local machine +customService.displayDescription=Automatically tunnel a remote service port to your local machine fixedService.displayName=Service fixedService.displayDescription=Use a predefined service noServices=No available services diff --git a/lang/base/strings/translations_es.properties b/lang/base/strings/translations_es.properties index 5180b3588..4bc1acdeb 100644 --- a/lang/base/strings/translations_es.properties +++ b/lang/base/strings/translations_es.properties @@ -153,7 +153,7 @@ fixedServiceGroup.displayDescription=Enumerar los servicios disponibles en un si mappedService.displayName=Servicio mappedService.displayDescription=Interactúa con un servicio expuesto por un contenedor customService.displayName=Servicio -customService.displayDescription=Añade un puerto de servicio remoto para hacer un túnel a tu máquina local +customService.displayDescription=Tuneliza automáticamente un puerto de servicio remoto a tu máquina local fixedService.displayName=Servicio fixedService.displayDescription=Utilizar un servicio predefinido noServices=No hay servicios disponibles diff --git a/lang/base/strings/translations_fr.properties b/lang/base/strings/translations_fr.properties index 92f555c96..2d3b63240 100644 --- a/lang/base/strings/translations_fr.properties +++ b/lang/base/strings/translations_fr.properties @@ -153,7 +153,7 @@ fixedServiceGroup.displayDescription=Liste les services disponibles sur un syst mappedService.displayName=Service mappedService.displayDescription=Interagir avec un service exposé par un conteneur customService.displayName=Service -customService.displayDescription=Ajoute un port de service à distance pour établir un tunnel vers ta machine locale +customService.displayDescription=Tunnelise automatiquement un port de service distant vers ta machine locale fixedService.displayName=Service fixedService.displayDescription=Utiliser un service prédéfini noServices=Aucun service disponible diff --git a/lang/base/strings/translations_it.properties b/lang/base/strings/translations_it.properties index 916c110d5..0dc6f7179 100644 --- a/lang/base/strings/translations_it.properties +++ b/lang/base/strings/translations_it.properties @@ -153,7 +153,7 @@ fixedServiceGroup.displayDescription=Elenco dei servizi disponibili su un sistem mappedService.displayName=Servizio mappedService.displayDescription=Interagire con un servizio esposto da un contenitore customService.displayName=Servizio -customService.displayDescription=Aggiungi una porta di servizio remoto per creare un tunnel verso la tua macchina locale +customService.displayDescription=Esegui automaticamente il tunnel di una porta di servizio remota verso la tua macchina locale fixedService.displayName=Servizio fixedService.displayDescription=Utilizzare un servizio predefinito noServices=Nessun servizio disponibile diff --git a/lang/base/strings/translations_ja.properties b/lang/base/strings/translations_ja.properties index 07c6947db..1969f52ed 100644 --- a/lang/base/strings/translations_ja.properties +++ b/lang/base/strings/translations_ja.properties @@ -153,7 +153,7 @@ fixedServiceGroup.displayDescription=システムで利用可能なサービス mappedService.displayName=サービス mappedService.displayDescription=コンテナによって公開されたサービスとやりとりする customService.displayName=サービス -customService.displayDescription=リモートサービスのポートを追加してローカルマシンにトンネリングする +customService.displayDescription=リモートサービスのポートをローカルマシンに自動的にトンネリングする fixedService.displayName=サービス fixedService.displayDescription=定義済みのサービスを使う noServices=利用可能なサービスはない diff --git a/lang/base/strings/translations_nl.properties b/lang/base/strings/translations_nl.properties index 2ecb3324e..f29e0f46b 100644 --- a/lang/base/strings/translations_nl.properties +++ b/lang/base/strings/translations_nl.properties @@ -153,7 +153,7 @@ fixedServiceGroup.displayDescription=Een lijst van beschikbare services op een s mappedService.displayName=Service mappedService.displayDescription=Interactie met een service die wordt aangeboden door een container customService.displayName=Service -customService.displayDescription=Een servicepoort op afstand toevoegen om te tunnelen naar je lokale machine +customService.displayDescription=Automatisch een servicepoort op afstand tunnelen naar je lokale machine fixedService.displayName=Service fixedService.displayDescription=Een vooraf gedefinieerde service gebruiken noServices=Geen beschikbare diensten diff --git a/lang/base/strings/translations_pt.properties b/lang/base/strings/translations_pt.properties index ec1117783..1ca6da6bf 100644 --- a/lang/base/strings/translations_pt.properties +++ b/lang/base/strings/translations_pt.properties @@ -153,7 +153,7 @@ fixedServiceGroup.displayDescription=Lista os serviços disponíveis num sistema mappedService.displayName=Serviço mappedService.displayDescription=Interage com um serviço exposto por um contentor customService.displayName=Serviço -customService.displayDescription=Adiciona uma porta de serviço remoto para criar um túnel para a tua máquina local +customService.displayDescription=Faz o tunelamento automático de uma porta de serviço remoto para a tua máquina local fixedService.displayName=Serviço fixedService.displayDescription=Utiliza um serviço predefinido noServices=Não há serviços disponíveis diff --git a/lang/base/strings/translations_ru.properties b/lang/base/strings/translations_ru.properties index 7b8a0003d..faa826dd6 100644 --- a/lang/base/strings/translations_ru.properties +++ b/lang/base/strings/translations_ru.properties @@ -153,7 +153,7 @@ fixedServiceGroup.displayDescription=Список доступных серви mappedService.displayName=Сервис mappedService.displayDescription=Взаимодействие с сервисом, открываемым контейнером customService.displayName=Сервис -customService.displayDescription=Добавьте порт удаленного сервиса для туннелирования к вашей локальной машине +customService.displayDescription=Автоматическое туннелирование порта удаленного сервиса на твою локальную машину fixedService.displayName=Сервис fixedService.displayDescription=Использовать предопределенный сервис noServices=Нет доступных сервисов diff --git a/lang/base/strings/translations_tr.properties b/lang/base/strings/translations_tr.properties index 9cffa7fb9..188490243 100644 --- a/lang/base/strings/translations_tr.properties +++ b/lang/base/strings/translations_tr.properties @@ -153,7 +153,7 @@ fixedServiceGroup.displayDescription=Bir sistemdeki mevcut hizmetleri listeleme mappedService.displayName=Hizmet mappedService.displayDescription=Bir konteyner tarafından sunulan bir hizmetle etkileşim customService.displayName=Hizmet -customService.displayDescription=Yerel makinenize tünel açmak için bir uzak hizmet bağlantı noktası ekleyin +customService.displayDescription=Uzaktaki bir hizmet portunu otomatik olarak yerel makinenize tünelleme fixedService.displayName=Hizmet fixedService.displayDescription=Önceden tanımlanmış bir hizmet kullanın noServices=Mevcut hizmet yok diff --git a/lang/base/strings/translations_zh.properties b/lang/base/strings/translations_zh.properties index 3c2fa2b13..e2cbc2be3 100644 --- a/lang/base/strings/translations_zh.properties +++ b/lang/base/strings/translations_zh.properties @@ -153,7 +153,7 @@ fixedServiceGroup.displayDescription=列出系统中可用的服务 mappedService.displayName=服务 mappedService.displayDescription=与容器暴露的服务交互 customService.displayName=服务 -customService.displayDescription=添加远程服务端口,以隧道方式连接本地计算机 +customService.displayDescription=自动将远程服务端口传输到本地计算机 fixedService.displayName=服务 fixedService.displayDescription=使用预定义服务 noServices=无可用服务