mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-23 00:06:18 -04:00
Fix clearBrowserHistory: url should not always be replaced by "/" as PairDrop might not always be hosted at domain root
This commit is contained in:
parent
a3a8228327
commit
d36cd3524c
6 changed files with 58 additions and 42 deletions
|
@ -1025,7 +1025,8 @@ class PairDeviceDialog extends Dialog {
|
|||
const urlParams = new URLSearchParams(window.location.search);
|
||||
if (urlParams.has('room_key')) {
|
||||
this._pairDeviceJoin(urlParams.get('room_key'));
|
||||
window.history.replaceState({}, "title**", '/'); //remove room_key from url
|
||||
const url = getUrlWithoutArguments();
|
||||
window.history.replaceState({}, "Rewrite URL", url); //remove room_key from url
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1576,7 +1577,8 @@ class Base64ZipDialog extends Dialog {
|
|||
}
|
||||
|
||||
clearBrowserHistory() {
|
||||
window.history.replaceState({}, "Rewrite URL", '/');
|
||||
const url = getUrlWithoutArguments();
|
||||
window.history.replaceState({}, "Rewrite URL", url);
|
||||
}
|
||||
|
||||
hide() {
|
||||
|
@ -1792,7 +1794,8 @@ class WebShareTargetUI {
|
|||
}
|
||||
}
|
||||
}
|
||||
window.history.replaceState({}, "Rewrite URL", '/');
|
||||
const url = getUrlWithoutArguments();
|
||||
window.history.replaceState({}, "Rewrite URL", url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1816,7 +1819,8 @@ class WebFileHandlersUI {
|
|||
Events.fire('activate-paste-mode', {files: files, text: ""})
|
||||
launchParams = null;
|
||||
});
|
||||
window.history.replaceState({}, "Rewrite URL", '/');
|
||||
const url = getUrlWithoutArguments();
|
||||
window.history.replaceState({}, "Rewrite URL", url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -403,6 +403,10 @@ function onlyUnique (value, index, array) {
|
|||
return array.indexOf(value) === index;
|
||||
}
|
||||
|
||||
function getUrlWithoutArguments() {
|
||||
return `${window.location.protocol}//${window.location.host}${window.location.pathname}`;
|
||||
}
|
||||
|
||||
function arrayBufferToBase64(buffer) {
|
||||
var binary = '';
|
||||
var bytes = new Uint8Array(buffer);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue