From 5595713dc8a800648639f0cd48b28bd5414c508f Mon Sep 17 00:00:00 2001 From: crschnick Date: Wed, 23 Apr 2025 15:17:51 +0000 Subject: [PATCH] Small fixes --- .../ContextualFileReferenceChoiceComp.java | 51 ++++++++++--------- .../io/xpipe/app/icon/SystemIconManager.java | 5 +- dist/changelogs/16.0.md | 1 + 3 files changed, 32 insertions(+), 25 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/comp/base/ContextualFileReferenceChoiceComp.java b/app/src/main/java/io/xpipe/app/comp/base/ContextualFileReferenceChoiceComp.java index 99e79722f..ae0e41322 100644 --- a/app/src/main/java/io/xpipe/app/comp/base/ContextualFileReferenceChoiceComp.java +++ b/app/src/main/java/io/xpipe/app/comp/base/ContextualFileReferenceChoiceComp.java @@ -98,31 +98,34 @@ public class ContextualFileReferenceChoiceComp extends Comp> } try { - var source = Path.of(currentPath.toString()); - var target = sync.getTargetLocation().apply(source); - if (Files.exists(source)) { - var shouldCopy = AppWindowHelper.showConfirmationAlert( - "confirmGitShareTitle", "confirmGitShareHeader", "confirmGitShareContent"); - if (!shouldCopy) { - return; - } - - var handler = DataStorageSyncHandler.getInstance(); - var syncedTarget = handler.addDataFile( - source, target, sync.getPerUser().test(source)); - - var pubSource = Path.of(source + ".pub"); - if (Files.exists(pubSource)) { - var pubTarget = sync.getTargetLocation().apply(pubSource); - DataStorageSyncHandler.getInstance() - .addDataFile( - pubSource, pubTarget, sync.getPerUser().test(pubSource)); - } - - Platform.runLater(() -> { - filePath.setValue(FilePath.of(syncedTarget)); - }); + var source = currentPath.asLocalPath(); + if (!Files.exists(source)) { + ErrorEvent.fromMessage("Unable to resolve local file path " + source).expected().handle(); + return; } + + var target = sync.getTargetLocation().apply(source); + var shouldCopy = AppWindowHelper.showConfirmationAlert( + "confirmGitShareTitle", "confirmGitShareHeader", "confirmGitShareContent"); + if (!shouldCopy) { + return; + } + + var handler = DataStorageSyncHandler.getInstance(); + var syncedTarget = handler.addDataFile( + source, target, sync.getPerUser().test(source)); + + var pubSource = Path.of(source + ".pub"); + if (Files.exists(pubSource)) { + var pubTarget = sync.getTargetLocation().apply(pubSource); + DataStorageSyncHandler.getInstance() + .addDataFile( + pubSource, pubTarget, sync.getPerUser().test(pubSource)); + } + + Platform.runLater(() -> { + filePath.setValue(FilePath.of(syncedTarget)); + }); } catch (Exception e) { ErrorEvent.fromThrowable(e).handle(); } diff --git a/app/src/main/java/io/xpipe/app/icon/SystemIconManager.java b/app/src/main/java/io/xpipe/app/icon/SystemIconManager.java index d531e68c9..e19b4d036 100644 --- a/app/src/main/java/io/xpipe/app/icon/SystemIconManager.java +++ b/app/src/main/java/io/xpipe/app/icon/SystemIconManager.java @@ -3,6 +3,7 @@ package io.xpipe.app.icon; import io.xpipe.app.core.AppProperties; import io.xpipe.app.issue.ErrorEvent; import io.xpipe.app.prefs.AppPrefs; +import io.xpipe.app.prefs.SupportedLocale; import io.xpipe.app.resources.AppImages; import io.xpipe.app.storage.DataStorage; import io.xpipe.core.util.ValidationException; @@ -26,8 +27,10 @@ public class SystemIconManager { .path(DataStorage.getStorageDirectory().resolve("icons")) .id("custom") .build()); + // For chinese users, GitHub link might be unreliable + // So use an alternative chinese mirror they can use all.add(SystemIconSource.GitRepository.builder() - .remote("https://github.com/selfhst/icons") + .remote(AppPrefs.get().language().getValue() == SupportedLocale.CHINESE ? "https://gitcode.com/gh_mirrors/icons13/icons" : "https://github.com/selfhst/icons") .id("selfhst") .build()); for (var pref : prefs) { diff --git a/dist/changelogs/16.0.md b/dist/changelogs/16.0.md index 1306ad510..285787721 100644 --- a/dist/changelogs/16.0.md +++ b/dist/changelogs/16.0.md @@ -91,4 +91,5 @@ The application window will now hide any unnecessary sidebars when being resized - Fix some launched applications exiting on Windows if XPipe is closed - Fix powershell profile modules potentially breaking powershell shell environments - Fix terminal launch failing on Windows when connection name contained some special characters +- Fix selfhst icons not reliably working for chinese users - Fix application restart after update not applying current workspace directory