mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-09-30 04:15:52 +00:00
Various fixes
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package io.xpipe.app.action;
|
||||
|
||||
import io.xpipe.app.core.AppCache;
|
||||
import io.xpipe.app.core.AppRestart;
|
||||
import io.xpipe.app.core.window.AppDialog;
|
||||
import io.xpipe.app.ext.ProcModuleProvider;
|
||||
@@ -26,12 +27,20 @@ public class XPipeUrlProvider implements LauncherUrlProvider {
|
||||
}
|
||||
|
||||
if ("action".equals(a)) {
|
||||
if (!checkPermission()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var query = uri.getQuery();
|
||||
var action = ActionUrls.parse(query);
|
||||
return action.orElse(null);
|
||||
}
|
||||
|
||||
if ("sync".equals(a)) {
|
||||
if (!checkPermission()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var repo = new String(Base64Helper.fromBase64UrlString(uri.getPath()), StandardCharsets.UTF_8);
|
||||
var alreadySynced = AppPrefs.get().storageGitRemote().getValue() != null;
|
||||
if (alreadySynced && !repo.equals(AppPrefs.get().storageGitRemote().getValue())) {
|
||||
@@ -47,4 +56,17 @@ public class XPipeUrlProvider implements LauncherUrlProvider {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean checkPermission() {
|
||||
var cache = AppCache.getBoolean("externalUrlsPermitted", false);
|
||||
if (cache) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var r = AppDialog.confirm("externalUrl");
|
||||
if (r) {
|
||||
AppCache.update("externalUrlsPermitted", true);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,8 @@ public class AppInstance {
|
||||
client.get()
|
||||
.performRequest(DaemonOpenExchange.Request.builder()
|
||||
.arguments(inputs)
|
||||
.directory(AppProperties.get().getDataDir())
|
||||
// Don't change dir when opening inputs
|
||||
.directory(inputs.isEmpty() ? AppProperties.get().getDataDir() : null)
|
||||
.build());
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
@@ -115,7 +116,6 @@ public class AppInstance {
|
||||
client.get()
|
||||
.performRequest(DaemonOpenExchange.Request.builder()
|
||||
.arguments(List.of(e.getURI().toString()))
|
||||
.directory(AppProperties.get().getDataDir())
|
||||
.build());
|
||||
} catch (Exception ex) {
|
||||
ErrorEventFactory.fromThrowable(ex).expected().omit().handle();
|
||||
|
||||
@@ -97,7 +97,7 @@ public class AppOpenArguments {
|
||||
|
||||
try {
|
||||
var path = Path.of(input);
|
||||
if (Files.isRegularFile(path)) {
|
||||
if (Files.isRegularFile(path) && path.isAbsolute() && path.getParent() != null) {
|
||||
path = path.getParent();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,14 +5,23 @@ import io.xpipe.app.process.CountDown;
|
||||
import io.xpipe.app.process.SecretReference;
|
||||
import io.xpipe.app.util.GlobalTimer;
|
||||
import io.xpipe.app.util.SecretValue;
|
||||
import lombok.Value;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class SecretManager {
|
||||
|
||||
private static final Map<SecretReference, SecretValue> secrets = new HashMap<>();
|
||||
@Value
|
||||
private static class CachedValue {
|
||||
|
||||
SecretValue value;
|
||||
Instant expiry;
|
||||
}
|
||||
|
||||
private static final Map<SecretReference, CachedValue> secrets = new HashMap<>();
|
||||
private static final Set<SecretQueryProgress> progress = new HashSet<>();
|
||||
|
||||
public static synchronized Optional<SecretQueryProgress> getProgress(UUID requestId, UUID storeId) {
|
||||
@@ -119,7 +128,7 @@ public class SecretManager {
|
||||
.collect(Collectors.toSet());
|
||||
secrets.entrySet().removeAll(oldSecrets);
|
||||
|
||||
for (Map.Entry<SecretReference, SecretValue> e : oldSecrets) {
|
||||
for (Map.Entry<SecretReference, CachedValue> e : oldSecrets) {
|
||||
var newRef = new SecretReference(newId, e.getKey().getSubId());
|
||||
secrets.put(newRef, e.getValue());
|
||||
}
|
||||
@@ -130,19 +139,16 @@ public class SecretManager {
|
||||
}
|
||||
|
||||
public static synchronized void cache(SecretReference ref, SecretValue value, Duration duration) {
|
||||
secrets.put(ref, value);
|
||||
if (duration != null && duration.isPositive()) {
|
||||
GlobalTimer.delay(
|
||||
() -> {
|
||||
synchronized (SecretManager.class) {
|
||||
secrets.remove(ref);
|
||||
}
|
||||
},
|
||||
duration);
|
||||
}
|
||||
secrets.put(ref, new CachedValue(value, duration != null && duration.isPositive() ? Instant.now().plus(duration) : null));
|
||||
}
|
||||
|
||||
public static synchronized Optional<SecretValue> get(SecretReference ref) {
|
||||
return Optional.ofNullable(secrets.get(ref));
|
||||
var found = secrets.get(ref);
|
||||
if (found.getExpiry() != null && found.getExpiry().isAfter(Instant.now())) {
|
||||
secrets.remove(ref);
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
return Optional.of(found.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,8 +78,13 @@ public class ContextualFileReference {
|
||||
|
||||
public String serialize() {
|
||||
var start = getDataDir();
|
||||
var startString = start.toString();
|
||||
var normalizedPath = FilePath.of(path).normalize().toUnix();
|
||||
if (normalizedPath.startsWith(start) && !normalizedPath.equals(start)) {
|
||||
var normalizedString = normalizedPath.toString();
|
||||
// This guarantees a case-insensitive check
|
||||
var startsWith = normalizedString.length() > startString.length() && normalizedString
|
||||
.substring(0, startString.length()).equalsIgnoreCase(startString);
|
||||
if (startsWith) {
|
||||
return "<DATA>" + "/" + normalizedPath.relativize(start);
|
||||
}
|
||||
return path;
|
||||
|
||||
Vendored
+1
-1
@@ -42,7 +42,7 @@ jlink {
|
||||
// '--strip-debug',
|
||||
'--no-header-files',
|
||||
'--no-man-pages',
|
||||
'--compress', '0',
|
||||
'--compress', 'zip-0',
|
||||
'--ignore-signing-information'
|
||||
]
|
||||
|
||||
|
||||
Generated
+2
@@ -1341,6 +1341,8 @@ vaultUserLegacy=Vault-bruger (begrænset kompatibilitetstilstand med ældre vers
|
||||
upgradeInstructions=Opgraderingsvejledning
|
||||
externalActionTitle=Anmodning om ekstern handling
|
||||
externalActionContent=Der er anmodet om en ekstern handling. Vil du tillade, at der udføres handlinger uden for XPipe?
|
||||
externalUrlTitle=Anmodning om handling via ekstern URL
|
||||
externalUrlContent=Der blev åbnet en ekstern URL-handling. Vil du tillade, at der fremover kan åbnes URL'er uden for XPipe?
|
||||
noScriptStateAvailable=Opdater for at fastslå scriptkompatibilitet ...
|
||||
documentationDescription=Se dokumentationen
|
||||
customEditorCommandInTerminal=Kør en brugerdefineret kommando i en terminal
|
||||
|
||||
Generated
+2
@@ -1334,6 +1334,8 @@ vaultUserLegacy=Vault-Benutzer (eingeschränkter Kompatibilitätsmodus für ält
|
||||
upgradeInstructions=Anweisungen zum Upgrade
|
||||
externalActionTitle=Anforderung einer externen Aktion
|
||||
externalActionContent=Eine externe Aktion wurde angefordert. Möchtest du zulassen, dass Aktionen von außerhalb von XPipe gestartet werden?
|
||||
externalUrlTitle=Anfrage für eine externe URL-Aktion
|
||||
externalUrlContent=Eine externe URL-Aktion wurde geöffnet. Möchtest du in Zukunft das Öffnen von URLs von außerhalb von XPipe zulassen?
|
||||
noScriptStateAvailable=Aktualisiere die Seite, um die Skriptkompatibilität zu prüfen ...
|
||||
documentationDescription=Schau dir die Dokumentation an
|
||||
customEditorCommandInTerminal=Benutzerdefinierten Befehl in einem Terminal ausführen
|
||||
|
||||
Generated
+2
@@ -1368,6 +1368,8 @@ vaultUserLegacy=Vault user (Limited legacy compatibility mode)
|
||||
upgradeInstructions=Upgrade instructions
|
||||
externalActionTitle=External action request
|
||||
externalActionContent=An external action was requested. Do you want to allow launching actions from outside XPipe?
|
||||
externalUrlTitle=External URL action request
|
||||
externalUrlContent=An external URL action was opened. Do you want to allow launching URLs from outside XPipe?
|
||||
noScriptStateAvailable=Refresh to determine script compatibility ...
|
||||
documentationDescription=Check out the documentation
|
||||
customEditorCommandInTerminal=Run custom command in a terminal
|
||||
|
||||
Generated
+2
@@ -1303,6 +1303,8 @@ vaultUserLegacy=Usuario de Vault (modo de compatibilidad heredada limitada)
|
||||
upgradeInstructions=Instrucciones de actualización
|
||||
externalActionTitle=Solicitud de acción externa
|
||||
externalActionContent=Se ha solicitado una acción externa. ¿Quieres permitir que se inicien acciones desde fuera de XPipe?
|
||||
externalUrlTitle=Solicitud de acción de URL externa
|
||||
externalUrlContent=Se ha abierto una acción de URL externa. ¿Quieres permitir que se abran URL desde fuera de XPipe en el futuro?
|
||||
noScriptStateAvailable=Actualiza la página para comprobar la compatibilidad del script...
|
||||
documentationDescription=Echa un vistazo a la documentación
|
||||
customEditorCommandInTerminal=Ejecutar un comando personalizado en un terminal
|
||||
|
||||
Generated
+2
@@ -1337,6 +1337,8 @@ vaultUserLegacy=Utilisateur du coffre-fort (mode de compatibilité héritée lim
|
||||
upgradeInstructions=Instructions de mise à jour
|
||||
externalActionTitle=Demande d'action externe
|
||||
externalActionContent=Une action externe a été demandée. Tu veux autoriser le lancement d'actions depuis l'extérieur de XPipe ?
|
||||
externalUrlTitle=Demande d'action vers une URL externe
|
||||
externalUrlContent=Une action URL externe a été ouverte. Tu veux autoriser le lancement d'URL depuis l'extérieur de XPipe à l'avenir ?
|
||||
noScriptStateAvailable=Actualise la page pour vérifier la compatibilité du script...
|
||||
documentationDescription=Consulte la documentation
|
||||
customEditorCommandInTerminal=Exécuter une commande personnalisée dans un terminal
|
||||
|
||||
Generated
+2
@@ -1303,6 +1303,8 @@ vaultUserLegacy=Pengguna Vault (Mode kompatibilitas warisan terbatas)
|
||||
upgradeInstructions=Petunjuk pembaruan
|
||||
externalActionTitle=Permintaan tindakan eksternal
|
||||
externalActionContent=Telah diminta tindakan eksternal. Apakah Anda ingin mengizinkan peluncuran tindakan dari luar XPipe?
|
||||
externalUrlTitle=Permintaan tindakan URL eksternal
|
||||
externalUrlContent=Tindakan URL eksternal telah dibuka. Apakah Anda ingin mengizinkan peluncuran URL dari luar XPipe di masa mendatang?
|
||||
noScriptStateAvailable=Segarkan untuk menentukan kompatibilitas skrip ...
|
||||
documentationDescription=Silakan lihat dokumentasinya
|
||||
customEditorCommandInTerminal=Menjalankan perintah khusus di terminal
|
||||
|
||||
Generated
+2
@@ -1303,6 +1303,8 @@ vaultUserLegacy=Utente di Vault (modalità di compatibilità legacy limitata)
|
||||
upgradeInstructions=Istruzioni per l'aggiornamento
|
||||
externalActionTitle=Richiesta di azione esterna
|
||||
externalActionContent=È stata richiesta un'azione esterna. Vuoi consentire l'avvio di azioni dall'esterno di XPipe?
|
||||
externalUrlTitle=Richiesta di azione URL esterno
|
||||
externalUrlContent=È stata aperta un'azione URL esterna. Vuoi consentire in futuro l'apertura di URL dall'esterno di XPipe?
|
||||
noScriptStateAvailable=Aggiorna per verificare la compatibilità dello script...
|
||||
documentationDescription=Dai un'occhiata alla documentazione
|
||||
customEditorCommandInTerminal=Esegui un comando personalizzato in un terminale
|
||||
|
||||
Generated
+2
@@ -1303,6 +1303,8 @@ vaultUserLegacy=Vaultユーザー(限定的なレガシー互換モード)
|
||||
upgradeInstructions=アップグレードの手順
|
||||
externalActionTitle=外部アクションのリクエスト
|
||||
externalActionContent=外部からのアクションが要求された。XPipeの外部からのアクションの実行を許可するか?
|
||||
externalUrlTitle=外部URLアクションのリクエスト
|
||||
externalUrlContent=外部URLアクションが開かれた。今後、XPipeの外部からURLを起動することを許可するか?
|
||||
noScriptStateAvailable=スクリプトの互換性を確認するためにページを更新する……
|
||||
documentationDescription=ドキュメントを確認する
|
||||
customEditorCommandInTerminal=ターミナルでカスタムコマンドを実行する
|
||||
|
||||
Generated
+2
@@ -1335,6 +1335,8 @@ vaultUserLegacy=Vault 사용자 (레거시 호환성 모드 제한)
|
||||
upgradeInstructions=업그레이드 방법
|
||||
externalActionTitle=외부 작업 요청
|
||||
externalActionContent=외부 작업이 요청되었습니다. XPipe 외부에서 작업을 실행하도록 허용하시겠습니까?
|
||||
externalUrlTitle=외부 URL 동작 요청
|
||||
externalUrlContent=외부 URL 작업이 열렸습니다. 향후 XPipe 외부에서 URL을 실행하는 것을 허용하시겠습니까?
|
||||
#custom
|
||||
noScriptStateAvailable=스크립트 호환성을 확인하려면 새로고침 ...
|
||||
documentationDescription=문서를 확인해 보세요
|
||||
|
||||
Generated
+2
@@ -1303,6 +1303,8 @@ vaultUserLegacy=Vault-gebruiker (Beperkte compatibiliteitsmodus voor oudere vers
|
||||
upgradeInstructions=Upgrade-instructies
|
||||
externalActionTitle=Verzoek om externe actie
|
||||
externalActionContent=Er is een externe actie aangevraagd. Wil je toestaan dat er acties worden gestart van buiten XPipe?
|
||||
externalUrlTitle=Verzoek tot uitvoering van een externe URL-actie
|
||||
externalUrlContent=Er is een externe URL-actie geopend. Wil je in de toekomst toestaan dat er URL's van buiten XPipe worden geopend?
|
||||
noScriptStateAvailable=Ververs de pagina om te kijken of het script compatibel is ...
|
||||
documentationDescription=Bekijk de documentatie
|
||||
customEditorCommandInTerminal=Een aangepast commando uitvoeren in een terminal
|
||||
|
||||
Generated
+2
@@ -1304,6 +1304,8 @@ vaultUserLegacy=Użytkownik Vault (tryb ograniczonej kompatybilności z starszym
|
||||
upgradeInstructions=Instrukcje aktualizacji
|
||||
externalActionTitle=Żądanie akcji zewnętrznej
|
||||
externalActionContent=Zgłoszono żądanie wykonania akcji zewnętrznej. Czy chcesz zezwolić na uruchamianie akcji spoza XPipe?
|
||||
externalUrlTitle=Żądanie akcji dotyczące zewnętrznego adresu URL
|
||||
externalUrlContent=Została otwarta akcja z zewnętrznym adresem URL. Czy chcesz zezwolić na otwieranie adresów URL spoza XPipe w przyszłości?
|
||||
noScriptStateAvailable=Odśwież stronę, żeby sprawdzić zgodność skryptu...
|
||||
documentationDescription=Zajrzyj do dokumentacji
|
||||
customEditorCommandInTerminal=Uruchom niestandardowe polecenie w terminalu
|
||||
|
||||
Generated
+2
@@ -1303,6 +1303,8 @@ vaultUserLegacy=Utilizador do Vault (modo de compatibilidade com versões antiga
|
||||
upgradeInstructions=Instruções de atualização
|
||||
externalActionTitle=Pedido de ação externa
|
||||
externalActionContent=Foi solicitada uma ação externa. Queres permitir que sejam iniciadas ações a partir do exterior do XPipe?
|
||||
externalUrlTitle=Pedido de ação de URL externo
|
||||
externalUrlContent=Foi aberta uma ação de URL externa. Queres permitir que se abram URLs a partir do exterior do XPipe no futuro?
|
||||
noScriptStateAvailable=Atualiza para verificar a compatibilidade do script...
|
||||
documentationDescription=Dá uma olhadela na documentação
|
||||
customEditorCommandInTerminal=Executar um comando personalizado num terminal
|
||||
|
||||
Generated
+2
@@ -1395,6 +1395,8 @@ vaultUserLegacy=Пользователь хранилища (режим огра
|
||||
upgradeInstructions=Инструкции по обновлению
|
||||
externalActionTitle=Запрос на внешнее действие
|
||||
externalActionContent=Поступил запрос на выполнение внешнего действия. Хочешь разрешить запуск действий из-за пределов XPipe?
|
||||
externalUrlTitle=Запрос на действие с внешним URL-адресом
|
||||
externalUrlContent=Было запущено действие с внешним URL-адресом. Хочешь разрешить запуск URL-адресов извне XPipe в будущем?
|
||||
noScriptStateAvailable=Обнови страницу, чтобы проверить совместимость скриптов...
|
||||
documentationDescription=Загляни в документацию
|
||||
customEditorCommandInTerminal=Запустить пользовательскую команду в терминале
|
||||
|
||||
Generated
+2
@@ -1303,6 +1303,8 @@ vaultUserLegacy=Vault-användare (begränsat kompatibilitetsläge för äldre ve
|
||||
upgradeInstructions=Uppgraderingsanvisningar
|
||||
externalActionTitle=Begäran om extern åtgärd
|
||||
externalActionContent=En extern åtgärd har begärts. Vill du tillåta att åtgärder startas från utanför XPipe?
|
||||
externalUrlTitle=Begäran om åtgärd via extern URL
|
||||
externalUrlContent=En extern URL-åtgärd har öppnats. Vill du tillåta att URL:er från utanför XPipe öppnas i framtiden?
|
||||
noScriptStateAvailable=Uppdatera för att kontrollera skriptkompatibiliteten ...
|
||||
documentationDescription=Läs dokumentationen
|
||||
customEditorCommandInTerminal=Kör ett anpassat kommando i en terminal
|
||||
|
||||
Generated
+2
@@ -1303,6 +1303,8 @@ vaultUserLegacy=Vault kullanıcısı (Sınırlı eski sürüm uyumluluk modu)
|
||||
upgradeInstructions=Yükseltme talimatları
|
||||
externalActionTitle=Harici eylem isteği
|
||||
externalActionContent=Harici bir eylem talep edildi. XPipe dışından eylemlerin başlatılmasına izin vermek istiyor musunuz?
|
||||
externalUrlTitle=Harici URL eylem isteği
|
||||
externalUrlContent=Harici bir URL eylemi açıldı. Gelecekte XPipe dışından URL'lerin açılmasına izin vermek istiyor musunuz?
|
||||
noScriptStateAvailable=Komut dosyası uyumluluğunu belirlemek için sayfayı yenileyin ...
|
||||
documentationDescription=Belgelere göz atın
|
||||
customEditorCommandInTerminal=Terminalde özel komut çalıştırma
|
||||
|
||||
Generated
+2
@@ -1303,6 +1303,8 @@ vaultUserLegacy=Người dùng Vault (Chế độ tương thích cũ giới hạ
|
||||
upgradeInstructions=Hướng dẫn nâng cấp
|
||||
externalActionTitle=Yêu cầu thực hiện hành động bên ngoài
|
||||
externalActionContent=Có yêu cầu thực hiện một hành động từ bên ngoài. Cậu có muốn cho phép khởi chạy các hành động từ bên ngoài XPipe không?
|
||||
externalUrlTitle=Yêu cầu hành động URL bên ngoài
|
||||
externalUrlContent=Một hành động URL bên ngoài đã được mở. Cậu có muốn cho phép mở các URL từ bên ngoài XPipe trong tương lai không?
|
||||
noScriptStateAvailable=Làm mới để kiểm tra tính tương thích của tập lệnh ...
|
||||
documentationDescription=Cậu hãy xem tài liệu hướng dẫn nhé
|
||||
customEditorCommandInTerminal=Chạy lệnh tùy chỉnh trong terminal
|
||||
|
||||
+2
@@ -1753,6 +1753,8 @@ upgradeInstructions=升级说明
|
||||
externalActionTitle=外部操作请求
|
||||
#custom
|
||||
externalActionContent=检测到一个外部操作请求。是否允许从 XPipe 外部启动操作?
|
||||
externalUrlTitle=外部URL操作请求
|
||||
externalUrlContent=已打开一个外部 URL 操作。您是否允许今后从 XPipe 外部启动 URL?
|
||||
#custom
|
||||
noScriptStateAvailable=刷新以检测脚本兼容性…
|
||||
documentationDescription=请查阅文档
|
||||
|
||||
+2
@@ -1303,6 +1303,8 @@ vaultUserLegacy=Vault 使用者(有限的舊版相容模式)
|
||||
upgradeInstructions=升級說明
|
||||
externalActionTitle=外部動作請求
|
||||
externalActionContent=系統收到外部動作請求。您是否允許從 XPipe 外部啟動動作?
|
||||
externalUrlTitle=外部 URL 動作請求
|
||||
externalUrlContent=已開啟一個外部 URL 動作。您是否要允許今後從 XPipe 外部啟動 URL?
|
||||
noScriptStateAvailable=請重新整理以確認腳本相容性……
|
||||
documentationDescription=請參閱相關文件
|
||||
customEditorCommandInTerminal=在終端機中執行自訂指令
|
||||
|
||||
Reference in New Issue
Block a user