mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2026-04-06 01:43:48 +00: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:
@@ -1024,7 +1024,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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1575,7 +1576,8 @@ class Base64ZipDialog extends Dialog {
|
||||
}
|
||||
|
||||
clearBrowserHistory() {
|
||||
window.history.replaceState({}, "Rewrite URL", '/');
|
||||
const url = getUrlWithoutArguments();
|
||||
window.history.replaceState({}, "Rewrite URL", url);
|
||||
}
|
||||
|
||||
hide() {
|
||||
@@ -1791,7 +1793,8 @@ class WebShareTargetUI {
|
||||
}
|
||||
}
|
||||
}
|
||||
window.history.replaceState({}, "Rewrite URL", '/');
|
||||
const url = getUrlWithoutArguments();
|
||||
window.history.replaceState({}, "Rewrite URL", url);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1815,7 +1818,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -402,3 +402,7 @@ const cyrb53 = function(str, seed = 0) {
|
||||
function onlyUnique (value, index, array) {
|
||||
return array.indexOf(value) === index;
|
||||
}
|
||||
|
||||
function getUrlWithoutArguments() {
|
||||
return `${window.location.protocol}//${window.location.host}${window.location.pathname}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user