mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2026-04-22 07:04:53 +08: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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user