From c0c51c38b39bf2b8faf4e4cd16b54b6b3e5d4450 Mon Sep 17 00:00:00 2001 From: schlagmichdoch Date: Thu, 2 Feb 2023 15:19:28 +0100 Subject: [PATCH] only activate paste-mode the first time a file is opened with PairDrop by looking for the url parameter on start and removing it afterwords. --- public/scripts/ui.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/scripts/ui.js b/public/scripts/ui.js index 3d507d8..70bfd99 100644 --- a/public/scripts/ui.js +++ b/public/scripts/ui.js @@ -1287,7 +1287,8 @@ class WebShareTargetUI { class WebFileHandlersUI { constructor() { - if ("launchQueue" in window) { + const urlParams = new URL(window.location).searchParams; + if (urlParams.has("file_handler") && "launchQueue" in window) { launchQueue.setConsumer(async launchParams => { console.log("Launched with: ", launchParams); if (!launchParams.files.length) @@ -1303,6 +1304,7 @@ class WebFileHandlersUI { Events.fire('activate-paste-mode', {files: files, text: ""}) launchParams = null; }); + window.history.replaceState({}, "Rewrite URL", '/'); } } }